Search Results

Search found 1043 results on 42 pages for 'thomas versteeg'.

Page 26/42 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • How should I protect against hard link attacks?

    - by Thomas
    I want to append data to a file in /tmp. If the file doesn't exist I want to create it I don't care if someone else owns the file. The data is not secret. I do not want someone to be able to race-condition this into writing somewhere else, or to another file. What is the best way to do this? Here's my thought: fd = open("/tmp/some-benchmark-data.txt", O_APPEND | O_CREAT | O_NOFOLLOW | O_WRONLY, 0644); fstat(fd, &st); if (st.st_nlink != 1) { HARD LINK ATTACK! } What's the right way? Besides not using a world-writable directory.

    Read the article

  • Regarding Visual C# MenuItem: Where does the NullReference come from?

    - by Thomas
    Hi All. I have a problem creating MenuItems for a TreeView dynamically: here is the (simplified)code i'm using. public class CTM : TreeNode, IComparable, IComparable<CTM> { public CTM(CTMProvider provider) { this.provider = provider; this.manager = provider.manager; this.IEEEAddress = provider.IEEEAddress; this.endpoint = provider.state._conn.RemoteEndPoint; this.Text = String.Format("CTM: {0} {0}", IEEEAddress, ((System.Net.IPEndPoint)endpoint).ToString()); try { MenuItem meni = System.EventHandler(this.provider.Disconnect)); this.ContextMenu.MenuItems.Add(meni); } catch { Trace.TraceError("Could not create menu item!"); } } } This code always triggers the catch clause with a NullReferenceException. Any Ideas?

    Read the article

  • class foo; in header file

    - by Thomas
    Hi, Is some one able to explain why header files have something like this? class foo; // This here? class bar { bar(); }; Do you need an include statement when using this? Thanks.

    Read the article

  • View bound to paged collection view not updating all of the time.

    - by Thomas
    I new to silverlight and trying to make a business application using the mvvm pattern and ria services. I have a view model class that contains a PagedCollectoinView and it is set to the item source of a datagrid. When I update the PagedCollectionView the datagrid is only updated the first time then after that subsequent changes to the data to not reflect in the view until after another edit. Things seem to be delayed one edit. Below is a summarized example of my xaml and code behind. This is the code for my view model public class CustomerContactLinks : INotifyPropertyChanged { private ObservableCollection<CustomerContactLink> _CustomerContact; public ObservableCollection<CustomerContactLink> CustomerContact { get { if (_CustomerContact == null) _CustomerContact = new ObservableCollection<CustomerContactLink>(); return _CustomerContact; } set { _CustomerContact = value; } } private PagedCollectionView _CustomerContactPaged; public PagedCollectionView CustomerContactPaged { get { if (_CustomerContactPaged == null) _CustomerContactPaged = new PagedCollectionView(CustomerContact); return _CustomerContactPaged; } } private TicketSystemDataContext _ctx; public TicketSystemDataContext ctx { get { if (_ctx == null) _ctx = new TicketSystemDataContext(); return _ctx; } } public void GetAll() { ctx.Load(ctx.GetCustomerContactInfoQuery(), LoadCustomerContactsComplete, null); } private void LoadCustomerContactsComplete(LoadOperation<CustomerContactLink> lo) { foreach (var entity in lo.Entities) { CustomerContact.Add(entity as CustomerContactLink); } } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged(string propertyName) { if (PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } #endregion } Here is the basics of my XAML <Data:DataGrid x:Name="GridCustomers" MinHeight="100" MaxWidth="1000" IsReadOnly="True" AutoGenerateColumns="False"> <Data:DataGrid.Columns> <Data:DataGridTextColumn Header="First Name" Binding="{Binding Customer.FirstName}" Width="105" /> <Data:DataGridTextColumn Header="MI" Binding="{Binding Customer.MiddleName}" Width="35" /> <Data:DataGridTextColumn Header="Last Name" Binding="{Binding Customer.LastName}" Width="105"/> <Data:DataGridTextColumn Header="Address1" Binding="{Binding Contact.Address1}" Width="130"/> <Data:DataGridTextColumn Header="Address2" Binding="{Binding Contact.Address2}" Width="130"/> <Data:DataGridTextColumn Header="City" Binding="{Binding Contact.City}" Width="110"/> <Data:DataGridTextColumn Header="State" Binding="{Binding Contact.State}" Width="50"/> <Data:DataGridTextColumn Header="Zip" Binding="{Binding Contact.Zip}" Width="45"/> <Data:DataGridTextColumn Header="Home" Binding="{Binding Contact.PhoneHome}" Width="85"/> <Data:DataGridTextColumn Header="Cell" Binding="{Binding Contact.PhoneCell}" Width="85"/> <Data:DataGridTextColumn Header="Email" Binding="{Binding Contact.Email}" Width="118"/> </Data:DataGrid.Columns> </Data:DataGrid> <DataForm:DataForm x:Name="CustomerDetails" Header="Customer Details" AutoGenerateFields="False" AutoEdit="False" AutoCommit="False" CommandButtonsVisibility="Edit" Width="1000" Margin="0,5,0,0"> <DataForm:DataForm.EditTemplate> </DataForm:DataForm.EditTemplate> </DataForm:DataForm> And here is my code behind public Customers() { InitializeComponent(); BusyDialogIndicator.IsBusy = true; Loaded += new RoutedEventHandler(Customers_Loaded); CustomerDetails.BeginningEdit += new EventHandler(CustomerDetails_BeginningEdit); } void CustomerDetails_BeginningEdit(object sender, System.ComponentModel.CancelEventArgs e) { CustomerContacts.CustomerContactPaged.EditItem(CustomerDetails.CurrentItem); } private void Customers_Loaded(object sender, RoutedEventArgs e) { CustomerContacts = new CustomerContactLinks(); CustomerContacts.GetAll(); GridCustomers.ItemsSource = CustomerContacts.CustomerContactPaged; GridCustomerPager.Source = CustomerContacts.CustomerContactPaged; GridCustomers.SelectionChanged += new SelectionChangedEventHandler(GridCustomers_SelectionChanged); BusyDialogIndicator.IsBusy = false; } void GridCustomers_SelectionChanged(object sender, SelectionChangedEventArgs e) { CustomerDetails.CurrentItem = GridCustomers.SelectedItem as CustomerContactLink; } private void SaveChanges_Click(object sender, RoutedEventArgs e) { if (WebContext.Current.User.IsAuthenticated) { bool commited = CustomerDetails.CommitEdit(); if (commited && (!CustomerDetails.IsItemChanged && CustomerDetails.IsItemValid)) { CustomerContacts.Update(CustomerDetails.CurrentItem as CustomerContactLink); CustomerContacts.ctx.SubmitChanges(); CustomerContacts.CustomerContactPaged.CommitEdit(); CustomerContacts.CustomerContactPaged.Refresh(); (GridCustomers.ItemsSource as PagedCollectionView).Refresh(); } } }

    Read the article

  • IDispatchMessageInspector to log plain-text soap messages?

    - by Dan Thomas
    I've written a WCF IDispatchMessageInspector, so I can log incomming and outgoing messages. But I'm not sure how to get a nicely-formatted XML string to log. My code looks something like this: public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) { MessageBuffer buffer = request.CreateBufferedCopy(Int32.MaxValue); request = buffer.CreateMessage(); Log("Received", request.ToString(); return null; } The result of this logging includes things like "ampersand lt;" and some sort of binary-encoded data. How do I get something that looks like a standard soap XML document? I know this should be obvious, but I'm just too dense to figure it out. Thanks. Dan

    Read the article

  • C++ forward declaration problem

    - by Thomas
    Hi, I have a header file that has some forward declarations but when I include the header file in the implementation file it gets included after the includes for the previous forward declarations and this results in an error like this. error: using typedef-name ‘std::ifstream’ after ‘class’ /usr/include/c++/4.2.1/iosfwd:145: error: ‘std::ifstream’ has a previous declaration. Whats the norm for working around this? Thanks in advance.

    Read the article

  • Is it possible to exclude some files from checkin (TFS) ?

    - by Thomas Wanner
    We use configuration files within various projects under source control (TFS), where each developer has to make some adjustments in his local copy to configure his environment. The build process takes care about replacing the config files with the server configuration as a part of the deployment, so it doesn't actually matter what is in the repository. However, we would anyway like to keep some kind of a default non-breaking version of config files in the repository, so that e.g. people not involved in the particular project won't run into troubles because of local misconfiguration. We tried to resolve this by introducing the check-in policy that simply forbids to check-in the config files. This works fine, but just because we're lazy to always uncheck those checkboxes in the pending changes window, the question comes : is it possible to transparently disable the check-in of particular files without keeping them out of source control (e.g. locking their current version) ?

    Read the article

  • Where to start on creating finger swipe navigation trough a list.

    - by Thomas Stock
    Lets say I want to make a control to select any integer number by dragging on a "bar" with numbers: (156 is selected) Mousedown on "159" and dragging towards the left and then doing mouseup changes the control to this: (160 is selected) I've been experimenting for the past 3 hours but I'm inexperienced in Silverlight so I'm having problems getting started. My current guess is I should seperate this into 2 steps: Step 1: Build this control without swiping behavior. Just 2 buttons to go up a number or go down a number Step 2: Replace the buttons by handling mouse events. With my limited knowledge I think I would manage building a crappy control that does this, with very messy xaml and c# and lots of headaches when trying to apply styling and fancy state transitions, but I was hoping some xaml wizards could get me started with the basic approach? Edit: This is an implementation of what I'm trying to achieve in Silverlight: Iphone's datepicker:

    Read the article

  • Bash: Check if file was modified since used in script

    - by Thomas Münz
    I need to check in a script if a file was modified since I read it (another application can modify it in between). According to bash manual there is a "-N" test which should report if a file was modified since last read. I tried it in a small script but it seems like it doesn't work. #!/bin/bash file="test.txt" echo "test" > $file cat $file; if [ -N $file ]; then echo "modified since read"; else echo "not modified since read"; fi I also tried an alternative way by touching another file and using if [ "file1" -nt "file2 ]; but this works only on a seconds accuracy which may under rare conditions not be sufficient. Is there any other bash-inbuilt solution for this problem or I do really need to use diff or md5sum?

    Read the article

  • Adding a imageview to child elements in a expandable list query

    - by Thomas Millin
    I am looking to find out how to assign an image to a imageview in each child of an expandable list. If anyone has any information or links to find out how to do this I would be most appreciative. expListAdapter = new SimpleExpandableListAdapter( main.this, createGroupList(), R.layout.parentnode, new String[] { "day", "number" }, new int[] { R.id.TextView01, R.id.TextView02 }, createChildList(), R.layout.child_row, new String[] { "image", "childName", "date"}, new int[] { R.id.ImageView01, R.id.childname, R.id.date } ); setListAdapter( expListAdapter ); is what my adapter looks like at the moment, I have very little experience in customising adapters so I do not know where to start. Any help would be great :D

    Read the article

  • Java: Stopping a thread that has run for too long?

    - by Thomas King
    Say I've got something like this public void run(){ Thread behaviourThread = new Thread(abstractBehaviours[i]); behaviourThread.start(); } And I want to wait until abstractBehaviours[i] run method has either finished or run for 5000 milliseconds. How do I do that? behaviourThread.join(5000) doesn't seem to do that afaik (something is wrong with my code and I've put it down to that). All the abstract abstractBehaviour class is of course Runnable. I don't want to implement it inside each run method as that seems ugly and there are many different behaviours, I'd much rather have it in the calling/executing thread and do it just once. Solutions? First time doing something as threaded as this. Thanks!

    Read the article

  • Designing small comparable objects

    - by Thomas Ahle
    Intro Consider you have a list of key/value pairs: (0,a) (1,b) (2,c) You have a function, that inserts a new value between two current pairs, and you need to give it a key that keeps the order: (0,a) (0.5,z) (1,b) (2,c) Here the new key was chosen as the average between the average of keys of the bounding pairs. The problem is, that you list may have milions of inserts. If these inserts are all put close to each other, you may end up with keys such to 2^(-1000000), which are not easily storagable in any standard nor special number class. The problem How can you design a system for generating keys that: Gives the correct result (larger/smaller than) when compared to all the rest of the keys. Takes up only O(logn) memory (where n is the number of items in the list). My tries First I tried different number classes. Like fractions and even polynomium, but I could always find examples where the key size would grow linear with the number of inserts. Then I thought about saving pointers to a number of other keys, and saving the lower/greater than relationship, but that would always require at least O(sqrt) memory and time for comparison. Extra info: Ideally the algorithm shouldn't break when pairs are deleted from the list.

    Read the article

  • How to display configurable product in each color in product listing?

    - by Thomas
    I have a configurable product which is available in many different colors and sizes. I want the configurable product to appear once for every color. My idea is to assign one simple product of the configurable product in every color to the category of the configurable product. Then I want to change the listing, so that the (colored) simple product links to it's master product (the configurable one). The other way would be, to just assign the configurable product to a category and then list it multiple times with different colors. But I think this would be to complicated.

    Read the article

  • firefox extension help

    - by Thomas
    Hi all, I am developing a firefox extension which needs to add some html on the page it runs. This element I will be writing needs to be decorated with css and also load some images. I have both the css file and the images in the plugin, but I do not know how to reference them. Do I need to insert the css file to the page I want to modify? In the css file how can I reference the images that are in the extensions? Thanks

    Read the article

  • Class template specializations with shared functionality

    - by Thomas
    I'm writing a simple maths library with a template vector type: template<typename T, size_t N> class Vector { public: Vector<T, N> &operator+=(Vector<T, N> const &other); // ... more operators, functions ... }; Now I want some additional functionality specifically for some of these. Let's say I want functions x() and y() on Vector<T, 2> to access particular coordinates. I could create a partial specialization for this: template<typename T> class Vector<T, 3> { public: Vector<T, 3> &operator+=(Vector<T, 3> const &other); // ... and again all the operators and functions ... T x() const; T y() const; }; But now I'm repeating everything that already existed in the generic template. I could also use inheritance. Renaming the generic template to VectorBase, I could do this: template<typename T, size_t N> class Vector : public VectorBase<T, N> { }; template<typename T> class Vector<T, 3> : public VectorBase<T, 3> { public: T x() const; T y() const; }; However, now the problem is that all operators are defined on VectorBase, so they return VectorBase instances. These cannot be assigned to Vector variables: Vector<float, 3> v; Vector<float, 3> w; w = 5 * v; // error: no conversion from VectorBase<float, 3> to Vector<float, 3> I could give Vector an implicit conversion constructor to make this possible: template<typename T, size_t N> class Vector : public VectorBase<T, N> { public: Vector(VectorBase<T, N> const &other); }; However, now I'm converting from Vector to VectorBase and back again. Even though the types are the same in memory, and the compiler might optimize all this away, it feels clunky and I don't really like to have potential run-time overhead for what is essentially a compile-time problem. Is there any other way to solve this?

    Read the article

  • Setting jvmargs in log4j.properties file

    - by Thomas
    Hey This is a bit of a weird request but I am trying to set some jvmargs in the log4j.properties file. At present I use ant to for example set some args.... jvmarg value="-Dmail.smtp.socketFactory.port=465" ... but it would be great to group a few of these logging relevant arguments into the .properties file. Does anyone know how to do this? Thanks in advance!

    Read the article

  • Implicit parameter in Scalaz

    - by Thomas Jung
    I try to find out why the call Ø in scalaz.ListW.<^> works def <^>[B: Zero](f: NonEmptyList[A] => B): B = value match { case Nil => Ø case h :: t => f(Scalaz.nel(h, t)) } My minimal theory is: trait X[T]{ def y : T } object X{ implicit object IntX extends X[Int]{ def y = 42 } implicit object StringX extends X[String]{ def y = "y" } } trait Xs{ def ys[T](implicit x : X[T]) = x.y } class A extends Xs{ def z[B](implicit x : X[B]) : B = ys //the call Ø } Which produces: import X._ scala> new A().z[Int] res0: Int = 42 scala> new A().z[String] res1: String = y Is this valid? Can I achieve the same result with fewer steps?

    Read the article

  • How to write in an file in MSIL code

    - by Thomas
    Hi all, I have a aspx webpage which uses an assembly mine (which mades a custom authentification). I would like to modify MSIL code (so just with ILDASM/ILASM tools) of my assembly in order to log something in a file. I have tried to add this at the end of the authentification method of my assembly : IL_0034: ldstr "C:\\path_to_my_website\\log.txt" IL_0039: newobj instance void [mscorlib]System.IO.StreamWriter::.ctor(string) IL_003e: stloc.1 IL_003f: ldloc.1 IL_0040: ldstr "test" IL_0045: callvirt instance void [mscorlib]System.IO.TextWriter::Write(string) IL_004a: nop IL_004b: ldloc.1 IL_004c: callvirt instance void [mscorlib]System.IO.TextWriter::Close() IL_0051: nop ILASM does not find any error, and the CLR does not throw any exception at runtime, but the file is not created or modified ! :( Any idea ?

    Read the article

  • Multi-Select Dropdown with size of 1

    - by Thomas
    Is there any way of creating a combo box (<select>) with a size of 1? All the examples I can find allow for multiple selects but with a number of options visible at any one time. If this cannot be accomplished with bog standard HTML is it possible in a JS library such as JQuery?

    Read the article

  • JavaScript tags, performance and W3C

    - by Thomas
    Today I was looking for website optimization content and I found an article talking about move JavaScript scripts to the bottom of the HTML page. Is this valid with W3C's recommendations? I learned that all JavaScript must be inside of head tag... Thank you.

    Read the article

  • Typed DefaultListModel to avoid casting

    - by Thomas R.
    Is there a way in java to have a ListModel that only accepts a certain type? What I'm looking for is something like DefaultListModel<String> oder TypedListModel<String>, because the DefaultListModel only implements addElement(Object obj) and get(int index) which returns Object of course. That way I always have to cast from Object to e.g. String and there is no guarantee that there are only strings in my model, even though I'd like to enforce that. Is this a flaw or am I using list models the wrong way?

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >