Daily Archives

Articles indexed Tuesday May 25 2010

Page 7/118 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • How to increment a value using a C-Preprocessor in Objective-C?

    - by mystify
    Example: I try to do this: static NSInteger stepNum = 1; #define METHODNAME(i) -(void)step##i #define STEP METHODNAME(stepNum++) @implementation Test STEP { // do stuff... [self nextFrame:@selector(step2) afterDelay:1]; } STEP { // do stuff... [self nextFrame:@selector(step3) afterDelay:1]; } STEP { // do stuff... [self nextFrame:@selector(step4) afterDelay:1]; } // ... When building, Xcode complains that it can't increment stepNum. This seems logical to me, because at this time the code is not "alive" and this pre-processing substitution stuff happens before actually compiling the source code. Is there another way I could have an variable be incremented on every usage of STEP macro, the easy way?

    Read the article

  • What is iproxy.saverpigeeks.com

    - by weotch
    I'm seeing it in a ton of search results and even copy pasted into content on this site (http://stackoverflow.com/questions/2687289/adding-a-bookmark-link-to-a-facebook-iframe-app). Is it a phishing thing or just some actual proxy thing that is innocent?

    Read the article

  • Handling XMLHttpRequest to call external application

    - by Ian
    I need a simple way to use XMLHttpRequest as a way for a web client to access applications in an embedded device. I'm getting confused trying to figure out how to make something thin and light that handles the XMLHttpRequests coming to the web server and can translate those to application calls. The situation: The web client using Ajax (ExtJS specifically) needs to send and receive asynchronously to an existing embedded application. This isn't just to have a thick client/thin server, the client needs to run background checking on the application status. The application can expose a socket interface, with a known set of commands, events, and configuration values. Configuration could probably be transmitted as XML since it comes from a SQLite database. In between the client and app is a lighttpd web server running something that somehow handles the translation. This something is the problem. What I think I want: Lighttpd can use FastCGI to route all XMLHttpRequest to an external process. This process will understand HTML/XML, and translate between that and the application's language. It will have custom logic to simulate pushing notifications to the client (receive XMLHttpRequest, don't respond until the next notification is available). C/C++. I'd really like to avoid installing Java/PHP/Perl on an embedded device. So I'll need more low level understanding. How do I do this? Are there good C++ libraries for interpreting the CGI headers and HTML so that I don't have to do any syntax processing, I can just deal with the request/response contents? Are there any good references to exactly what goes on, server side, when handling the XMLHttpRequest and CGI interfaces? Is there any package that does most of this job already, or will I have to build the non-HTTP/CGI stuff from scratch? Thanks for any help! I am really having trouble learning about the server side of these technologies.

    Read the article

  • SSH into Ubuntu Linux on a box without a static IP address

    - by Steven Xu
    Basically, how do I do it? I'd like to connect to my home computer from work, but my internet is routed through my apartment building's network, so I don't have the static IP address I'm accustomed to having. How do I go about accessing my home computer through SSH (I'll be using Putty at work if it matters) if my home computer doesn't have a static IP address?

    Read the article

  • Python DictReader - Skipping rows with missing columns?

    - by victorhooi
    heya, I have a Excel .CSV file I'm attempting to read in with DictReader. All seems to be well, except it seems to omit rows, specifically those with missing columns. Our input looks like: mail,givenName,sn,lorem,ipsum,dolor,telephoneNumber [email protected],ian,bay,3424,8403,2535,+65(2)34523534545 [email protected],mike,gibson,3424,8403,2535,+65(2)34523534545 [email protected],ross,martin,,,,+65(2)34523534545 [email protected],david,connor,,,,+65(2)34523534545 [email protected],chris,call,3424,8403,2535,+65(2)34523534545 So some of the rows have missing lorem/ipsum/dolor columns, and it's just a string of commas for those. We're reading it in with: def read_gd_dump(input_file="blah 20100423.csv"): gd_extract = csv.DictReader(open('blah 20100423.csv'), restval='missing', dialect='excel') return dict([(row['something'], row) for row in gd_extract]) And I checked that "something" (the key for our dict) isn't one of the missing columns, I had originally suspected it might be that. It's one of the columns after that. However, DictReader seems to completely skip over the rows. I tried setting restval to something, didn't seem to make any difference. I can't seem to find anything in Python's CSV docs (http://docs.python.org/library/csv.html) that would explain this behaviour, but I may have misread something. Any ideas? Thanks, Victor

    Read the article

  • Compare Dates DataAnnotations Validation asp.net mvc

    - by oliver
    Lets say I have a StartDate and an EndDate and I wnt to check if the EndDate is not more then 3 months apart from the Start Date public class DateCompare : ValidationAttribute { public String StartDate { get; set; } public String EndDate { get; set; } //Constructor to take in the property names that are supposed to be checked public DateCompare(String startDate, String endDate) { StartDate = startDate; EndDate = endDate; } public override bool IsValid(object value) { var str = value.ToString(); if (string.IsNullOrEmpty(str)) return true; DateTime theEndDate = DateTime.ParseExact(EndDate, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); DateTime theStartDate = DateTime.ParseExact(StartDate, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture).AddMonths(3); return (DateTime.Compare(theStartDate, theEndDate) > 0); } } and I would like to implement this into my validation [DateCompare("StartDate", "EndDate", ErrorMessage = "The Deal can only be 3 months long!")] I know I get an error here... but how can I do this sort of business rule validation in asp.net mvc

    Read the article

  • Multi-line regex support in Vim

    - by Daniel
    I notice the standard regex syntax for matching across multiple lines is to use /s, like so: This is\nsome text /This.*text/s This works in Perl for instance but doesn't seem to be supported in Vim. Instead, I have to be much more specific: /This[^\r\n]*[\r\n]*text/ I can't find any reason for why this should be, so I'm thinking I probably just missed the relevant bits in the vim help. Can anyone confirm this behaviour one way or the other?

    Read the article

  • extensible database design: automatic ALTER TABLE or serialize() field BLOB ?

    - by mario
    I want an adaptable database scheme. But still use a simple table data gateway in my application, where I just pass an $data[] array for storing. The basic columns are settled in the initial table scheme. There will however arise a couple of meta fields later (ca 10-20). I want some flexibility there and not adapt the database manually each time, or -worse- change the application logic just because of new fields. So now there are two options which seem workable yet not overkill. But I'm not sure about the scalability or database drawbacks. (1) Automatic ALTER TABLE. Whenever the $data array is to be saved, the keys are compared against the current database columns. New columns get defined before the $data is INSERTed into the table. Actually seems simple enough in test code: function save($data, $table="forum") { // columns if ($new_fields = array_diff(array_keys($data), known_fields($table))) { extend_schema($table, $new_fields, $data); } // save $columns = implode("`, `", array_keys($data)); $qm = str_repeat(",?", count(array_keys($data)) - 1); echo ("INSERT INTO `$table` (`$columns`) VALUES (?$qm);"); function known_fields($table) { return unserialize(@file_get_contents("db:$table")) ?: array("id"); function extend_schema($table, $new_fields, $data) { foreach ($new_fields as $field) { echo("ALTER TABLE `$table` ADD COLUMN `$field` VARCHAR;"); Since it is mostly meta information fields, adding them just as VARCHAR seems sufficient. Nobody will query by them anyway. So the database is really just used as storage here. However, while I might want to add a lot of new $data fields on the go, they will not always be populated. (2) serialize() fields into BLOB. Any new/extraneous meta fields could be opaque to the database. Simply sorting out the virtual fields from the real database columns is simple. And the meta fields can just be serialize()d into a blob/text field then: function ext_save($data, $table="forum") { $db_fields = array("id", "content", "flags", "ext"); // disjoin foreach (array_diff(array_keys($data),$db_fields) as $key) { $data["ext"][$key] = $data[$key]; unset($data[$key]); } $data["ext"] = serialize($data["ext"]); Unserializing and unpacking this 'ext' column on read queries is a minor overhead. The advantage is that there won't be any sparsely filled columns in the database, so I guess it's compacter and faster than the AUTO ALTER TABLE approach. Of course, this method prevents ever using one of the new fields in a WHERE or GROUP BY clause. But I think none of the possible meta fields (user_agent, author_ip, author_img, votes, hits, last_modified, ..) would/should ever be used there anyway. So I currently prefer the 'ext' blob approach, even if it's a one-way ticket. How are such columns called usually? (looking for examples/doc) Would you use XML serialization for (very theoretical) in-database queries? The adapting table scheme seems a "cleaner" interface, even if most columns might remain empty then. How does that impact speed? How many such sparse VARCHAR fields can MySQL/innodb stomach? But most importantly: Is there any standard implementation for this? A pseudo ORM with automatic ALTER TABLE tricks? Storing a simple column list seems workable, but something like pdo::getColumnMeta would be more robust.

    Read the article

  • Visual Studio Talk Show #119 is now online - Quand et dans quel contexte est-ce que adquat est adqua

    http://www.visualstudiotalkshow.com Joel Quimper: Quand et dans quel contexte est-ce que adquat est adquat? Nous discutons avec Joel Quimper des pratiques de dveloppement et de la mauvaise habitude qui consiste vouloir tout abstraire et tout gnraliser. Un application offre une valeur relle seulement lorsquelle est utilise par des utilisateurs. Alors ou tracer la limite entre le sur-design, l'extensibilit et la rutilisabilit. Joel Quimper est un conseiller en architecture chez Microsoft Canada....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • What is iproxy.saverpigeeks.com

    - by weotch
    I'm seeing it in a ton of search results and even copy pasted into content on this site (http://stackoverflow.com/questions/2687289/adding-a-bookmark-link-to-a-facebook-iframe-app). Is it a phishing thing or just some actual proxy thing that is innocent?

    Read the article

  • SQLAuthority News – Whitepaper – SQL Azure vs. SQL Server

    - by pinaldave
    SQL Server and SQL Azure are two Microsoft Products which goes almost together. There are plenty of misconceptions about SQL Azure. I have seen enough developers not planning for SQL Azure because they are not sure what exactly they are getting into. Some are confused thinking Azure is not powerful enough. I disagree and strongly urge all of you to read following white paper written and published by Microsoft. SQL Azure vs. SQL Server by Dinakar Nethi, Niraj Nagrani SQL Azure Database is a cloud-based relational database service from Microsoft. SQL Azure provides relational database functionality as a utility service. Cloud-based database solutions such as SQL Azure can provide many benefits, including rapid provisioning, cost-effective scalability, high availability, and reduced management overhead. This paper compares SQL Azure Database with SQL Server in terms of logical administration vs. physical administration, provisioning, Transact-SQL support, data storage, SSIS, along with other features and capabilities. The content of this white paper is as following: Similarities and Differences Logical Administration vs. Physical Administration Provisioning Transact-SQL Support Features and Types Key Benefits of the Service Self-Managing High Availability Scalability Familiar Development Model Relational Data Model The above summary text is taken from white paper itself. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, SQL White Papers, SQLAuthority News, T SQL, Technology Tagged: SQL Azure

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >