Search Results

Search found 1369 results on 55 pages for 'jc martin'.

Page 40/55 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • How does Symfony pass members set in an action to a template?

    - by Martin Chatterton
    How does a member set inside an action... $this->foo = 'bar'; ...become a variable accessible from a template... echo $foo; // bar I would like to know how it is achieved at a framework level. There is a lot of documentation on how to use Symfony, but I've not managed to find much about how it all fits together behind the scenes (class structure/inheritance etc). Thanks in advance for your help!

    Read the article

  • Boost program will not working on Linux

    - by Martin Lauridsen
    Hi SOF, I have this program which uses Boost::Asio for sockets. I pretty much altered some code from the Boost examples. The program compiles and runs just like it should on Windows in VS. However, when I compile the program on Linux and run it, I get a Segmentation fault. I posted the code here The command I use to compile it is this: c++ -I/appl/htopopt/Linux_x86_64/NTL-5.4.2/include -I/appl/htopopt/Linux_x86_64/boost_1_43_0/include mpqs.cpp mpqs_polynomial.cpp mpqs_host.cpp -o mpqs_host -L/appl/htopopt/Linux_x86_64/NTL-5.4.2/lib -lntl -L/appl/htopopt/Linux_x86_64/gmp-4.2.1/lib -lgmp -lm -L/appl/htopopt/Linux_x86_64/boost_1_43_0/lib -lboost_system -lboost_thread -static -lpthread By commenting out code, I have found out that I get the Segmentation fault due to the following line: boost::asio::io_service io_service; Can anyone provide any assistance, as to what may be the problem (and the solution)? Thanks! Edit: I tried changing the program to a minimal example, using no other libraries or headers, just boost/asio.hpp: #define DEBUG 0 #include <boost/asio.hpp> int main(int argc, char* argv[]) { boost::asio::io_service io_service; return 0; } I also removed other library inclusions and linking on compilation, however this minimal example still gives me a segmentation fault.

    Read the article

  • Setting last N bits in an array

    - by Martin
    I'm sure this is fairly simple, however I have a major mental block on it, so I need a little help here! I have an array of 5 integers, the array is already filled with some data. I want to set the last N bits of the array to be random noise. [int][int][int][int][int] set last 40 bits [unchanged][unchanged][unchanged][24 bits of old data followed 8 bits of randomness][all random] This is largely language agnostic, but I'm working in C# so bonus points for answers in C#

    Read the article

  • Finding good heuristic for A* search

    - by Martin
    I'm trying to find the optimal solution for a little puzzle game called Twiddle (an applet with the game can be found here). The game has a 3x3 matrix with the number from 1 to 9. The goal is to bring the numbers in the correct order using the minimum amount of moves. In each move you can rotate a 2x2 square either clockwise or counterclockwise. I.e. if you have this state 6 3 9 8 7 5 1 2 4 and you rotate the upper left 2x2 square clockwise you get 8 6 9 7 3 5 1 2 4 I'm using a A* search to find the optimal solution. My f() is simply the number of rotations need. My heuristic function already leads to the optimal solution but I don't think it's the best one you can find. My current heuristic takes each corner, looks at the number at the corner and calculates the manhatten distance to the position this number will have in the solved state (which gives me the number of rotation needed to bring the number to this postion) and sums all these values. I.e. You take the above example: 6 3 9 8 7 5 1 2 4 and this end state 1 2 3 4 5 6 7 8 9 then the heuristic does the following 6 is currently at index 0 and should by at index 5: 3 rotations needed 9 is currently at index 2 and should by at index 8: 2 rotations needed 1 is currently at index 6 and should by at index 0: 2 rotations needed 4 is currently at index 8 and should by at index 3: 3 rotations needed h = 3 + 2 + 2 + 3 = 10 But there is the problem, that you rotate 4 elements at once. So there a rare cases where you can do two (ore more) of theses estimated rotations in one move. This means theses heuristic overestimates the distance to the solution. My current workaround is, to simply excluded one of the corners from the calculation which solves this problem at least for my test-cases. I've done no research if really solves the problem or if this heuristic still overestimates in same edge-cases. So my question is: What is the best heuristic you can come up with? (Disclaimer: This is for a university project, so this is a bit of homework. But I'm free to use any resource if can come up with, so it's okay to ask you guys. Also I will credit Stackoverflow for helping me ;) )

    Read the article

  • WPF tooltip best practices

    - by Martin
    I'm about to change my application to include tool tips for all buttons, combo boxes, etc. I was wondering if there are any recommendations on doing this. For every control I'd like the tooltip to show the control's name in bold, followed by the description. I want to keep the style separated from the control, so I can change the tooltip style globally. What I would like to have, unless there's a better suggestion, is two additional fields per button/combobox/etc: 1-ToolTipName and 2-ToolTipDesc, both containing a string. How can I accomplish this (and is it even possible?).

    Read the article

  • Retrieve data from database

    - by martin
    I need to use C# to get data from database(sql) and the data in database is updated every few seconds. So do I have to make a loop or there is a better way to do that? Is it possible that when database is updating, the program can wait until it finishes updating? thx!

    Read the article

  • Unnecessary code...

    - by Martin Milan
    Suppose I have some code that looks like this: Private Sub MySub() dim blnFlag as Boolean blnFlag = False for each item in collection if item.Name = "Mike" then blnFound = true exit for endif next item End Sub Now - the blnFLag = False assignment is not actually necessary - booleans are initialised as false, but I think it's inclusion makes the code easier to read. What's your opinion?

    Read the article

  • Qt: QStackedWidget solution

    - by Martin
    I'm building a Qt application that have about 30 different views (QWidgets). My idea is to use a QStackedWidget to make it easy to switch between the different views in the application. I have two different solutions of how to implement this and use as little memory as possible when the user navigates through the application. Solution 1: Everytime I need to show a view I check if it is already in the stack. (The user might open the same view many times, maybe a view showing an item from a database). If the view is in the stack already it doesn't need to be created again and I can just show the view. The good thing with this solution is that I reuse the views (widgets) so they only need to be created once. This is good as the UI and other stuff should look the same everytime the user show a view, so why not reuse it? The problem with this solution is that every view has childrens. Maybe an object, a QList with objects or other things. A good thing with Qt is that you can use the parent-children mechanism so that the children will be deleted when the parent is deleted. As I never delete the parent (view) I need to handle this myself as the children might need to be deleted from different times when the view is shown. (Maybe the view show a list with objects and the list should be updated from a database each time the view is shown.) Solution 2: Everytime I need to show a QWidget I create a new one and show it. When it is not shown anymore, I delete it from memory. This is a quite easy solution. And as I delete the views when they are not shown both the view and it's children should be deleted from memory so it shouldn't increase memory, am I right? Which one of the solutions do you recommend?

    Read the article

  • Will Windows Update modify anything in Visual Studio?

    - by Martin
    (Note: Yes, the technical side of this question seems to be rather SuperUser, but the implications are more relevant for StackOverflow readers.) As the title says, we are wondering if (fully) enabling automated Windows Updates on our developer machines will have implications for MS Visual Studio. That is, will any fixes to any components (be it libraries, UI/IDE, compiler, ...) ever be updated through Windows Update? We want to have 100% exact and reproducible development environments (wrt C++) on all developer machines, and so we are concerned that automated Windows updates may introduce some uncontrolled updates into our development chain.

    Read the article

  • How to write a Web Service for Google App Engine?

    - by Martin
    Hello all, I am simply wondering how to write a Web Service (XML - SOAP) for Google App Engine? I am really new with Python and I have been looking for example for a while, but no chance. Does anybody could point me out any article or simply could give me an example of a Web Service in Python with Google App Engine? Thanks!

    Read the article

  • FACEBOOK LINTER ERROR: value for property 'og:image:url' could not be parsed as type 'url'

    - by Martin Devarda
    I've read all threads in stack overflow about this issue, but my problem persists. THE PROBLEM IS ON THIS PAGE: http://www.organirama.it/minisite-demo/001.html THE PAGE CONTAINS THIS TAGS <meta property="og:title" content="A wonderful page" /> <meta property="og:type" content="video.movie" /> <meta property="og:url" content="http://www.organirama.com/minisite-demo/001.html" /> <meta property="og:image" content="http:/www.organirama.com/minisite-demo/photos-small/001.png" /> <meta property="og:site_name" content="Organirama"/> <meta property="fb:admins" content="1468447924"/> LINTER ERROR Object at URL 'http://www.organirama.com/minisite-demo/001.html' of type 'video.movie' is invalid because the given value 'http:/www.organirama.com/minisite-demo/photos-small/001.png' for property 'og:image:url' could not be parsed as type 'url'. WHAT I DISCOVERED The problem seems somehow related to the domain. Infact, if I make og:image point to another image on another domain, everything works.

    Read the article

  • C++ Boolean problem (comparison between two arrays)

    - by Martin
    Hello! I have a problem to do. I already did some part of it, however I stuck and don't know exactly what to do next. The question: " You are given two arrays of ints, named A and B. One contains AMAXELEMENTS and the other contains BMAXELEMENTS. Write a Boolean-valued function that returns true if there is at least one point in A that is the same as a point in B, and false if there is no match between two arrays. " The two arrays are made up by me, I think if I know how to compare two arrays I will be fine, and I will be able to finish my problem. This is what I have so far (I changed AMAXELEMENTS to AMAX, and BMAXELEMENTS to BMAX): #include <iostream> using namespace std; int main(){ const int AMAX=5, BMAX=6; int i; bool c1=true,c2=false; int A[AMAX]={2,4,1,5,9}; int B[BMAX]={9,12,32,43,23,11}; for(i=0;i<BMAX;i++) if (B[i]==A[i]) // <---- I think this part has to look different, but I can't figure it out. cout<<c1<<endl; else cout<< c2<<endl; return 0; }

    Read the article

  • How can I prevent a field from being copied to the client proxy in WCF RIA?

    - by Martin Doms
    Is there a metadata attribute I can use to prevent a field from being accessible on the client in a WCF RIA services? I sure I have seen this before, but I'm drawing a blank and Google isn't helping. It would look something like [MetadataType(typeof(User.UserMetadata))] public partial class User { internal sealed class UserMetadata { private UserMetadata() { } public int Id { get; set; } [HideFromClientProxy] public string PasswordSalt { get; set; } } }

    Read the article

  • Will First() perform the OrderBy()?

    - by Martin
    Is there any difference in (asymptotic) performance between Orders.OrderBy(order => order.Date).First() and Orders.Where(order => order.Date == Orders.Max(x => x.Date)); i.e. will First() perform the OrderBy()? I'm guessing no. MSDN says enumerating the collection via foreach och GetEnumerator does but the phrasing does not exclude other extensions.

    Read the article

  • Do I need to syncronize thread access to an int

    - by Martin Harris
    I've just written a method that is called by multiple threads simultaneously and I need to keep track of when all the threads have completed, the code uses this pattern: private void RunReport() { _reportsRunning++; try { //code to run the report } finally { _reportsRunning--; } } This is the only place within the code that _reportsRunning's value is changed, and the method takes about a second to run. Occasionally when I have more than six or so threads running reports together the final result for _reportsRunning can get down to -1, if I wrap the calls to _runningReports++ and _runningReports-- in a lock then the behaviour appears to be correct and consistant. So, to the question: When I was learning multithreading in C++ I was taught that you didn't need to synchronize calls to increment and decrement operations because they were always one assembly instruction and therefore it was impossible for the thread to be switched out mid-call. Was I taught correctly, and if so how come that doesn't hold true for C#?

    Read the article

  • WCF consumed as WebService adds a boolean parameter?

    - by Martín Marconcini
    I've created the default WCF Service in VS2008. It's called "Service1" public class Service1 : IService1 { public string GetData( int value ) { return string.Format("You entered: {0}", value); } public CompositeType GetDataUsingDataContract( CompositeType composite ) { if ( composite.BoolValue ) { composite.StringValue += "Suffix"; } return composite; } } It works fine, the interface is IService1: [ServiceContract] public interface IService1 { [OperationContract] string GetData( int value ); [OperationContract] CompositeType GetDataUsingDataContract( CompositeType composite ); // TODO: Add your service operations here } This is all by default; Visual Studio 2008 created all this. I then created a simple Winforms app to "test" this. I added the Service Reference to my the above mentioned service and it all works. I can instanciate and call myservice1.GetData(100); and I get the result. But I was told that this service will have to be consumed by a Winforms .NET 2.0 app via Web Services, so I proceeded to add the reference to a new Winforms .NET 2.0 application created from scratch (only one winform called form1). This time, when adding the "web reference", it added the typical "localhost" one belonging to webservices; the wizard saw the WCF Service (running on background) and added it. When I tried to consume this, I found out that the GetData(int) method, was now GetData(int, bool). Here's the code private void button1_Click( object sender, EventArgs e ) { localhost.Service1 s1 = new WindowsFormsApplication2.localhost.Service1(); Console.WriteLine(s1.GetData(100, false)); } Notice the false in the GetData call? I don't know what that parameter is or where did that come from, it is called "bool valueSpecified". Does anybody know where this is coming from? Anything else I should do to consume a WCF Service as a WebService from .NET 2.0? (winforms).

    Read the article

  • Compiling my Boost/NTL program with c++ on Linux.

    - by Martin Lauridsen
    Hi SO, I wrote a client program and a server program, that uses the NTL library and Boost::Asio, to do client/server communication for an integer factorization application, in C++. Both sides consist of several headers and cpp files. Both project compile fine individually on Windows in Visual Studio. All I did, was add the include path of NTL and Boost to both projects: Additional include paths: "D:\Downloads\WinNTL-5_5_2\include";D:\boost_1_42_0 Furthermore, for both projects, I added the two library paths to both projects in VS: Additional library directories: D:\boost_1_42_0\stage\lib;"D:\Documents\Visual Studio 2008\Projects\ntl\Debug" And added under Additional dependencies: ntl.lib As said, it compiles fine on Windows. But when I put the code on a Linux machine provided by university, I try to compile with the following statement c++ -I/appl/htopopt/Linux_x86_64/NTL-5.4.2/include -I/appl/htopopt/Linux_x86_64/boost_1_43_0/include client_protocol.cpp mpqs_client.cpp mpqs_sieve.cpp mpqs_helper.cpp -o mpqs_helper -L/appl/htopopt/Linux_x86_64/NTL-5.4.2/lib -lntl -L/appl/htopopt/Linux_x86_64/gmp-4.2.1/lib -lgmp -lm -L/appl/htopopt/Linux_x86_64/boost_1_43_0/lib -lboost_system -static Upon doing this, I get a huuuge error, which I posted here. Any idea how to fix this, please??

    Read the article

  • Refactoring Rails 3 Routes

    - by Martin
    Hello, I have this in my routes: get '/boutique/new' => 'stores#new', :as => :new_store, :constraints => { :id => /[a-z0-9_-]/ } post '/boutique' => 'stores#create', :as => :create_store, :constraints => { :id => /[a-z0-9_-]/ } get '/:shortname' => 'stores#show', :as => :store, :constraints => { :id => /[a-z0-9_-]/ } get '/:shortname/edit' => 'stores#edit', :as => :edit_store, :constraints => { :id => /[a-z0-9_-]/ } put '/:shortname' => 'stores#update', :as => :update_store, :constraints => { :id => /[a-z0-9_-]/ } delete '/:shortname' => 'stores#delete', :as => :destroy_store, :constraints => { :id => /[a-z0-9_-]/ } Is there a cleaner way to do the same? It doesn't look any elegant and even less if I add some more controls/actions to it. Thank you.

    Read the article

  • Seperating two graphs based on connectivity and coordinates

    - by martin
    I would like to separate existing data of vertices and edges into two or more graphs that are not connected. I would like to give the following as example: Imagine two hexagons on top of each other but are lying in different Z. Hexagon 1 has the following vertices A(0,0,1), B(1,0,2), C(2,1,2), D(1,2,1), E(0,2,1), F(-1,2,1). The connectivity is as following: A-B, B-C, C-D, D-E, E-F, F-A. This part of Graph 1 as all the vertices are connected in this layer. Hexagon2 has the following vertices A1(0,0,6), B1(1,0,7), C1(2,1,7), D1(1,2,8), E1(0,2,7), F1(-1,2,6). The connectivity is as following: A1-B1, B1-C1, C1-D1, D1-E1, E1-F1, F1-A1. This is part of Graph 2 My data is in the following form: list of Vertices and list of Edges that i can form graphs with. I would like to eliminate graph 2 and give only vertices and connectivity of graph 1 to polygon determination part of my algorithm. My real data contains around 1000 connected polygons as graph 1 and around 100 (much larger in area) polygons as graph 2. I would like to eliminate graph 2. I am programming this in python. Thanks in advance.

    Read the article

  • How to extract messages to translate from a Play! application

    - by Martin
    I'm writing my first application using the Play! framework and I was wondering if there was a tool that could extract the messages that need translation from my views and controllers for me ? It is rather cumbersome to fill the conf/messages(.xx) file while I'm developing my app, but I'm afraid that if I don't do it as I go, I will never be able to completely translate my application afterwards. Such tools exist with other framework such as CakePHP for instance, and I think that it shouldn't be hard to write one by myself, but if there already is one... I was also wondering, what should I name the keys of the messages in my application ? Using gettext, it's not bad practice to directly type in the message in english as the key, but is it with the system that Play! uses (MessageFormat, right ?) ? Does anyone have an advice or naming convention (something like controller.action.describe_the_message maybe) ? Thank you for your advices !

    Read the article

  • Is a safe accumulator really this complicated?

    - by Martin
    I'm trying to write an accumulator that is well behaved given unconstrained inputs. This seems to not be trivial and requires some pretty strict planning. Is it really this hard? int naive_accumulator(unsigned int max, unsigned int *accumulator, unsigned int amount) { if(*accumulator + amount >= max) return 1; // could overflow *accumulator += max; // could overflow return 0; } int safe_accumulator(unsigned int max, unsigned int *accumulator, unsigned int amount) { // if amount >= max, then certainly *accumulator + amount >= max if(amount >= max) { return 1; } // based on the comparison above, max - amount is defined // but *accumulator + amount might not be if(*accumulator >= max - amount) { return 1; } // based on the comparison above, *accumulator + amount is defined // and *accumulator + amount < max *accumulator += amount; return 0; }

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >