Writing a file with a fixed and variable part C - c

I have the following question:
The calendar text file and binary file should have a name that with a fixed part and a variable part. Use the time function (in time.h) or some other automatic mechanism to make sure that, when you write the files back out after updating the calendar, you do not overwrite the files you read in but you write a new version of the file that is clearly more recent.
Knowing that I have a program that manages a calendar.
Is it possible to to create a file with a fixed part and a variable part using the time.hlibrary ?
Thank you in advance!

Your question is vague, so the answer could only be similar.
From your specification, I guess you need a filename, f.e. "calendar-YYYYMMDDhhmmss.bin" and "calendar-YYYYMMDDhhmmss.txt"
When you "man time.h", you can see, that the time-"library" provides all these data. At the bottom of the man-page you see some related functions like "time()" and "strftime()", which help you to get a timestamp and to format a time to your needs.
If you "http://www.whathaveyoutried.com" and are stuck again, please update your question, and we will help you further.
EDITH (to the comment):
That depends on whether you should have a lot of files with each containing one "calendar" and the most recent dateded file is the actual calendar and the olde ones are backups; or you have one calendar-file with a new section for each "calendar", then you have to define (for yourself) how to organise these actual and historical sections.
as a matter of fact i would prefere the first solution, so each time you update your calendar, you call "fopen(path_filename_timestamp_txt, "w");". In the second case you would call "fopen(path_filename_txt, "a");" and "fwrite(timestamp);" your section-header;
Please show us, what you have done so far! (as short as possible, according to http://sscce.org/)

Related

Add new experimenter match field in OVS source code

I would like to add new match field of type OXM_experimenter class OVS source code, could anyone share proper document or steps to do it. It needs changes in many of the files and functions and understanding OVS source is somewhat difficult. If any added already and tested, can you guide ?
I successfully did this before, however, I don't have access to the code anymore, only bookmarks to stuff. There is an old thread in the mailing lists that may help you: Link and Link.
I wanted to handle PACKET_IN events in OVS a bit differently, so I followed the way of packets from the data plane through the upcall bit to ofproto-dpif-xlate.c. On the way, I stumbled upon a lot of constants. After adding my own to the enums, the last bit missing was the experimenter field, which was somewhere in the python scripts as described in the links above.
I hope this helps, I'm in the process of getting access to the code again I'll update my answer then. If not, the OvS discuss mailing list and archives may help you too.

Rapidminer Graph view suspected export bug?

As my question was remained unanswered in Rapidminer forum via this address :
my original question
I would like to propose it here again, please inform me if by any chance you know the answer.
I have noticed no matter what type of extensions we use for getting export (i.e. .pdf, .ps .jpg , etc), the export engine do like a screenshot of the current view instead of the whole output space, this has caused lots of issues for me exporting gigantic decision trees of my research.
Please someone advise me on this issue.
Best,
Amir
Use the log operator at the end of your process and configure it by the information you need. The log operator will save all results in a text file. Based on this file you can generate all your graphs at any time using rapidminer or gnuplot...
I find this way the best to save your time and memory space and also very easy to share in my opinion.

Reading FILEOBJECTs of Saved Note

I am involved in using the C API to interact with Lotus Notes and Lotus Domino. I'm running into issues when reading existing Notes out of an NSF. Specifically, reading TYPE_OBJECT fields and even more specifically, $FILE fields (though I'm sure all TYPE_OBJECT fields would fail if I had any others).
I'm using NSFItemInfo to get the summary data on the $FILE field (so I don't need the saved file, I need information about it such as its size, name, etc...).
If I create the Note in memory, Commit it, then read the $FILE field, everything works. If I change my unit test to read an existing Note (instead of creating it in memory), Lotus PANICS with an Invalid Handle Lookup message.
So I'm left feeling like there is something different about loading those fields when I create a Note from scratch Vs opening one already created. Even reading in an already created Note that my own code created gives me the same error, so I think I'm creating the Notes correctly.
I've explored the NSFNoteOpenExt's flags options and have attempted to open the Note with every possible flag described in OPEN_xxx and I always get the panics except when I open the Note with OPEN_ABSTRACT or OPEN_NOOBJECTS. The reason those don't error though, is because they open the Note without the $FILE fields at all, so when I see if the field exists I get a false and the code to read in TYPE_OBJECT fields is never executed.
Any ideas what I'm missing?
I'd provide code, but I'm actually using .NET interop to accomplish all this, and the code is spread across multiple files, etc.... If you have any questions please ask and I'll provide as much detail as I can.
Craig
I figured out the issue. It came from the fact that when using interop in C#, you can't call C macros. OSLockBlock is defined as a macro to another macro to a function. Essentially, it locks the BlockId.Pool pointer, then increments the pointer by BlockId.BlockHandle. I was mis-interpreting that macro logic to be first increment BlockId.Pool by BlockId.BlockHandle, then lock.
Essentially:
Lock(BlockId.Pool)+BlockId.BlockHandle Vs Lock(BlockId.Pool+BlockId.BlockHandle)
It's interesting that the latter would work when creating a new note with new attachments. I finally figured that out as well, BlockId.BlockHandle was always zero when doing that. So that's why that always worked.

Is it possible to embed dynamic text into Keynote'09?

I wonder if it is possible to embed dynamic text into Keynote'09? I want to create a new presentation and run this presentation with different text messages (depending on the time of the day and day of the month).
You can insert formulas in tables. I don't have the english version of keynote open, so I can't tell you the exact names of the functions (guessing). You can do something like
=IF(MINUTE(NOW()) > 30; "> 30" ; "<= 30")
See the formula help. If you tell me what you want to achieve, I can give you further details.
I'm not aware of any direct or easy method to achieve what you are asking for.
However, with AppleScript you can access and change at least the title and the body boxes of the slides. This should be done prior to the presentation.
If the 'dynamic' text is to appear in a text box, you could use some scripting to modify the presentation's XML directly. An older Keynote's XML schema should be reasonably well (but not wholly) documented in the iWork Programming Guide, but as the '09 file format is not backwards compatible I don't know how much that would help.
You could try using an encapsulated post script image file. Postscript is a real programming language. I don't know if Keynote will accept it (or if it will cache a bitmap), but Cocoa loads EPS, and Keynote is cocoa.
On Mac OS X, an EPS file gets evaluated when it is opened and converted to a PDF in memory. This process can take a really long time, like 30 seconds, if this is the first time you've tried to open an EPS file since logging in.
Ah! Someone pointed out to me that you can embed Quartz Composer compositions into keynote. This is a good way to do it.

If I wanted to define a file format, how would I go about that?

Say I come up with some super-duper way of representing some data that I think would be useful for other people to know about and use. Assume I have a 'spec' in some form, even if it might not be a completely formal one: ie, I know how this file format will work already.
How would I then go about releasing this spec to get comments and feedback based on it? How would I get it 'standardised' in some form?
Specifying file formats is difficult. If the data you want to store is trivial, it tends to be trivial. In general however, this is hardly the case. You can use the RFC structure and keywords, but I always found specifying a fileformat in prose a slow, difficult and boring task, also because reading it is likewise difficult.
My suggestion, if you want to follow this way, is to focus on blocks of information. Most of the difficuly is for entities that are optional, and present only if another condition happens, so try to exploit this when partitioning your data.
The best spec, IMHO, is real code with an uberperfect testsuite.
As for standardization, if enough people use it, it becomes a de-facto standard. you don't need an official stamp for it, although when the format is used enough, you could benefit from an official mime type.
To talk about it, well, it depends. I found useful to talk in terms of "object oriented" entities, and also in terms of relationships. Database-like diagrams are very useful on this respect.
Finally, try to find a decent already standard alternative first, or at least try not to deal with the raw bits. There are a lot of perfect container formats out there that free you of many annoying tasks. The choice of the container depends on the actual type of file format (e.g. if you need encryption, interleaving, transactions, etc).
There are a couple of ways I'd go about it, I think.
First, determine if there's a standards body (like W3C, or IEEE) that might be related to your file format. If there is, pitch it to them. I have no idea how receptive they'd be though.
Second, a standard is useless if nobody is using it. Get some momentum behind it. Write a blog post, twitter and make a website about it. Link on programming.reddit.com, and slashdot. Describe it to your friends and colleagues. Post it here on SO, and ask for feedback.
HTH.

Resources