Search Results

Search found 4677 results on 188 pages for 'alternative'.

Page 164/188 | < Previous Page | 160 161 162 163 164 165 166 167 168 169 170 171  | Next Page >

  • Java - A better to run code for a period of time

    - by mhollander38
    I need to run some code for a predefined length of time, when the time is up it needs to stop. Currently I am using a TimerTask to allow the code to execute for a set amount of time but this is causing endless threads to be created by the code and is just simply not efficient. Is there a better alternative? Current code; // Calculate the new lines to draw Timer timer3 = new Timer(); timer3.schedule(new TimerTask(){ public void run(){ ArrayList<String> Coords = new ArrayList<String>(); int x = Float.valueOf(lastFour[0]).intValue(); int y = Float.valueOf(lastFour[1]).intValue(); int x1 = Float.valueOf(lastFour[2]).intValue(); int y1 = Float.valueOf(lastFour[3]).intValue(); //Could be the wrong way round (x1,y1,x,y)? Coords = CoordFiller.coordFillCalc(x, y, x1, y1); String newCoOrds = ""; for (int j = 0; j < Coords.size(); j++) { newCoOrds += Coords.get(j) + " "; } newCoOrds.trim(); ClientStorage.storeAmmendedMotion(newCoOrds); } } ,time);

    Read the article

  • How can I remove all users in an Active Directory group?

    - by Beavis
    I'm trying to remove all users from an AD group with the following code: private void RemoveStudents() { foreach (DirectoryEntry childDir in rootRefreshDir.Children) { DirectoryEntry groupDE = new DirectoryEntry(childDir.Path); for (int counter = 0; counter < groupDE.Properties["member"].Count; counter++) { groupDE.Properties["member"].Remove(groupDE.Properties["member"][counter]); groupDE.CommitChanges(); groupDE.Close(); } } } The rootRefreshDir is the directory that contains all the AD groups (childDir). What I'm finding here is that this code does not behave correctly. It removes users, but it doesn't do it after the first run. It does "some". Then I run it again, and again, and again - depending on how many users need to be deleted in a group. I'm not sure why it's functioning this way. Can someone help fix this code or provide an alternative method to delete all users in a group? Thanks!

    Read the article

  • Composable FLinq expressions

    - by Daniel
    When doing linq-to-sql in c#, you could do something like this: var data = context.MyTable.Where(x => x.Parameter > 10); var q1 = data.Take(10); var q2 = data.Take(3); q1.ToArray(); q2.ToArray(); This would generate 2 separate SQL queries, one with TOP 10, and the other with TOP 3. In playing around with Flinq, I see that: let data = query <@ seq { for i in context.MyTable do if x.Parameter > 10 then yield i } @> data |> Seq.take 10 |> Seq.toList data |> Seq.take 3 |> Seq.toList is not doing the same thing. Here it seems to do one full query, and then do the "take" calls on the client side. An alternative that I see used is: let q1 = query <@ for i in context.MyTable do if x.Param > 10 then yield i } |> Seq.take 10 @> let q2 = query <@ for i in context.MyTable do if x.Param > 10 then yield i } |> Seq.take 3 @> These 2 generate the SQL with the appropriate TOP N filter. My problem with this is that it doesn't seem composable. I'm basically having to duplicate the "where" clause, and potentially would have to duplicate other other subqueries that I might want to run on a base query. Is there a way to have F# give me something more composable? (I originally posted this question to hubfs, where I have gotten a few answers, dealing with the fact that C# performs the query transformation "at the end", i.e. when the data is needed, where F# is doing that transformation eagerly.)

    Read the article

  • What rules govern the copying of variables in Javascript closures?

    - by int3
    I'd just like to check my understanding of variable copying in Javascript. From what I gather, variables are passed/assigned by reference unless you explicitly tell them to create a copy with the new operator. But I'm a little uncertain when it comes to using closures. Say I have the following code: var myArray = [1, 5, 10, 15, 20]; var fnlist = []; for (var i in myArray) { var data = myArray[i]; fnlist.push(function() { var x = data; console.log(x); }); } fnlist[2](); // returns 20 I gather that this is because fnlist[2] only looks up the value of data at the point where it is invoked. So I tried an alternative tack: var myArray = [1, 5, 10, 15, 20]; var fnlist = []; for (var i in myArray) { var data = myArray[i]; fnlist.push(function() { var x = data; return function() { console.log(x); } }()); } fnlist[2](); // returns 10 So now it returns the 'correct' value. Am I right to say that it works because a function resolves all variable references to their 'constant' values when it is invoked? Or is there a better way to explain it? Any explanations / links to explanations regarding this referencing / copying business would be appreciated as well. Thanks!

    Read the article

  • Rails - Update a single attribute : link with custom action or form with hidden fields?

    - by MrRuru
    Let's say I have a User model, with a facebook_uid field corresponding to the user's facebook id. I want to allow the user to unlink his facebook account. Do do so, I need to set this attribute to nil. I currently see 2 ways of doing this First way : create a custom action and link to it # app/controllers/users_controller.rb def unlink_facebook_account @user = User.find params[:id] # Authorization checks go here @user.facebook_uid = nil @user.save # Redirection go here end # config/routes.rb ressources :users do get 'unlink_fb', :on => :member, :as => unlink_fb end # in a view = link_to "Unlink your facebook account", unlink_fb_path(@user) Second way : create a form to the existing update action # app/views/user/_unlink_fb_form.html.haml = form_for @user, :method => "post" do |f| = f.hidden_field :facebook_uid, :value => nil = f.submit "Unlink Facebook account" I'm not a big fan of either way. In the first one, I have to add a new action for something that the update controller already can do. In the second one, I cannot set the facebook_uid to nil without customizing the update action, and I cannot have a link instead of a button without adding some javascript. Still, what would you recommend as the best and most elegant solution for this context? Did I miss a third alternative?

    Read the article

  • Vectors or Java arrays for Tetris?

    - by StackedCrooked
    I'm trying to create a Tetris-like game with Clojure and I'm having some trouble deciding the data structure for the playing field. I want to define the playing field as a mutable grid. The individual blocks are also grids, but don't need to be mutable. My first attempt was to define a grid as a vector of vectors. For example an S-block looks like this: :s-block { :grids [ [ [ 0 1 1 ] [ 1 1 0 ] ] [ [ 1 0 ] [ 1 1 ] [ 0 1 ] ] ] } But that turns out to be rather tricky for simple things like iterating and painting (see the code below). For making the grid mutable my initial idea was to make each row a reference. But then I couldn't really figure out how to change the value of a specific cell in a row. One option would have been to create each individual cell a ref instead of each row. But that feels like an unclean approach. I'm considering using Java arrays now. Clojure's aget and aset functions will probably turn out to be much simpler. However before digging myself in a deeper mess I want to ask ideas/insights. How would you recommend implementing a mutable 2d grid? Feel free to share alternative approaches as well. Source code current state: Tetris.clj (rev452)

    Read the article

  • Generic file container for quick read of data

    - by DreamCodeR
    Since there are some major privacy issues with alot of social networking sites I am trying to think about alternatives. One is to let the user keep all the information stored in some kind of file container. Now, I haven't found a single type of container that can hold "generic" information. Only for audio/video. What I want is a container that can be read by PHP with some kind of index file that lists up the users pictures in a image/ directory in the container, FOAF files (or some alternative XML-file describing users information and friends, etc.). My thoughts was to let the user keep all their information and data stored in a container that can be imported/exported and deleted from my server (the prototype social networking site I am trying to create), and then uploaded to another site that might use the same format (not that I think that will ever happen, but the user still keeps all their pictures, data, comments, messages, etc). The only thing I have come up with yet is to create a tar archive with the Archive_tar library which extracts and creates Tar-archives with an index-file describing which files are holding the messages (there might be several so each file won't be so large), what pictures are in the image/ folder and what are their names and what comments they have gotten etc. Maybe also the permissions for viewing each type of content. Does there exist any generic file format of a container that I can use to keep all this information in one file with a tree-like index file? Or must i try and create something like this myself?

    Read the article

  • How do I show all group headers in Access 2007 reports?

    - by Newbie
    This is a question about Reports in Access 2007. I'm unsure whether the solution will involve any programming, but hopefully someone will be able to help me. I have a report which lists all records from a particular table (call it A), and groups them by their associated record in a related table (call it B). I use the 'group headers' to add the information from table-B into the report. The problem occurs when I filter the records from table-A that are shown in the report. If I filter out all table-A records that relate to a particular record (call it X) in table-B, the report no longer shows the record-X group header. As a possible workaround, I have tried to ensure that I have one empty record in table-A for each of the records in table-B. That way I can specify NOT to filter out these empty records. However, the outcome is ugly one-record-high blank spaces at the start of each group in the report. Does anyone know of an alternative solution?

    Read the article

  • Separating code logic from the actual data structures. Best practices?

    - by Patrick
    I have an application that loads lots of data into memory (this is because it needs to perform some mathematical simulation on big data sets). This data comes from several database tables, that all refer to each other. The consistency rules on the data are rather complex, and looking up all the relevant data requires quite some hashes and other additional data structures on the data. Problem is that this data may also be changed interactively by the user in a dialog. When the user presses the OK button, I want to perform all the checks to see that he didn't introduce inconsistencies in the data. In practice all the data needs to be checked at once, so I cannot update my data set incrementally and perform the checks one by one. However, all the checking code work on the actual data set loaded in memory, and use the hashing and other data structures. This means I have to do the following: Take the user's changes from the dialog Apply them to the big data set Perform the checks on the big data set Undo all the changes if the checks fail I don't like this solution since other threads are also continuously using the data set, and I don't want to halt them while performing the checks. Also, the undo means that the old situation needs to be put aside, which is also not possible. An alternative is to separate the checking code from the data set (and let it work on explicitly given data, e.g. coming from the dialog) but this means that the checking code cannot use hashing and other additional data structures, because they only work on the big data set, making the checks much slower. What is a good practice to check user's changes on complex data before applying them to the 'application's' data set?

    Read the article

  • What are the potential problems with exposing the Facebook API secret?

    - by genehack
    I'm writing a little web utility that posts status updates to Twitter and/or Facebook. That involved creating 'applications' with both those services in order to get API keys and 'secrets'. My question is how protected I really need to keep those secrets -- in order for this to work at all, you seem to need the secret to interact with the authentication part of the service to grant the app access to your account and/or grant it permission to post updates on your behalf. Facebook's documentation says to protect the secret, but at least one other Facebook utility distributes the API key and secret in the source. It's important to note: this isn't your standard Facebook 'application' that runs within the context of Facebook, nor is it a standard "desktop"-style compiled app -- it's a web-based application intended to be run on your own web server. The audience for this is probably small and somewhat more sophisticated than average -- so, one technical alternative would be to require people to obtain their own API key and secret to use the app. That seems like a lot of work, however, and a fairly large barrier to entry to anybody using this. Anybody know or have any insight on what sort of trouble I'm letting myself in for if I put both the secrets and the API keys in the config for my app and check it into Github for all the world to see?

    Read the article

  • The most efficient way to calculate an integral in a dataset range

    - by Annalisa
    I have an array of 10 rows by 20 columns. Each columns corresponds to a data set that cannot be fitted with any sort of continuous mathematical function (it's a series of numbers derived experimentally). I would like to calculate the integral of each column between row 4 and row 8, then store the obtained result in a new array (20 rows x 1 column). I have tried using different scipy.integrate modules (e.g. quad, trpz,...). The problem is that, from what I understand, scipy.integrate must be applied to functions, and I am not sure how to convert each column of my initial array into a function. As an alternative, I thought of calculating the average of each column between row 4 and row 8, then multiply this number by 4 (i.e. 8-4=4, the x-interval) and then store this into my final 20x1 array. The problem is...ehm...that I don't know how to calculate the average over a given range. The question I am asking are: Which method is more efficient/straightforward? Can integrals be calculated over a data set like the one that I have described? How do I calculate the average over a range of rows?

    Read the article

  • C++: getting the address of the start of an std::vector ?

    - by shoosh
    Sometimes it is useful to use the starting address of an std::vector and temporarily treat that address as the address of a regularly allocated buffer. For instance replace this: char* buf = new char[size]; fillTheBuffer(buf, size); useTheBuffer(buf, size); delete[] buf; With This: vector<char> buf(size); fillTheBuffer(&buf[0], size); useTheBuffer(&buf[0], size); The advantage of this is of course that the buffer is deallocated automatically and I don't have to worry about the delete[]. The problem I'm having with this is when size == 0. In that case the first version works ok. An empty buffer is "allocated" and the subsequent functions do nothing size they get size == 0. The second version however fails if size == 0 since calling buf[0] may rightly contain an assertion that 0 < size. So is there an alternative to the idiom &buf[0] that returns the address of the start of the vector even if the vector is empty? I've also considered using buf.begin() but according to the standard it isn't even guaranteed to return a pointer.

    Read the article

  • Looking for an email/report templating engine with database backend - for end-users ...

    - by RizwanK
    We have a number of customers that we have to send monthly invoices too. Right now, I'm managing a codebase that does SQL queries against our customer database and billing database and places that data into emails - and sends it. I grow weary of maintaining this every time we want to include a new promotion or change our customer service phone numbers. So, I'm looking for a replacement to move more of this into the hands of those requesting the changes. In my ideal world, I need : A WYSIWYG (man, does anyone even say that anymore?) email editor that generates templates based upon the output from a Database Query. The ability to drag and drop various fields from the database query into the email template. Display of sample email results with the database query. Web application, preferably not requiring IIS. Involve as little code as possible for the end-user, but allow basic functionality (i.e. arrays/for loops) Either comes with it's own email delivery engine, or writes output in a way that I can easily write a Python script to deliver the email. Support for generic Database Connectors. (I need MSSQL and MySQL) F/OSS So ... can anyone suggest a project like this, or some tools that'd be useful for rolling my own? (My current alternative idea is using something like ERB or Tenjin, having them write the code, but not having live-preview for the editor would suck...)

    Read the article

  • Generic factory of generic containers

    - by Feuermurmel
    I have a generic abstract class Factory<T> with a method createBoxedInstance() which returns instances of T created by implementations of createInstance() wrapped in the generic container Box<T>. abstract class Factory<T> { abstract T createInstance(); public final Box<T> createBoxedInstance() { return new Box<T>(createInstance()); } public final class Box<T> { public final T content; public Box(T content) { this.content = content; } } } At some points I need a container of type Box<S> where S is an ancestor of T. Is it possible to make createBoxedInstance() itself generic so that it will return instances of Box<S> where S is chosen by the caller? Sadly, defining the function as follows does not work as a type parameter cannot be declared using the super keyword, only used. public final <S super T> Box<S> createBoxedInstance() { return new Box<S>(createInstance()); } The only alternative I see, is to make all places that need an instance of Box<S> accept Box<? extends S> which makes the container's content member assignable to S. Is there some way around this without re-boxing the instances of T into containers of type Box<S>? (I know I could just cast the Box<T> to a Box<S> but I would feel very, very guilty.)

    Read the article

  • Static variable definition order in c++

    - by rafeeq
    Hi i have a class tools which has static variable std::vector m_tools. Can i insert the values into the static variable from Global scope of other classes defined in other files. Example: tools.h File class Tools { public: static std::vector<std::vector> m_tools; void print() { for(int i=0 i< m_tools.size() ; i++) std::cout<<"Tools initialized :"<< m_tools[i]; } } tools.cpp File std::vector<std::vector> Tools::m_tools; //Definition Using register class constructor for inserting the new string into static variable. class Register { public: Register(std::string str) { Tools::m_tools.pushback(str); } }; Different class which inserts the string to static variable in static variable first_tool.cpp //Global scope declare global register variable Register a("first_tool"); //////// second_tool.cpp //Global scope declare global register variable Register a("second_tool"); Main.cpp void main() { Tools abc; abc.print(); } Will this work? In the above example on only one string is getting inserted in to the static list. Problem look like "in Global scope it tries to insert the element before the definition is done" Please let me know is there any way to set the static definiton priority? Or is there any alternative way of doing the same.

    Read the article

  • How can I get a default value in some instances but not others?

    - by Connor Wagner
    I am making an iPhone app and want to use an 'if' statement and a boolean to set default values in some instances but not others... is this possible? Are there alternative options if it is not possible? In the MainViewController.m I have: @interface MainViewController (){ BOOL moveOver; } [...] - (void)viewDidLoad { [super viewDidLoad]; _label.text = [NSString stringWithFormat:@"%i", computerSpeed]; } } [...] - (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller { [self dismissViewControllerAnimated:YES completion:nil]; moveOver = true; } The problem that it is redefined when the ViewDidLoad runs... I need a statement that will not redefine when the ViewDidLoad runs. I have something that I feel like is much closer to working... In the ViewDidLoad I have: if (playToInt != 10 || computerMoveSpeed != 3) { moveOver = TRUE; } which connects to my created method, gameLoop. It has if (moveOver == false) { computerMoveSpeed = 3; playToInt = 10; } I have tried putting the code in the gameLoop into the ViewDidLoad, but it had the same effect. When moveOver was false, the computerMoveSpeed and the playToInt were both seemingly 0. I have two UITextFields and typed 10 and 3 in them... does this not set it to the default? It seems to set the default to 0 for both, how do I change this? THIS IS A DIFFERENT ISSUE THAN THE THREE BOOLEAN VALUES QUESTION

    Read the article

  • Is it possible to get a truly unique id for a particular JVM instance?

    - by Uri
    I need a way to uniquely and permanently identify an instance of the JVM from within Java code running in that JVM. That is, if I have two JVMs running at the same time on the same machine, each is distinguishable. It is also distinguishable from running JVMs on other machines and from future executions on the same machine even if the process id is reused. I figure I could implement something like this by identifying the start time, the machine MAC, and the process id, and combining them in some way. I'm wondering if there is some standard way to achieve this. Update: I see that everyone recommended a UUID for the entire session. That seems like a good idea though possibly a little too heavyweight. Here is my problem though: I want to use the JVM id to create multiple unique identifiers in each JVM execution that somehow incorporate the JVM instance. My understanding is that you shouldn't really mix other numbers into a UUID because uniqueness is no longer guaranteed. An alternative is to make the UUID into a string and chain it, but then it becomes too long. Any ideas on overcoming this?

    Read the article

  • Hibernate OneToMany and ManyToOne confusion! Null List!

    - by squizz
    I have two tables... For example - Company and Employee (let's keep this real simple) Company( id, name ); Employee( id, company_id ); Employee.company_id is a foreign key. My entity model looks like this... Employee @ManyToOne(cascade = CascadeType.PERSIST) @JoinColumn(name = "company_id") Company company; Company @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "company_id") List<Employee> employeeList = new ArrayList<Employee>(); So, yeah I want a list of employees for a company. When I do the following... Employee e = new Employee(); e.setCompany(c); //c is an Company that is already in the database. DAO.insertEmployee(e); //this works fine! If I then get my Company object it's list is empty! Ive tried endless different ways from the Hibernate documentation! Obviously not tried the correct one yet! I just want the list to be populated for me or find out a sensible alternative. Help would be greatly appreciated, thanks!

    Read the article

  • Creating 3rd party library in Android. Need suggestions!!

    - by Lalith
    Hello all, I am planning to create a 3rd party library for android application developers. Also the main concern is I do not want the users to make many changes to their code base. The following are the main things I want to clarify before diving into the project. 1) I want to attach my own event handlers dynamically to the application. As per above limitations I mentioned, I cannot make users put the relevant code in their handlers as I need to support existing applications as well. I found out that we cannot attach more than one event handler per one listener. For example Button.setOnclickListener(somelistener) .. will set one listener. In traditional desktop applications we can add more than one handlers but here if I do one more Button.setOnclickListener(someOtherListener) this one overwrites the previous listener. Is there any way I can attach my own listener along with application's existing listeners dynamically? Also is it really not supported on android yet? 2) Is there any 3rd party alternative that exists already that monitors user's interactions in androidi? 3) If this is not supported now are there any future plans to support this feature? Please let me know about this as I did not get much feedback on Stackoverflow. Any suggestions and workarounds would really help me continue with this project. Regards, Lalith

    Read the article

  • Is re-throwing an exception legal in a nested 'try'?

    - by Alexander Gessler
    Is the following well-defined in C++, or not? I am forced to 'convert' exceptions to return codes (the API in question is used by many C users, so I need to make sure all C++ exceptions are caught & handled before control is returned to the caller). enum ErrorCode {…}; ErrorCode dispatcher() { try { throw; } catch (std::bad_alloc&) { return ErrorCode_OutOfMemory; } catch (std::logic_error&) { return ErrorCode_LogicError; } catch (myownstdexcderivedclass&) { return ErrorCode_42; } catch(...) { return ErrorCode_UnknownWeWillAllDie; } } ErrorCode apifunc() { try { // foo() might throw anything foo(); } catch(...) { // dispatcher rethrows the exception and does fine-grained handling return dispatcher(); } return ErrorCode_Fine; } ErrorCode apifunc2() { try { // bar() might throw anything bar(); } catch(...) { return dispatcher(); } return ErrorCode_Fine; } I hope the sample shows my intention. My guess is that this is undefined behaviour, but I'm not sure. Please provide quotes from the standard, if applicable. Alternative approaches are appreciated as well. Thanks!

    Read the article

  • highlighting data values in a sql result set

    - by potatoe
    I can think of a number of ways to do this in PHP or even JavaScript, but I'm wondering if there's a SQL-based technique I'm overlooking. I have a database table, let's say 20 fields X 10 rows. I want to display the entire table on an web page, so I'd do something like SELCT * FROM data_table;, and then format the result set using HTML table tags. However, I'd also like to highlight values in the table based on whether they are the maximum or minimum value in their column. For example, I'd add bold tags around the max in each column. A resulting table might look something like this, with bold tags shown: id | field1 | field2 | field3 | ... 0 | 5 | 2 | <b>7</b> | ... 1 | 3 | <b>8</b> | 6 | ... 2 | <b>9</b> | 5 | 1 | ... ... I could do a separate SELECT with an ORDER BY for each field and then interpret the results, but that seems like a lot of extra DB access. My alternative right now is to just fetch the whole table, and then sort/search for the highlight values using PHP. Is there a better way?

    Read the article

  • More efficient way to update multiple elements in javascript and/or jquery?

    - by Seiverence
    Say I have 6 divs with ID "#first", ""#second" ... "#sixth". Say if I wanted to execute functions on each of those divs, I would set up an array that contains each of the names of the divs I want to update as an element in the array of strings. ["first", "second", "third"] that I want to update. If I wanted to apply I function, I set up a for loop that iterates through each element in the array and say if I wanted to change the background color to red: function updateAllDivsInTheList() { for(var i = 0; i < array.size; i++) $("#"+array[i]).changeCssFunction(); } } Whenever I create a new div, i would add it to the array. The issue is, if I have a large number of divs that need to get updated, say if I wanted to update 1000 out of 1200 divs, it may be a pain/performance tank to have to sequentially iterate through every single element in the array. Is there some alternative more efficient way of updating multiple divs without having to sequentially iterate through every element in an array, maybe with some other more efficient data structure besides array? Or is what I am doing the most efficient way to do it? If can provide some example, that would be great.

    Read the article

  • Mock implementations in C++

    - by forneo
    Hi guys, I need a mock implementation of a class - for testing purposes - and I'm wondering how I should best go about doing that. I can think of two general ways: Create an interface that contains all public functions of the class as pure virtual functions, then create a mock class by deriving from it. Mark all functions (well, at least all that are to be mocked) as virtual. I'm used to doing it the first way in Java, and it's quite common too (probably since they have a dedicated interface type). But I've hardly ever seen such interface-heavy designs in C++, thus I'm wondering. The second way will probably work, but I can't help but think of it as kind of ugly. Is anybody doing that? If I follow the first way, I need some naming assistance. I have an audio system that is responsible for loading sound files and playing the loaded tracks. I'm using OpenAL for that, thus I've called the interface "Audio" and the implementation "OpenALAudio". However, this implies that all OpenAL-specific code has to go into that class, which feels kind of limiting. An alternative would be to leave the class' name "Audio" and find a different one for the interface, e.g. "AudioInterface" or "IAudio". Which would you suggest, and why?

    Read the article

  • new project app; use entirely node.js

    - by Jared
    I have been looking into Node.js, express and Nowjs and love how easy it is to have real time interactions between clients. My background is mostly from CodeIgniter MVC using PHP and MYSql. I want to re make a current web project of mine from scratch to make everything better and more real time with this newer technology. After researching and doing test examples I want to use node.js , express and Nowjs for the real time interactions once someone connects to the socket.io to pull data back to clients. But use Code Igniter for the control of the site and user management , possible shopping cart/store , pretty much everything else. This is purely due to time constraints and that I am already familiar with doing it that way. I have been looking at MongoDB as an alternative to MySql, Basically the app is going to be multiple chat rooms all on one page. with the ability of notifications and private messaging. Lots of data transfer and images. before I started piecing it together I wanted to get people who have already done something similar. My model would use Code Igniter and MySQL to render the page and then connect them onto a node.js server and broadcast using express and nowjs would using a mongoDB be better than mySQL for tons of messages and data being stored or MYSQL? Also does it make since to not make the whole site on Node.js , kinda piece it together like that?

    Read the article

  • Conditional fieldgroups/fieldsets in Drupal 7

    - by seane
    Background: In Drupal 7, I have created a form with CCK (aka the Field UI). I used the Field group module to create a fieldgroup, but I need it to be conditional, meaning it will only display depending on a previous answer. Previous research: To create a conditional field, you can use hook_form_alter() to edit the #states attribute like so: function MYMODULE_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'person_info_node_form') { // Display 'field_maiden_name' only if married $form['field_maiden_name']['#states'] = array( 'visible' => array( ':input[name="field_married[und]"]' => array('value' => 'Yes'), ), ); } } However, there seems to be no way to use the States API for fieldgroups. One thing to note is that, while fields are stored in $form, fieldgroups are stored in $form['#groups'] as well as in $form['#fieldgroups']. I don't know how to distinguish between these, and with this in mind, I have tried to apply a #states attribute to a fieldgroup in the same manner as above. However, it only produces server errors. Question: Is there a way to make a fieldgroup display conditionally using the States API or some alternative approach?

    Read the article

< Previous Page | 160 161 162 163 164 165 166 167 168 169 170 171  | Next Page >