Daily Archives

Articles indexed Sunday April 4 2010

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

  • how to redirect users to iphone-targeted website

    - by oo
    I just found the IUI project on google code where you can build websites that look like iPhone apps. I have an asp.net MVC website already built. When a user clicks on my website from an iPhone, i want to redirect them to another page that is targeted to the iPhone. how can i do this detection and redirection?

    Read the article

  • Boost.python building

    - by Ockonal
    Hi guys, really can't understand, how to build correctly project that uses boost.python. I've included boost_(python/thread/system)-mt. Here is simple module file: #include <boost/python.hpp> #include "script.hpp" #include "boost/python/detail/wrap_python.hpp" BOOST_PYTHON_MODULE(temp) { namespace py = boost::python; py::def("PyLog", &engine::log); } Here is bulid log: http://dpaste.com/179232/. Can't imagine what I forgot. System: arch linux; ls /usr/lib |grep boost : http://dpaste.com/179233/

    Read the article

  • User Control inherit from ListBox in Wpf?

    - by Rev
    Hi. I want to make a user Control in WPf with same properties and events like ListBox.(can add items , remove them , selecting ,...) on way in windows App is use a user control which is inherit form ListBox. but in WPF I don't know how make User Control inherit from ListBox (or other WPF Control)!!! I write this code but it had an exception public partial class InboxListItem : ListBox { public InboxListItem() { InitializeComponent(); } and It's Xaml file <UserControl x:Class="ListBoxControl.InboxListItem" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:myTypes="clr-namespace:ListBoxControl" />

    Read the article

  • Javascript clarity of purpose

    - by JesDaw
    Javascript usage has gotten remarkably more sophisticated and powerful in the past five years. One aspect of this sort of functional programming I struggle with, esp with Javascript’s peculiarities, is how to make clear either through comments or code just what is happening. Often this sort of code takes a while to decipher, even if you understand the prototypal, first-class functional Javascript way. Any thoughts or techniques for making perfectly clear what your code does and how in Javascript? I've asked this question elsewhere, but haven't gotten much response.

    Read the article

  • How to make a wxFrame behave like a modal wxDialog object

    - by dagorym
    Is is possible to make a wxFrame object behave like a modal dialog box in that the window creating the wxFrame object stops execution until the wxFrame object exits? I'm working on a small game and have run into the following problem. I have a main program window that hosts the main application (strategic portion). Occasionally, I need to transfer control to a second window for resolution of part of the game (tactical portion). While in the second window, I want the processing in the first window to stop and wait for completion of the work being done in the second window. Normally a modal dialog would do the trick but I want the new window to have some functionality that I can't seem to get with a wxDialog, namely a status bar at the bottom and the ability to resize/maximize/minimize the window (this should be possible but doesn't work, see this question How to get the minimize and maximize buttons to appear on a wxDialog object). As an addition note, I want the second window's functionality needs to stay completely decoupled from the primary window as it will be spun off into a separate program eventually. Has anyone done this or have any suggestions?

    Read the article

  • Disable #pragma message("")

    - by Balls-of-steel
    Hi, I needed to include in my project but there is a line, in glut.h which is #pragma message("Note: including lib: glut32.lib\n") It is really annoying and I want to get rid of it when compiling. I could just remove the line in my glut.h but I want my fix to be independent of the glut.h. I have tried setting #pragma warnings to show only critical info, and I have also tried #pragma message disable but nothing worked. Any help?

    Read the article

  • Understanding MongoDB(and NoSQL in general) and How to make the best use of it

    - by Earlz
    Hello, I am beginning to think that my next project I am wanting to do would work better with a NoSQL solution. The project would either involve a ton of 2-column tables or a ton of dynamic queries with dynamically generated columns in a traditional SQL database. So I feel a NoSQL database would be much cleaner. I'm looking at MongoDB and it looks pretty promising. Anyway, I'm attempting to make sense of it all. Also, I will be using MongoMapper in Ruby. Anyway though, I'm confused as to how to layout things in such a freeform database. I've read http://stackoverflow.com/questions/2170152/nosql-best-practices and the answer there says that normalization is usually bad in a NoSQL DB. So how would be the best way of laying out say a simple blog with users, posts, and comments? My natural thought was to have 3 collections for each and then link them by a unique ID. But this apparently is wrong? So, what are some of the ways to lay out such a thing? My concern with the answer given in the other question is what if the author's name changed. You'd have to go through updating a ton of posts and comments. But is this an ok thing to do with NoSQL?

    Read the article

  • Should I catch exceptions thrown when closing java.sql.Connection

    - by jb
    Connection.close() may throw SqlException, but I have always assumed that it is safe to ignore any such exceptions (and I have never seen code that does not ignore them). Normally I would write: try{ connection.close(); }catch(Exception e) {} Or try{ connection.close(); }catch(Exception e) { logger.log(e.getMessage(), e); } The question is: Is it bad practice (and has anyone had problems when ignoring such exeptions). When Connection.close() does throw any exception. If it is bad how should I handle the exception. Comment: I know that discarding exceptions is evil, but I'm reffering only to exceptions thrown when closing a connection (and as I've seen this is fairly common in this case). Does anyone know when Connection.close() may throw anything?

    Read the article

  • if statement inside array : codeigniter

    - by ahmad
    Hello , I have this function to edit all fields that come from the form and its works fine .. function editRow($tableName,$id) { $fieldsData = $this->db->field_data($tableName); $data = array(); foreach ($fieldsData as $key => $field) { $data[ $field->name ] = $this->input->post($field->name); } $this->db->where('id', $id); $this->db->update($tableName, $data); } now I want to add a condition for Password field , if the field is empty keep the old password , I did some thing like that : function editRow($tableName,$id) { $fieldsData = $this->db->field_data($tableName); $data = array(); foreach ($fieldsData as $key => $field) { if ($data[ $field->name ] == 'password' && $this->input->post('password') == '' ) { $data[ 'password' ] => $this->input->post('hide_password'), //'password' => $this->input->post('hide_password'), } else { $data[ $field->name ] => $this->input->post($field->name) } } $this->db->where('id', $id); $this->db->update($tableName, $data); } but I get error ( Parse error: syntax error, unexpected T_DOUBLE_ARROW in ... ) Html , some thing like this : <input type="text" name="password" value=""> <input type="hidden" name="hide_password" value="$row->$password" /> umm , any help ? thanks ..

    Read the article

  • Am I immoral for using a variable name that differs from its type only by case?

    - by Jason Baker
    For instance, take this piece of code: var person = new Person(); or for you Pythonistas: person = Person() I'm told constantly how bad this is, but have yet to see an example of the immorality of these two lines of code. To me, person is a Person and trying to give it another name is a waste of time. I suppose in the days before syntax highlighting, this would have been a big deal. But these days, it's pretty easy to tell a type name apart from a variable name. Heck, it's even easy to see the difference here on SO. Or is there something I'm missing? If so, it would be helpful if you could provide an example of code that causes problems.

    Read the article

  • What is the pro and cons using javascript in our form ?

    - by justjoe
    I got this code in my submit form Then use some js functions in the head; function frmSubmitSameWindows() { form.target = ''; form.submit(); } function frmSubmitNewWindows() { form.target = '_blank'; form.submit(); } What is the pro and cons when we use javascript event function such as frmSubmitSameWin() and frmSubmitNewWin() in our form ? as far as i concern, this is the best solution when we need a way to submit things. Is there other preference ? the better way then the way i got now ?

    Read the article

  • NSFetchedResultsController secondary sorting not working?

    - by binkly
    Hello, I'm using NSFetchedResultsController to fetch Message entities with Core Data. I want my tableview to group the messages by an attribute called ownerName. This works fine in the sense that I get a proper UI dispalying appropriately named sections. I can achieve this with the code below: NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"ownerName" ascending:NO]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [fetchRequest setSortDescriptors:sortDescriptors]; NSFetchedResultsController *fetchedResultsController = nil; fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:[appDelegate managedObjectContext] sectionNameKeyPath:@"ownerName" cacheName:@"Messages"] What'd I'd like to do now is have the section with the newest message at the top; exactly how it works with the Messages app on iPhone currently. I've tried adding a second sort descriptor and putting it in an array of sort descriptors and passing that to the fetchRequest but it doesn't appear to be affecting anything. Here is the 2nd sort descriptor that I used. NSSortDescriptor *idDescriptor = [[NSSortDescriptor alloc] initWithKey:@"createdAt" ascending:YES]; If anyone could provide some insight into this I would greatly appreciate it.

    Read the article

  • C# - Automatically Format Document

    - by Jeremy Rudd
    Anyway of invoking the Edit Advanced Format Document" VS command automatically when switching away from a document / routinely with a timer / on entering a document? Its really irritating Ctrl+E+D'ing everytime you want to prettify your code.

    Read the article

  • Image insert problem php sqlserver

    - by Termedi
    Hi I can not save image inside a sql server 2000 database. datatype is image here is the code: // Image Upload <?php include('config.php'); if(is_uploaded_file($_FILES['userfile']['tmp_name'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $size = filesize($tmpName); set_magic_quotes_runtime(0);//to desactive the default escape spacials caracters made by PHP in the externes files $img_binaire = base64_encode(fread(fopen(str_replace("'","''",$tmpName), "r"), $size)); $query = "INSERT INTO test_image (image_name, image_content, image_size) ". "VALUES ('{$fileName}','{$img_binaire}', '{$size}')"; odbc_exec($conn, $query) or die('Error, query failed'); echo "<br>File $fileName uploaded<br>"; echo "<br>File Size: $fileSize <br>"; } ?> // Image Show <?php include('config.php'); $sql = "select * from test_image where id =2"; $rsl = odbc_exec($conn, $sql); $image_info = odbc_fetch_array($rsl); //$count = sizeof($image_info['image_content']); //header('Accept-Ranges: bytes'); //header('Content-Length: '.$image_info['image_size']); //header("Content-length: 17397"); header('Content-Type: image/jpeg'); echo base64_decode($image_info['image_content']); //echo bindec($image_info['image_content']); ?> Error: Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Operand type clash: text is incompatible with image, SQL state 22005 in SQLExecDirect in C:\xampp\htdocs\test\upload.php on line 25 Error, query failed

    Read the article

  • JavaScript Collection of one-line Useful Functions

    - by Wilq32
    This is a question to put as many interesting and useful JavaScript functions written in one line as we can. I made this question because I'm curious how many people around like the art of one-Line programming in JavaScript, and I want to see their progress in action. Put variations of each code inside comments.

    Read the article

  • if (condition) continue; OR if (!condition) { ... }? (style preference)

    - by Hosam Aly
    I know this is a matter of style, hence the subjective tag. I have a small piece of code, with two nested conditions. I could code it in two ways, and I'd like to see how more experienced developers think it should look like. Style 1: while (!String.IsNullOrEmpty(msg = reader.readMsg())) { RaiseMessageReceived(); if (parseMsg) { ParsedMsg parsedMsg = parser.parseMsg(msg); RaiseMessageParsed(); if (processMsg) { process(parsedMsg); RaiseMessageProcessed(); } } } Style 2: while (!String.IsNullOrEmpty(msg = reader.readMsg())) { RaiseMessageReceived(); if (!parseMsg) continue; ParsedMsg parsedMsg = parser.parseMsg(msg); RaiseMessageParsed(); if (!processMsg) continue; process(parsedMsg); RaiseMessageProcessed(); } (Side question: how do I put empty lines in the source code sample?)

    Read the article

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