Search Results

Search found 3459 results on 139 pages for 'if modified since'.

Page 78/139 | < Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >

  • Substitute all matches with values in Ruby regular expression

    - by Lewisham
    Hi all, I'm having a problem with getting a Ruby string substitution going. I'm writing a preprocessor for a limited language that I'm using, that doesn't natively support arrays, so I'm hacking in my own. I have a line: x[0] = x[1] & x[1] = x[2] I want to replace each instance with a reformatted version: x__0 = x__1 & x__1 = x__2 The line may include square brackets elsewhere. I've got a regex that will match the array use: array_usage = /(\w+)\[(\d+)\]/ but I can't figure out the Ruby construct to replace each instance one by one. I can't use .gsub() because that will match every instance on the line, and replace every array declaration with whatever the first one was. .scan() complains that the string is being modified if you try and use scan with a .sub()! inside a block. Any ideas would be appreciated!

    Read the article

  • Python configuration file generator

    - by Stan
    I want to use Python to make a configuration file generator. My roughly idea is feeding input with template files and some XML files with the real settings. Then use the program to generate the real configuration files. I got several questions: Is there any open source configuration generator program? (what could be the keyword), I wonder if there's anything can be added/modified in the design. Does Python have good XML parser module? Is it good idea to use XML file to save the original settings? I've been thinking to use Excel since it's more intuitive to maintain, but harder for program to parse. Not sure how people deal with this. Hope the community can give me some suggestions. Thanks a lot!

    Read the article

  • Passing a variable that can be updated

    - by Rob Bonner
    This seems like a simple thing, but can't get it to work. I pass a variable into a UIViewController thourgh a standard property: [aViewController setProposedDate:proposedWorkLog.entryDate]; which is retained by the controller, and possible changed. I have verified that in the controller, the data is modified. But, after it is popped off the stack and I look in the calling view, the data has not been updated. Is there a way to pass this variable and have it retain the new value, or a way to pass back a response from a closing view controller? Thanks!

    Read the article

  • NSManagedObjectID into NSData

    - by papr
    I found this wonderful NSManagedObjectID. This would be very good for referencing an Entity/NSManagedObject/NSEntityDescription, right? Let's get an ID from an entity: NSEntityDescription *entity = [self newEntity]; NSManagedObjectID *objID = [entity objectID]; So... any idea how to get this objID into a string? Or better: NSData. Actually something to be able to save it to the NSUserDefaults. ;-) Btw: NSFetchRequest doesn't want to work in my case. I use an modified version of this example: answer of an old question.

    Read the article

  • can a program written in C be faster than one written in OCaml and translated to C?

    - by Ole Jak
    So I have some cool Image Processing algorithm. I have written it in OCaml. It performs well. I now I can compile it as C code with such command ocamlc -output-obj -o foo.c foo.ml (I have a situation where I am not alowed to use OCaml compiler to bild my programm for my arcetecture, I can use only specialy modified gcc. so I will compile that programm with sometyhing like gcc -L/usr/lib/ocaml foo.c -lcamlrun -lm -lncurses and Itll run on my archetecture.) I want to know in general case can a program written in C be faster than one written in OCaml and translated to C?

    Read the article

  • Modify an MP3 slightly to change the data appearence

    - by Léon Pelletier
    I'm thinking about encrypting MP3s in a database, so that when user is downloading them with his software desktop player, only the software can decrypt them. This part is not a problem. The problem is I don't want a user to upload an mp3 to the database, then check which changes have been made to the file so he can reverse-engineer the file or at least see which algorithm is used to encrypt the files. So, user uploads MP3-A, then it becomes MP3-B because it has been modified, and I encrypt it to MP3-C. And when decrypted, it sounds 99.99% like MP3-A. I know MP3 format is lossy, but I wonder if there's a way to convert audio with limited loss, or if I need to forget it right now.

    Read the article

  • How to use AOP to intercept a method call in super on an argument?

    - by hleinone
    I'm extending a class and overriding a method. All I want to do is to call super, but with a modified argument that gets intercepted upon one of its methods is called. An example makes it more clear: // Foo is an interface and also this method is part of an interface @Override public void foo(Foo foo) { // I want to intercept the call to foo.bar() in super super.foo(foo); } I'd rather use a tool that doesn't require a compiler of its own. What would be the optimal one?

    Read the article

  • C++ Static Array Initialization - Memory Issue

    - by donalmg
    Hi, I have a header file which contains a member variable declaration of a static char array: class ABC { public: static char newArray[4]; // other variables / functions private: void setArray(int i, char * ptr); } In the CPP file, I have the array initialized to NULL: char ABC::newArray[4] = {0}; In the ABC constructor, I need to overwrite this value with a value constructed at runtime, such as the encoding of an integer: ABC::ABC() { int i; //some int value defined at runtime memset(newArray, 0, 4); // not sure if this is necessary setArray(i,newArray); } ... void setArray(int i, char * value) { // encoding i to set value[0] ... value [3] } When I return from this function, and print the modified newArray value, it prints out many more characters than the 4 specified in the array declaration. Any ideas why this is the case. I just want to set the char array to 4 characters and nothing further. Thanks...

    Read the article

  • Apply a class to a <h1> based on the site url

    - by user1870639
    I'm new to PHP and want to apply a specific class to the title of my page depending on what part of the site the viewer is browsing. For instance, I want to apply the class "blog" to the if the viewer is at domain.com/blog OR domain.com/blog/post-1 so on and so forth BUT apply the class "pics" if they're viewing domain.com/pics or domain.com/pics/gallery-1 etc etc. I found something that could be modified to serve my needs using javascript here but I figured seeing as I'm using PHP already, it'd make more sense to keep this sort of thing server side. As I say, I'm new to PHP. I've experimented with some regular expressions, but to no avail.

    Read the article

  • Drupal vs Some Other CMS

    - by Vecta
    I'm going to be moving my website to a CMS in the coming months I'd I need some help on choosing an appropriate CMS. Many of the websites I've seen tend to say "use Drupal, hands down". However, my website truly doesn't have a need for commenting or community features. Its pages will need to be modified occasionally, but not extensively. My website will also consist of many programs, each with their own sub-pages and menus. There are probably 25 people that will need access to the content on my website and will need the ability to update it. I do like the idea of being able to tag and categorize the content, and the modular aspect of Drupal but is it really right for my website? If not, which CMS may fit my needs better?

    Read the article

  • Does ini_set('session.save_path', 'custom path'); effect the session garbage cleaner?

    - by newbtophp
    Hi! Does ini_set('session.save_path', 'custom path'); effect the session garbage cleaner? As I'm setting a custom directory for the sessions, because I've read from various php security guides, that setting a custom directory on shared hosting for sessions; can improve session security. But the problem is I've read somewhere that PHP does/handles the session garbage cleaning only when the session_save_path is the default and not modified (ie. using a custom directory)? - is this true, if so is their a solution for this?. (take into consideration I'm using shared hosting). Appreciate all help!

    Read the article

  • [cakephp] problem with find query

    - by luk4s
    Hi I have a problem with find query: $userInProjects = $this->Timesheet->RegularPost->UserInProject->find('all', array('conditions' => array('UserInProject.user_id' => $id))); The result array: Array ( [0] => Array ( [UserInProject] => Array ( [id] => 11 [project_id] => 3 [position_id] => 1 [user_id] => 15 ) [Project] => Array ( [id] => 3 [short_name] => proj1 [full_name] => project 1 [start_date] => 2010-01-01 [end_date] => 2010-05-01 [agreement_number] => 12/34U/23 [active] => 1 [user_id] => 1 ) [Position] => Array ( [id] => 1 [name] => some_name ) [User] => Array ( [id] => 15 [username] => foo [first_name] => [last_name] => [email] => [email protected] [active] => 1 [created] => [modified] => ) [RegularPost] => Array ( [0] => Array ( [id] => 792 [date] => 2010-01-01 [size] => 0.20000 [users_in_project_id] => 11 ) [1] => Array ( [id] => 793 [date] => 2010-02-01 [size] => 0.20000 [users_in_project_id] => 11 ) ( and many more ...) ) ) [1] => Array ( [UserInProject] => Array ( [id] => 20 [project_id] => 3 [position_id] => 2 [user_id] => 15 ) [Project] => Array ( [id] => 3 [short_name] => proj1 [full_name] => project 1 [start_date] => 2010-01-01 [end_date] => 2010-05-01 [agreement_number] => 12/34U/23 [active] => 1 [user_id] => 1 ) [Position] => Array ( [id] => 2 [name] => some_name2 ) [User] => Array ( [id] => 15 [username] => foo [first_name] => [last_name] => [email] => [email protected] [active] => 1 [created] => [modified] => ) [RegularPost] => Array ( [0] => Array ( [id] => 836 [date] => 2010-01-01 [size] => 0.2 [users_in_project_id] => 20 ) [1] => Array ( [id] => 837 [date] => 2010-02-01 [size] => 0.3 [users_in_project_id] => 20 ) [2] => Array ( [id] => 838 [date] => 2010-03-01 [size] => 0.3 [users_in_project_id] => 20 ) ( and many more ...) ) ) ) What I want to achive is the array like above but RegularPost with [date] = 2010-02-01 only. Is there any way to pass the date '2010-02-01' to the RegularPost in this query? This query doesn't work: $userInProjects = $this->Timesheet->RegularPost->UserInProject->find('all', array('conditions' => array('UserInProject.user_id' => $id, 'RegularPost.date' => '2010-02-01'))); 1054: Unknown column 'RegularPost.date' in 'where clause' Please help. :)

    Read the article

  • How to check for a file's authenticity ?

    - by Ale_x
    Let's say I write a game application. I want the level of the player to be stored in an external file. How can I prevent a hacker from writing and modifying the file to put another level ? I want the file to be modified by my application only. I can sign the file's content with a key, but then this key will be stored in the application, therefore it would be possible for a hacker to decompile the binary and find the key. Is there any way to do this ?

    Read the article

  • DataSet.GetChanges - Save the updated record in a different table than the source one

    - by John Dev
    I'm doing operation on a dataset containing data from a sql table named Test_1 and then get the updated records using the DataSet.GetChanges(DataRowState.Modified) function. Then i try to save the dataset containing the updated records on a different table than the source one (the table is names Test and has the same structure as Test_1) using the following statement: sqlDataAdapter.Update(changesDataSet,"Test"); I'm getting the following error : Update unable to find TableMapping['Test'] or DataTable 'Test' I'm new to ado.net and don't even know if it"s something possible. Any advice is welcome. Just to provide a bit of context. ETL jobs are importing data in temp table with same structure as the original but with _jobid suffix. Right after a rule engine is doing validation before updating the original table.

    Read the article

  • Can Perl detect arrays?

    - by Sandra Schlichting
    I have this script #!/usr/bin/perl use warnings; use strict; use Data::Dumper; my %x1 = (); $x1{"a"} = "e"; my %x2 = (); $x2{"a"} = ["b","c"]; p(\%x1); p(\%x2); sub p { my $x = shift @_; print $x->{a}; print "\n"; } which outputs e ARRAY(0x2603fa0) The problem is I don't know when the input is an array or a scalar, and when it is an array I would like to print those values as well. Can p be modified to do this?

    Read the article

  • Java Util Linked List - how to find next?

    - by drozzy
    When using Java LinkedList how do you find out the element's next or previous relationships? I mean, in a regular linked list I would do something like this: Node node1 = new Node(); Node node2 = new Node(); LinkedList list = new LinkedList(); list.add(node1); list.add(node2); //then my node1 will know who it's next is: assertEquals(node2, node1.next()); But in Java's LinkedList, the data does not seem to be modified. So how do I actually find out who the "next" (or "previous" in the case of doubly-linked lists) element is?

    Read the article

  • Are there alternative ways to implementing an "active link" navigation without using server side languages?

    - by Mel
    By "active" I mean to have the link pointing to the current page classed as "active." This way the link's appearance can be modified using css. Is it possible to implement an active link navigation without using a server side language? I would like to only use CSS/HTML/jQuery if possible. If there are, what are those methods? Assuming you want to create the following structure: <ul id="nav"> <li class="active">Home</li> <li>About</li> <li>Contact</li> </ul>

    Read the article

  • JTable.removeColumn() method throws exception

    - by sanjeev
    To hide a column from only the view of JTable, i am using the removeColumn() method. But it throws the exception Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 7 >= 7 at java.util.Vector.elementAt(Vector.java:470) at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:294) at javax.swing.plaf.basic.BasicTableHeaderUI.paint(BasicTableHeaderUI.java:648) i think, after removing column from the view, if i modified the model, then this exception pops out. is it because of there is no column in view, while the model is updating the table ? What is the best way to hide the column in view in JTable ? insteading of setting the sizes to 0.

    Read the article

  • Object changed while deserialization

    - by neoms21
    I'm serializing an object and storing the serialized value in db and getting the deserialization to work fine as well after getting values from db. But problem occurs if the existing object is modified and a new property is added in the class. Then while deserializing it looks for that property in serialized text and upon not finding it there, I get the following error System.Runtime.Serialization.SerializationException: Member 'temp' was not found. Is there any way I can know if new property was not there while serialization and can skip that? I'm using custom serialization.

    Read the article

  • Removing rows from MySQL table where the timestamp is over one day old?

    - by Rob
    I found the exact same question here. But it isn't working for me. I've modified it a bit, manipulated it, and I can't figure it out. I'm trying to remove rows that are over a day old. Here is my code: if (isset($_POST['prune'])) { $sql = "DELETE FROM logs WHERE time < date('now', '-1 days')"; mysql_query($sql); echo 'Logs older than one day removed.'; } Fairly simple question I suppose, but its bugging the hell out of me. I would appreciate any help. In case it makes a difference, the column is a TIMESTAMP type.

    Read the article

  • In linux, is it possible to do partial reads on a regular file

    - by Jimm
    I need to write an application that spits out log entries to a regular file at a very fast rate. Also, there will be another process, that can read the same file concurrently at the time, other process would be writing to it. I have following questions How does read() determine EOF, specially in the case, where the underlying file could be concurrently being modified? Is it possible for read() to return partially written data from the other process write? For example, the write process wrote half a line and read would pick that half line and return? The application would be written in C on linux 2.6.x using Ex4 filesystem UPDATE: Below link points to the patch, that locks inode in EXT4, before reading and writing. http://patchwork.ozlabs.org/patch/91834/

    Read the article

  • Setting height of a DIV to correspond with location of anchor inside said DIV

    - by filip
    Core issue : http://jsfiddle.net/pipip/P46Xg/ I have a div container with a few paragraphs of text, and inside one of these paragraphs is the following anchor <a id="stop" /> The container is set to overflow:hidden Is it possible with javascript / JQuery to set the height of the container so that the bottom of the container stops exactly at or below the anchor? Added Depth & Background : http://jsfiddle.net/pipip/yj9dB/ This would be used for a modified JQuery Slider. Where someone using a CMS could type [readmore] anywhere into the Content field, which would be replaced by the above anchor via PHP. This way they would be easily able to control where the Read More break appears within the container. In the associated example I am hard-coding the height to 75px, although what I want is for the height to be dependent on the location of the anchor id="stop" in the text. Thanks. If this is an awful way to go about it, I'm all ears!

    Read the article

  • Redis suggesstion for selecting data type

    - by PHP Connect
    We have questions based where in home page we were showing 2 list Questions by date modified Question have bigger views and ans count. And in this both listing if question have same views or ans count then sorting is based on date. Previously i am directly quiring to MySQL database and fetching the values so it's easy. But each page request hitting to MySQL it's bit expensive then start doing caching. I started using Redis. Following is the cases when i use redis cache Issues is On second listing i have to display questions by votes and not answered combine. How can i stored this type of data in redis to load faster with sorting based by 2 conditions votes with time and ans count with time?

    Read the article

  • Use of .apply() with 'new' operator. Is this possible?

    - by Premasagar
    In JavaScript, I want to create an object instance (via the new operator), but pass an arbitrary number of arguments to the constructor. Is this possible? What I want to do is something like this (but the code below does not work): function Something(){ // init stuff } function createSomething(){ return new Something.apply(null, arguments); } var s = createSomething(a,b,c); // 's' is an instance of Something The Answer From the responses here, it became clear that there's no in-built way to call .apply() with the new operator. However, people suggested a number of really interesting solutions to the problem. My preferred solution was this one from Matthew Crumley (I've modified it to pass the arguments property): var createSomething = (function() { function F(args) { return Something.apply(this, args); } F.prototype = Something.prototype; return function() { return new F(arguments); } })();

    Read the article

  • Is post-sudden-power-loss filesystem corruption on an SSD drive's ext3 partition "expected behavior"?

    - by Jeremy Friesner
    My company makes an embedded Debian Linux device that boots from an ext3 partition on an internal SSD drive. Because the device is an embedded "black box", it is usually shut down the rude way, by simply cutting power to the device via an external switch. This is normally okay, as ext3's journalling keeps things in order, so other than the occasional loss of part of a log file, things keep chugging along fine. However, we've recently seen a number of units where after a number of hard-power-cycles the ext3 partition starts to develop structural issues -- in particular, we run e2fsck on the ext3 partition and it finds a number of issues like those shown in the output listing at the bottom of this Question. Running e2fsck until it stops reporting errors (or reformatting the partition) clears the issues. My question is... what are the implications of seeing problems like this on an ext3/SSD system that has been subjected to lots of sudden/unexpected shutdowns? My feeling is that this might be a sign of a software or hardware problem in our system, since my understanding is that (barring a bug or hardware problem) ext3's journalling feature is supposed to prevent these sorts of filesystem-integrity errors. (Note: I understand that user-data is not journalled and so munged/missing/truncated user-files can happen; I'm specifically talking here about filesystem-metadata errors like those shown below) My co-worker, on the other hand, says that this is known/expected behavior because SSD controllers sometimes re-order write commands and that can cause the ext3 journal to get confused. In particular, he believes that even given normally functioning hardware and bug-free software, the ext3 journal only makes filesystem corruption less likely, not impossible, so we should not be surprised to see problems like this from time to time. Which of us is right? Embedded-PC-failsafe:~# ls Embedded-PC-failsafe:~# umount /mnt/unionfs Embedded-PC-failsafe:~# e2fsck /dev/sda3 e2fsck 1.41.3 (12-Oct-2008) embeddedrootwrite contains a file system with errors, check forced. Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Invalid inode number for '.' in directory inode 46948. Fix<y>? yes Directory inode 46948, block 0, offset 12: directory corrupted Salvage<y>? yes Entry 'status_2012-11-26_14h13m41.csv' in /var/log/status_logs (46956) has deleted/unused inode 47075. Clear<y>? yes Entry 'status_2012-11-26_10h42m58.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47076. Clear<y>? yes Entry 'status_2012-11-26_11h29m41.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47080. Clear<y>? yes Entry 'status_2012-11-26_11h42m13.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47081. Clear<y>? yes Entry 'status_2012-11-26_12h07m17.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47083. Clear<y>? yes Entry 'status_2012-11-26_12h14m53.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47085. Clear<y>? yes Entry 'status_2012-11-26_15h06m49.csv' in /var/log/status_logs (46956) has deleted/unused inode 47088. Clear<y>? yes Entry 'status_2012-11-20_14h50m09.csv' in /var/log/status_logs (46956) has deleted/unused inode 47073. Clear<y>? yes Entry 'status_2012-11-20_14h55m32.csv' in /var/log/status_logs (46956) has deleted/unused inode 47074. Clear<y>? yes Entry 'status_2012-11-26_11h04m36.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47078. Clear<y>? yes Entry 'status_2012-11-26_11h54m45.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47082. Clear<y>? yes Entry 'status_2012-11-26_12h12m20.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47084. Clear<y>? yes Entry 'status_2012-11-26_12h33m52.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47086. Clear<y>? yes Entry 'status_2012-11-26_10h51m59.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47077. Clear<y>? yes Entry 'status_2012-11-26_11h17m09.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47079. Clear<y>? yes Entry 'status_2012-11-26_12h54m11.csv.gz' in /var/log/status_logs (46956) has deleted/unused inode 47087. Clear<y>? yes Pass 3: Checking directory connectivity '..' in /etc/network/run (46948) is <The NULL inode> (0), should be /etc/network (46953). Fix<y>? yes Couldn't fix parent of inode 46948: Couldn't find parent directory entry Pass 4: Checking reference counts Unattached inode 46945 Connect to /lost+found<y>? yes Inode 46945 ref count is 2, should be 1. Fix<y>? yes Inode 46953 ref count is 5, should be 4. Fix<y>? yes Pass 5: Checking group summary information Block bitmap differences: -(208264--208266) -(210062--210068) -(211343--211491) -(213241--213250) -(213344--213393) -213397 -(213457--213463) -(213516--213521) -(213628--213655) -(213683--213688) -(213709--213728) -(215265--215300) -(215346--215365) -(221541--221551) -(221696--221704) -227517 Fix<y>? yes Free blocks count wrong for group #6 (17247, counted=17611). Fix<y>? yes Free blocks count wrong (161691, counted=162055). Fix<y>? yes Inode bitmap differences: +(47089--47090) +47093 +47095 +(47097--47099) +(47101--47104) -(47219--47220) -47222 -47224 -47228 -47231 -(47347--47348) -47350 -47352 -47356 -47359 -(47457--47488) -47985 -47996 -(47999--48000) -48017 -(48027--48028) -(48030--48032) -48049 -(48059--48060) -(48062--48064) -48081 -(48091--48092) -(48094--48096) Fix<y>? yes Free inodes count wrong for group #6 (7608, counted=7624). Fix<y>? yes Free inodes count wrong (61919, counted=61935). Fix<y>? yes embeddedrootwrite: ***** FILE SYSTEM WAS MODIFIED ***** embeddedrootwrite: ********** WARNING: Filesystem still has errors ********** embeddedrootwrite: 657/62592 files (24.4% non-contiguous), 87882/249937 blocks Embedded-PC-failsafe:~# Embedded-PC-failsafe:~# e2fsck /dev/sda3 e2fsck 1.41.3 (12-Oct-2008) embeddedrootwrite contains a file system with errors, check forced. Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Directory entry for '.' in ... (46948) is big. Split<y>? yes Missing '..' in directory inode 46948. Fix<y>? yes Setting filetype for entry '..' in ... (46948) to 2. Pass 3: Checking directory connectivity '..' in /etc/network/run (46948) is <The NULL inode> (0), should be /etc/network (46953). Fix<y>? yes Pass 4: Checking reference counts Inode 2 ref count is 12, should be 13. Fix<y>? yes Pass 5: Checking group summary information embeddedrootwrite: ***** FILE SYSTEM WAS MODIFIED ***** embeddedrootwrite: 657/62592 files (24.4% non-contiguous), 87882/249937 blocks Embedded-PC-failsafe:~# Embedded-PC-failsafe:~# e2fsck /dev/sda3 e2fsck 1.41.3 (12-Oct-2008) embeddedrootwrite: clean, 657/62592 files, 87882/249937 blocks

    Read the article

< Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >