Search Results

Search found 1907 results on 77 pages for 'the man on the clapham omnibus'.

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

  • Importing .dll into Qt

    - by Bad Man
    I want to bring a .dll dependency into my Qt project. So I added this to my .pro file: win32 { LIBS += C:\lib\dependency.lib LIBS += C:\lib\dependency.dll } And then (I don't know if this is the right syntax or not) #include <windows.h> Q_DECL_IMPORT int WINAPI DoSomething(); btw the .dll looks something like this: #include <windows.h> BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { return TRUE; } extern "C" { int WINAPI DoSomething() { return -1; } }; Getting error: unresolved symbol? Note: I'm not experienced with .dll's outside of .NET's ez pz assembly architechture, definitely a n00b.

    Read the article

  • Symfony forms question (restoring selected value of a dynamically populated sfWidgetFormSelect widge

    - by Stick it to THE MAN
    I am using Symfony 1.3.2 with Propel ORM on Ubuntu 9.10. I have developed a form that dynamically populates a select widget with cities in a selected country, using AJAX. Before the data entered on the form is saved, I validate the form. If validation fails, the form is presented back to the user for correction. However, because the country list is dynamically generated, the form that is presented for correction does not have a valid city selected (it is empty, since the country widget has not changed yet). This is inconvenient for the user, because it means they have to select ANOTHER country (so the change event is fired), and then change back to the original country they selected, then FINALLY select the city which they had last selected. All of this is forced on the user because another (possibly unrelated) field did not vaildate. I tried $form-getValue('widget_name'), called immediately after $form-bind(), but it seems (infact, IIRC, if form fails to validate, all the values are reset to null) - so that does not work. I am currently trying a nasty hack which involves the use of directly accesing the input (i.e. tainted) data via $_POST, and setting them into a flash variable - but I feel its a very nasty hack) What I'm trying to do is a common use case scenario - is there a better way to do this, than hacking around with $_POST etc?

    Read the article

  • Trying to issue a mouseclick event on a QWebElement in QWebView QtWebKit

    - by Bad Man
    I'm trying to send a mouse click event on a certain element in the QtWebKit DOM but I'm obviously doing it wrong: QWebElement el=this->page()->mainFrame()->findFirstElement("input[type=submit]"); el.setFocus(); QMouseEvent pressEvent(QMouseEvent::MouseButtonPress, el.geometry().center(), Qt::MouseButton::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(this->page()->mainFrame(), &pressEvent); QMouseEvent releaseEvent(QMouseEvent::MouseButtonRelease, el.geometry().center(), Qt::MouseButton::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(this->page()->mainFrame(), &releaseEvent); Any ideas? (p.s. I am extending QWebView if it wasn't obvious)

    Read the article

  • Why does Perl's readdir() cache directory entries?

    - by Frank Straetz
    For some reason Perl keeps caching the directory entries I'm trying to read using readdir: opendir(SNIPPETS, $dir_snippets); # or die... while ( my $snippet = readdir(SNIPPETS) ) { print ">>>".$snippet."\n"; } closedir(SNIPPETS); Since my directory contains two files, test.pl and test.man, I'm expecting the following output: . .. test.pl test.man Unfortunately Perl returns a lot of files that have since vanished, for example because I tried to rename them. After I move test.pl to test.yeah Perl will return the following list: . .. test.pl test.yeah test.man What's the reason for this strange behaviour? The documentation for opendir, readdir and closedir doesn't mention some sort of caching mechanism. "ls -l" clearly lists only two files.

    Read the article

  • Warning: Memcache::connect(0memcache.connect0): Can't connect to localhost:11211, Connection refuse

    - by Stick it to THE MAN
    I am using Symfony 1.3.2 with Propel ORM on Ubuntu 9.10. I am incorporating memcache to the website. I have modified the setup() method in apps/frontend/ProjectConfiguration.class.php like this: class ProjectConfiguration { public function setup() { // original SF generated code here .. require_one sfConfig::get('sf_lib_dir').'/MyCache.class.php'; myCache::init(); } } my cache singleton is implemented something like this: class MyCache { private static memcache = null; private static inited = false; public static init() { if (self::$inited) return; self::$memcache = new Memcache(); if (self::$memcache->connect('localhost', 11211) { // Do some stuff .. self::$inited = true; } } } Warning: Memcache::connect(0memcache.connect0): Can't connect to localhost:11211, Connection refused(111) in /path_to_class/MyCache.class.php This happens for both CLI (e.g. running SF tasks) or for web access through the browser. Does anyone know how to resolve this (I suspect its something to do with Linux user privileges). As an aside, I am aware that SF prvoides an sfAPCache wrapper class for cacheing. I am intentionally not using it for two reasons: I cannot find any comprehensive (and up to date) docs on this class I want to learn the memcache API directly, since I will be accesing it from other languages.

    Read the article

  • GCC 4.2 Build error

    - by Mr. Man
    Hi, i am building a C project with Xcode and when ever i build it it gives me this error: ld: duplicate symbol _detectLinux in /Users/markszymanski/Desktop/Programming/C/iTermOS/build/iTermOS.build/Debug/iTermOS.build/Objects-normal/i386/linuxDetect.o and /Users/markszymanski/Desktop/Programming/C/iTermOS/build/iTermOS.build/Debug/iTermOS.build/Objects-normal/i386/iTermOS.o Thanks!

    Read the article

  • Using Propel ORM in my own custom classes

    - by Stick it to THE MAN
    I am refactoring a few classes I wrote a while ago, into my Symfony project (v1.3.2 with Propel ORM). The classes originally used direct connections to the database, I want to refactor those classes (stored in $(SF_LIB_DIR)) so that I can call propel and also use the ORM objects. To clarify, So for example, I want to be able to use code like this in my custom classes: try { $con = Propel::getConnection(); $c = new Criteria(); $foo = new PropelORMFooObject(); $foobar = PropelORMFooBarObjectPeer::fetch($c); //set fields etc $foo->setFooBar($foobar); // now save using obtained connection .. $foo->save($con) }catch(SomeException $e) { //deal with it } I assume that I will need to add some require_once() statements to my custom libraries, but it is not clear which files to include. Does anyone know how to do this?

    Read the article

  • JPA Cascade delete.

    - by Win Man
    Hi, I am new to JPA/Hibernate. Currently using EJB3, Hibernate/JPA. I have an inheritacnce structure as follows.. @Entity @DiscriminatorColumn(name = "form_type") @Inheritance(strategy = InheritanceType.JOINED) @GenericGenerator(name = "FORMS_SEQ", strategy = "sequence-identity", parameters = @Parameter(name = "sequence", value = "FORMS_SEQ")) @Table(name = "Forms") public abstract class Form{ //code for Form } @Entity @Table(name = "CREDIT_CARDS") @PrimaryKeyJoinColumn(name="CREDIT_CARD_ID") public class CreditCardForm extends Form { //Code for CreditCards. } When I add a row with save the rows are properly inserted into the parent and the child table. However when I try to delete I get an error - 10:19:35,465 ERROR [TxPolicy] javax.ejb.EJBTransactionRolledbackException: Removing a detached instance com.data.entities.form.financial.CreditCard#159? I am using a simple for loop to determine the inheritance type - CreditCard or DebitCard and then calling entityManager.remove(entity). What am I doing wrong? Code for delete.. for(Form content: contents){ if(content.getType()==Type.CREDIT_CARD){ creditCardService.delete((CreditCard)content); } Thanks. WM

    Read the article

  • Concat LPSTR in C++

    - by Cat Man Do
    Trying to use as basic C++ as I can to build a list of numbers from 1-52 in a random order (deck of cards). Unfortauntely, all my attempts to concat the strings and get a result end in failure. Any suggestions? NOTE: This is not homework it's something I'm using to create a game. // Locals char result[200] = ""; // Result int card[52]; // Array of cards srand(time(0)); // Initialize seed "randomly" // Build for (int i=0; i<52; i++) { card[i] = i; // fill the array in order } // Shuffle cards for (int i=0; i<(52-1); i++) { int r = i + (rand() % (52-i)); int temp = card[i]; card[i] = card[r]; card[r] = temp; } // Build result for (int c=0; c<52; c++) { // Build sprintf(result, "%d", card[c]); // Comma? if ( c < 51 ) { sprintf(result, "%s", ","); } } My end result is always garbled text. Thanks for the help.

    Read the article

  • Tiered Design With Analytical Widgets - Is This Code Smell?

    - by Repo Man
    The idea I'm playing with right now is having a multi-leveled "tier" system of analytical objects which perform a certain computation on a common object and then create a new set of analytical objects depending on their outcome. The newly created analytical objects will then get their own turn to run and optionally create more analytical objects, and so on and so on. The point being that the child analytical objects will always execute after the objects that created them, which is relatively important. The whole apparatus will be called by a single thread so I'm not concerned with thread safety at the moment. As long as a certain base condition is met, I don't see this being an unstable design but I'm still a little bit queasy about it. Is this some serious code smell or should I go ahead and implement it this way? Is there a better way? Here is a sample implementation: namespace WidgetTier { public class Widget { private string _name; public string Name { get { return _name; } } private TierManager _tm; private static readonly Random random = new Random(); static Widget() { } public Widget(string name, TierManager tm) { _name = name; _tm = tm; } public void DoMyThing() { if (random.Next(1000) > 1) { _tm.Add(); } } } //NOT thread-safe! public class TierManager { private Dictionary<int, List<Widget>> _tiers; private int _tierCount = 0; private int _currentTier = -1; private int _childCount = 0; public TierManager() { _tiers = new Dictionary<int, List<Widget>>(); } public void Add() { if (_currentTier + 1 >= _tierCount) { _tierCount++; _tiers.Add(_currentTier + 1, new List<Widget>()); } _tiers[_currentTier + 1].Add(new Widget(string.Format("({0})", _childCount), this)); _childCount++; } //Dangerous? public void Sweep() { _currentTier = 0; while (_currentTier < _tierCount) //_tierCount will start at 1 but keep increasing because child objects will keep adding more tiers. { foreach (Widget w in _tiers[_currentTier]) { w.DoMyThing(); } _currentTier++; } } public void PrintAll() { for (int t = 0; t < _tierCount; t++) { Console.Write("Tier #{0}: ", t); foreach (Widget w in _tiers[t]) { Console.Write(w.Name + " "); } Console.WriteLine(); } } } class Program { static void Main(string[] args) { TierManager tm = new TierManager(); for (int c = 0; c < 10; c++) { tm.Add(); //create base widgets; } tm.Sweep(); tm.PrintAll(); Console.ReadLine(); } } }

    Read the article

  • Attempt to set foreign key to nonexistent table, sf_guard_user!

    - by Stick it to THE MAN
    I am using SF 1.3.2 with Propel ORM on Ubuntu 9.10. I created a new SF project and simply copied the sfGuard plugin folder from a pre-existing SF 1.32 project. I manually edited the schema.yml in the new project, adding a user table that reference the the sfGuard table. When I run propel:build-sql, I got the task failed, with the error message: Attempt to set foreign key to nonexistent table, sf_guard_user! I'm not sure why this error is occurring, (the error dosent make sense to me, since the sfGuard plugin works fine with the previous project, with no changes made. what am I missing?? BTW, I have not created any apps in the project yet. I am just running the build-sql task first, to make sure that Propel has no problems with parsing my yml files etc.

    Read the article

  • ASP.NET and Session State/Login info

    - by V-Man
    Are Session variables (in ASP.NET) the safest way to store data relating to whether a user is logged in or not? i.e. Session["LoggedIn"] = 'No' I know Session variables can be spoofed so I assume there must be a safer way. Any ideas for ASP.NET? Thanks!

    Read the article

  • Locking on an object...

    - by Mystere Man
    I often see code like that which is shown here, ie where an object is allocated and then used as a "lock object". It seems to me that you could use any object for this, including the event itself as the lock object. Why allocate a new object that does nothing? My understanding is that calling lock() on an object doesn't actually alter the object itself, nor does it actually lock it from being used, it's simply used as a placeholder for multiple lock statements to anchor on. So my question is, is this really a good thing to do?

    Read the article

  • SMS Gateway service provider with PHP API

    - by Stick it to THE MAN
    I am looking for an SMS Gateway service provider with a PHP API that allows me to: Send out SMS messages (including small binaries) to mobile phones Receive SMS messages from mobile phones Send reverse billing SMS text to mobile phone Messages can be sent/received to/from mobiles globally (or at least most countries) Allow bulk sending of text messages Ideally, the API should be relatively straightforward an easy to use. Last but not the least, the service should provide good value for money (i.e. it should be inexpensive or relatively inexpensive for the features it provides). I am (currently) based in the United Kingdom (I dont know if this is relevant in the choise of SMS service provider). I would ideally like a recommendation from someone who is currently using (or has succesfully used) such a service.

    Read the article

  • Copy results of strtok to 2 strings in C

    - by Mr. Man
    Ok, so I have the code char *token; char *delimiter = " "; token = strtok(command, delimiter); strcpy(command, token); token = strtok(NULL, delimiter); strcpy(arguments, token); and it gives me EXC_BAD_ACCESS when i run it, and yes, command and arguments are already defined.

    Read the article

  • Self-referencing tables in Linq2Sql

    - by J-Man
    Hi, I've seen a lot of questions on self-referencing tables in Linq2Sql and how to eagerly load all child records for a particular root object. I've implemented a temporary solution by accessing all underlying properties, but you can see that this doesn't do the performance any good. The thing is though, that all records are correlated with each-other using a correlation GUID. Example below: RootElement - Id: 1 - ParentId: null - CorrelationId: 4D68E512-4B55-44f4-BA5A-174B630A03DD ChildElement1 - Id: 2 - ParentId: 1 - CorrelationId: 4D68E512-4B55-44f4-BA5A-174B630A03DD ChildElement2 - Id: 3 - ParentId: 2 - CorrelationId: 4D68E512-4B55-44f4-BA5A-174B630A03DD ChildElement1 - Id: 4 - ParentId: 2 - CorrelationId: 4D68E512-4B55-44f4-BA5A-174B630A03DD In my case, I do have access to the correlationId, so I can retrieve all of my records by performing the following query: from element in db.Elements where element.CorrelationId == '4D68E512-4B55-44f4-BA5A-174B630A03DD' select element; But, of course, I want these elements associated with each other by executing this query: from element in db.Elements where element.CorrelationId == '4D68E512-4B55-44f4-BA5A-174B630A03DD' && element.ParentId == null select element; My question is: is it possible to combine the results the first query as some sort of 'caching mechanism' for the query where I get the root element? Thanks for the input. J.

    Read the article

  • Get a QWidget to take up the entire QMainWindow

    - by Bad Man
    I have a class that inherits QMainWindow and I just want it to have a webview widget and nothing else, so here's what I tried doing for constructor: MyWindow::MyWindow(QWidget *parent) : QMainWindow(parent) { this->_webView = new QWebView(this); this->setCentralWidget(this->_webView); } This didnt work do I have to use some kind of layout to make this fill?

    Read the article

  • Webservice won't accept JSON requests

    - by V-Man
    Hi, The main issue is that I cannot run a webservice that accepts requests in JSON format. I keep getting a 500 Server error stating that the "request format is invalid." My ASP.NET AJAX extensions are installed. My server is running Plesk Control Panel 8.6 which is undoubtedly causing these problems. The default handler for this specified extension is shown in the web.config like so: For my applications webservice to handle JSON it needs to have this reference: <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> Plesk is not allowing the request to be handled properly. I need to know the correct http directive(s) to put into the web.config to properly handle JSON webservices. I tried posting to the Plesk forum two days ago but no response yet. Any insight would be great =)

    Read the article

  • Sqs vs SqsGen2 using RightScale right_aws GEM

    - by Fitter Man
    I'm trying to use the right_aws (1.10.0) GEM with Rails, and I've reduced my problem to a 3-line irb session. The following works require 'rubygems' require 'right_aws' sqs = RightAws::Sqs.new("xxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") while this fails require 'rubygems' require 'right_aws' sqs = RightAws::SqsGen2.new("xxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") with NameError: uninitialized constant RightAws::SqsGen2. I see the class definition in the GEM source, the documentation is old but seems accurate, but I can't figure out what I'm doing wrong. And while you're at it, is there any reason if I'm building something new, I'd want to use the older interface?

    Read the article

  • GWT Custom Events

    - by Ciarán
    Hey I have a problem getting my head around how custom GWT event Handlers work. I have read quite a bit about the topic and it still is some what foggy. I have read threads here on Stackoverflow like this one http://stackoverflow.com/questions/998621/gwt-custom-event-handler.Could someone explain it in an applied mannar such as the following. I have 2 classes a block and a man class. When the man collides with the block the man fires an event ( onCollision() ) and then the block class listens for that event. Thanks

    Read the article

  • Adding interactions to admin pages generated by the admin generator

    - by Stick it to THE MAN
    I am using Symfony 1.2.9 (with Propel ORM) to create a website. I have started using the admin generator to implement the admin functionality. I have come accross a slight 'problem' however. My models are related (e.g. one table may have several 1:N relations and N:N relations). I have not found a way to address this satisfactorily yet. As a tactical solution (for list views), I have decided to simply show the parent object, and then add interactions to show the related objects. I'll use a Blog model to illustrate this. Here are the relationships for a blog model: N:M relationship with Blogroll (models a blog roll) 1:N relationship with Blogpost (models a post submitted to a blog) I had originally intended on displaying the (paged) blogpost list for a blog,, when it was selected, using AJAX, but I am struggling enough with the admin generator as it is, so I have shelved that idea - unless someone is kind enough to shed some light on how to do this. Instead, what I am now doing (as a tactical/interim soln), is I have added interactions to the list view which allow a user to: View a list of the blog roll for the blog on that row View a list of the posts for the blog on that row Add a post for the blog on tha row In all of the above, I have written actions that will basically forward the request to the approriate action (admin generated). However, I need to pass some parameters (like the blog id etc), so that the correct blog roll or blog post list etc is returned. I am sure there is a better way of doing what I want to do, but in case there isn't here are my questions: How may I obtain the object that relates to a specific row (of the clicked link) in the list view (e.g. the blog object in this example) Once I have the object, I may choose to extract various fields: id etc. How can I pass these arguments to the admin generated action ? Regarding the second question, my guess is that this may be the way to do it (I may be wrong) public function executeMyAddedBlogRollInteractionLink(sfWebRequest $request) { // get the object *somehow* (I'm guessing this may work) $object = $this->getRoute()->getObject(); // retrieve the required parameters from the object, and build a query string $query_str=$object->getId(); //forward the request to the generated code (action to display blogroll list in this case) $this->forward('backendmodulename',"getblogrolllistaction?params=$query_string"); } This feels like a bit of a hack, but I'm not sure how else to go about it. I'm also not to keen on sending params (which may include user_id etc via a GET, even a POST is not that much safer, since it is fairly sraightforward to see what requests a browser is making). if there is a better way than what I suggest above to implement this kind of administration that is required for objects with 1 or more M:N relationships, I will be very glad to hear the "recommended" way of going about it. I remember reading about marking certain actions as internal. i.e. callable from only within the app. I wonder if that would be useful in this instance?

    Read the article

  • Qmake project dependencies (linked libraries)

    - by Stick it to THE MAN
    I have a project that links to a number of shared libraries. Lets say project A depends on projects B and C Ideally, I want to impose the following dependencies in my project file: Rebuild project A if either B or C has been rebuilt since last time project A was built Use the output for the relevant configuration (i.e. if building project A in debug mode, then use the debug versions of the libs for project B and C) Does anyone know how I may explicitly express such dependencies in my project file?

    Read the article

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