Search Results

Search found 8286 results on 332 pages for 'defined'.

Page 63/332 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • How do I bind one TabControl to the TabItems of another TabControl in WPF?

    - by joebeazelman
    I've defined the following TabControl called TabControl1: <TabControl> <TabItem Header="Cheese"> The Cheese Tab </TabItem> <TabItem Header="Pepperoni"> The Pepperoni Tab </TabItem> <TabItem Header="Mushrooms"> The Mushrooms Tab </TabItem> </TabControl> I've defined another TabControl, TabControl2 which is dynamically loaded from an add-in or plugin: <TabControl> <TabItem Header="Anchovies"> The AnchoviesTab </TabItem> <TabItem Header="Jalepenos"> The Jalepenos Tab </TabItem> <TabItem Header="Rattle Snake"> The Rattle Snake Tab </TabItem> </TabControl> After TabControl1 binds to TabControl2 after the "Cheese" item, TabControl1 should look like this: <TabControl> <TabItem Header="Cheese"> The Cheese Tab </TabItem> <TabItem Header="Anchovies"> The AnchoviesTab </TabItem> <TabItem Header="Jalepenos"> The Jalepenos Tab </TabItem> <TabItem Header="Rattle Snake"> The Rattle Snake Tab </TabItem> <TabItem Header="Pepperoni"> The Pepperoni Tab </TabItem> <TabItem Header="Mushrooms"> The Mushrooms Tab </TabItem> </TabControl>

    Read the article

  • Array: mathematical sequence

    - by VaioIsBorn
    An array of integers A[i] (i 1) is defined in the following way: an element A[k] ( k 1) is the smallest number greater than A[k-1] such that the sum of its digits is equal to the sum of the digits of the number 4* A[k-1] . You need to write a program that calculates the N th number in this array based on the given first element A[1] . INPUT: In one line of standard input there are two numbers seperated with a single space: A[1] (1 <= A[1] <= 100) and N (1 <= N <= 10000). OUTPUT: The standard output should only contain a single integer A[N] , the Nth number of the defined sequence. Input: 7 4 Output: 79 Explanation: Elements of the array are as follows: 7, 19, 49, 79... and the 4th element is solution. I tried solving this by coding a separate function that for a given number A[k] calculates the sum of it's digits and finds the smallest number greater than A[k-1] as it says in the problem, but with no success. The first testing failed because of a memory limit, the second testing failed because of a time limit, and now i don't have any possible idea how to solve this. One friend suggested recursion, but i don't know how to set that. Anyone who can help me in any way please write, also suggest some ideas about using recursion/DP for solving this problem. Thanks.

    Read the article

  • vestal_versions : problem with column named changes

    - by arkannia
    Hi, I am working with vestal version for 2 months. Everything was fine until this afternoon. I didn't done anything special(or i don't remembered...) but the code works fine on others computers... The problem is that i'm not able to save my model anymore: rails give me this error : ActiveRecord::DangerousAttributeError: changes is defined by ActiveRecord changes field is by default an activerecord method. With the console, the message is the next : ActiveRecord::DangerousAttributeError: changes is defined by ActiveRecord Here are my local gem files: abstract (1.0.0) actionmailer (3.0.0.beta3) actionpack (3.0.0.beta3) activemodel (3.0.0.beta3) activerecord (3.0.0.beta3) activeresource (3.0.0.beta3) activesupport (3.0.0.beta3) arel (0.3.3) builder (2.1.2) bundler (0.9.25, 0.9.24) crack (0.1.7) erubis (2.6.5) god (0.9.0) haml (3.0.1, 2.2.23) i18n (0.3.7) mail (2.2.0) memcache-client (1.8.3) memcached (0.17.7) mime-types (1.16) polyglot (0.3.1) rack (1.1.0) rack-mount (0.6.3) rack-test (0.5.3) rails (3.0.0.beta3) railties (3.0.0.beta3) rake (0.8.7) savon (0.7.8, 0.7.6) text-format (1.0.0) text-hyphen (1.0.0) thor (0.13.6, 0.13.4) treetop (1.4.5) tzinfo (0.3.20) And here my Gemfile source 'http://gemcutter.org' gem "rails", "3.0.0.beta3" gem "will_paginate", "3.0.pre" #gem 'nokogiri' #gem 'curb' #gem 'handsoap' gem 'savon' gem 'mysql' gem 'haml', '2.2.23' #gem 'haml', '3.0.1' gem 'hpricot' gem 'i18n', '> 0.3.5' gem 'i18n_routing' gem 'i18n_auto_scoping' gem 'handler301', :git => 'http://github.com/kwi/handler301.git' gem 'seo_meta_builder' gem 'vestal_versions' #gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git', :branch => 'rails3' ## Bundle edge rails: gem "rails", :git => "git://github.com/rails/rails.git" ## Bundle the gems you use: # gem "bj" # gem "hpricot", "0.6" # gem "sqlite3-ruby", :require => "sqlite3" # gem "aws-s3", :require => "aws/s3" ## Bundle gems used only in certain environments: # gem "rspec", :group => :test # group :test do # gem "webrat" # end If you have any suggestions to solve this issue, i'll be glad to hear them ! Thanks

    Read the article

  • Removing a fields from a dynamic ModelForm

    - by Jérôme Pigeot
    In a ModelForm, i have to test user permissions to let them filling the right fields : It is defined like this: class TitleForm(ModelForm): def __init__(self, user, *args, **kwargs): super(TitleForm,self).__init__(*args, **kwargs) choices = [] # company if user.has_perm("myapp.perm_company"): self.fields['company'] = forms.ModelChoiceField(widget=forms.HiddenInput(), queryset=Company.objects.all(), required=False) choices.append('Company') # association if user.has_perm("myapp.perm_association") self.fields['association'] = forms.ModelChoiceField(widget=forms.HiddenInput(), queryset=Association.objects.all(), required=False) choices.append('Association') # choices self.fields['type_resource'] = forms.ChoiceField(choices = choices) class Meta: Model = Title This ModelForm does the work : i hide each field on the template and make them appearing thanks to javascript... The problem is this ModelForm is that each field defined in the model will be displayed on the template. I would like to remove them from the form if they are not needed: exemple : if the user has no right on the model Company, it won't be used it in the rendered form in the template. The problem of that is you have to put the list of fields in the Meta class of the form with fields or exclude attribute, but i don't know how to manage them dynamically. Any Idea?? Thanks by advance for any answer.

    Read the article

  • WPF: How to data bind an object to an element and apply a data template through code?

    - by Boris
    I have created a class LeagueMatch. public class LeagueMatch { public string Home { get { return home; } set { home = value; } } public string Visitor { get { return visitor; } set { visitor = value; } } private string home; private string visitor; public LeagueMatch() { } } Next, I have defined a datatemplate resource for LeagueMatch objects in XAML: <DataTemplate x:Key="MatchTemplate" DataType="{x:Type entities:LeagueMatch}"> <Grid Name="MatchGrid" Width="140" Height="50" Margin="5"> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="*" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <TextBlock Grid.Row="0" Text="{Binding Home}" /> <TextBlock Grid.Row="1" Text="- vs -" /> <TextBlock Grid.Row="2" Text="{Binding Visitor}" /> </Grid> </DataTemplate> In the XAML code-behind, I want to create a ContentPresenter object and to set it's data binding to a previously initialized LeagueMatch object and apply the defined data template. How is that supposed to be done? Thanks.

    Read the article

  • express+jade: provided local variable is undefined in view (node.js + express + jade)

    - by Jake
    Hello. I'm implementing a webapp using node.js and express, using the jade template engine. Templates render fine, and can access helpers and dynamic helpers, but not local variables other than the "body" local variable, which is provided by express and is available and defined in my layout.jade. This is some of the code: app.set ('view engine', 'jade'); app.get ("/test", function (req, res) { res.render ('test', { locals: { name: "jake" } }); }); and this is test.jade: p hello =name when I remove the second line (referencing name), the template renders correctly, showing the word "hello" in the web page. When I include the =name, it throws a ReferenceError: 500 ReferenceError: Jade:2 NaN. 'p hello' NaN. '=name' name is not defined NaN. 'p hello' NaN. '=name' I believe I'm following the jade and express examples exactly with respect to local variables. Am I doing something wrong, or could this be a bug in express or jade?

    Read the article

  • Python metaclass for enforcing immutability of custom types

    - by Mark Lehmacher
    Having searched for a way to enforce immutability of custom types and not having found a satisfactory answer I came up with my own shot at a solution in form of a metaclass: class ImmutableTypeException( Exception ): pass class Immutable( type ): ''' Enforce some aspects of the immutability contract for new-style classes: - attributes must not be created, modified or deleted after object construction - immutable types must implement __eq__ and __hash__ ''' def __new__( meta, classname, bases, classDict ): instance = type.__new__( meta, classname, bases, classDict ) # Make sure __eq__ and __hash__ have been implemented by the immutable type. # In the case of __hash__ also make sure the object default implementation has been overridden. # TODO: the check for eq and hash functions could probably be done more directly and thus more efficiently # (hasattr does not seem to traverse the type hierarchy) if not '__eq__' in dir( instance ): raise ImmutableTypeException( 'Immutable types must implement __eq__.' ) if not '__hash__' in dir( instance ): raise ImmutableTypeException( 'Immutable types must implement __hash__.' ) if _methodFromObjectType( instance.__hash__ ): raise ImmutableTypeException( 'Immutable types must override object.__hash__.' ) instance.__setattr__ = _setattr instance.__delattr__ = _delattr return instance def __call__( self, *args, **kwargs ): obj = type.__call__( self, *args, **kwargs ) obj.__immutable__ = True return obj def _setattr( self, attr, value ): if '__immutable__' in self.__dict__ and self.__immutable__: raise AttributeError( "'%s' must not be modified because '%s' is immutable" % ( attr, self ) ) object.__setattr__( self, attr, value ) def _delattr( self, attr ): raise AttributeError( "'%s' must not be deleted because '%s' is immutable" % ( attr, self ) ) def _methodFromObjectType( method ): ''' Return True if the given method has been defined by object, False otherwise. ''' try: # TODO: Are we exploiting an implementation detail here? Find better solution! return isinstance( method.__objclass__, object ) except: return False However, while the general approach seems to be working rather well there are still some iffy implementation details (also see TODO comments in code): How do I check if a particular method has been implemented anywhere in the type hierarchy? How do I check which type is the origin of a method declaration (i.e. as part of which type a method has been defined)?

    Read the article

  • Authlogic Current User Question - hiding admin links...

    - by bgadoci
    I think I am missing something while using the Authlogic gem w/ Rails. To set the stage I have multiple users and each user can create posts and comments. Upon the display of a post or comment I would like to give the user who created them the option to edit or destroy. I am successfully using the following code to hide and show elements based on if a user is logged in or not but can't seem to find out how to only show these links to the actual user who created them...not any user that is logged in. <% if current_user %> <%= link_to 'Edit', edit_question_path(question) %> | <%= link_to 'Destroy', question, :confirm => 'Are you sure?', :method => :delete %> <% else %> <p>nothing to see here</p> <% end %> Here is the def of current_user located in the application controller in case I need to change something here. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time protect_from_forgery # See ActionController::RequestForgeryProtection for details# helper_method :current_user private def current_user_session return @current_user_session if defined?(@current_user_session) @current_user_session = UserSession.find end def current_user return @current_user if defined?(@current_user) @current_user = current_user_session && current_user_session.record end end

    Read the article

  • Passing VB Callback function to C dll - noob is stuck.

    - by WaveyDavey
    Callbacks in VB (from C dll). I need to pass a vb function as a callback to a c function in a dll. I know I need to use addressof for the function but I'm getting more and more confused as to how to do it. Details: The function in the dll that I'm passing the address of a callback to is defined in C as : PaError Pa_OpenStream( PaStream** stream, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate, unsigned long framesPerBuffer, PaStreamFlags streamFlags, PaStreamCallback *streamCallback, void *userData ); where the function is parameter 7, *streamCallback. The type PaStreamCallback is defines thusly: typedef int PaStreamCallback( const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags, void *userData ); In my vb project I have: Private Declare Function Pa_OpenStream Lib "portaudio_x86.dll" _ ( ByVal stream As IntPtr _ , ByVal inputParameters As IntPtr _ , ByVal outputParameters As PaStreamParameters _ , ByVal samprate As Double _ , ByVal fpb As Double _ , ByVal paClipoff As Long _ , ByVal patestCallBack As IntPtr _ , ByVal data As IntPtr) As Integer (don't worry if I've mistyped some of the other parameters, I'll get to them later! Let's concentrate on the callback for now.) In module1.vb I have defined the callback function: Function MyCallback( ByVal inp As Byte, _ ByVal outp As Byte, _ ByVal framecount As Long, _ ByVal pastreamcallbacktimeinfo As Byte, _ ByVal pastreamcallbackflags As Byte, _ ByVal userdata As Byte) As Integer ' do clever things here End Function The external function in the dll is called with err = Pa_OpenStream( ptr, _ nulthing, _ outputParameters, _ SAMPLE_RATE, _ FRAMES_PER_BUFFER, _ clipoff, _ AddressOf MyCallback, _ dataptr) This is broken in the declaration of the external function - it doesn't like the type IntPtr as a function pointer for AddressOf. Can anyone show me how to implement passing this callback function please ? Many thanks David

    Read the article

  • Yacc and Lex inclusion confusion

    - by thejohnmeister
    I am wondering how to correctly compile a program with a Makefile that has calls to yyparse in it? This is what I do: I have a Makefile that compiles all my regular files and they have no connections to y.tab.c or lex.yy.c (Am I supposed to have them?) I do this on top of my code: #include "y.tab.c" #include "lex.yy.c" #include "y.tab.h" This is what happens when I try to make the program: When I just type in "make", it gives me many warnings. Some of the examples are shown below. In function yywrap': /src/parser.y:12: multiple definition ofyywrap' server.o :/src/parser.y:12: first defined here utils.o: In function yyparse': /src/y.tab.c:1175: multiple definition ofyyparse' server.o:/src/y.tab.c:1175: first defined here utils.o I get many different errors referring to different yy_* files. I have compiled successfully with multiple calls to yyparse in the past, but this time seems to be different. It seems an awful lot like an inclusion problem somewhere but I can't tell what it is. All my header files have ifndef conditions, as well. Thanks for your help!

    Read the article

  • How to solve non-linear equations using python

    - by stars83clouds
    I have the following code: #!/usr/bin/env python from scipy.optimize import fsolve import math h = 6.634e-27 k = 1.38e-16 freq1 = 88633.9360e6 freq2 = 88631.8473e6 freq3 = 88630.4157e6 def J(freq,T): return (h*freq/k)/(math.exp(h*freq/(k*T))-1) def equations(x,y,z,w,a,b,c,d): f1 = a*(J(freq1,y)-J(freq1,2.73))*(1-math.exp(-a*z))-(J(freq2,x)-J(freq2,2.73))*(1-math.exp(-z)) f2 = b*(J(freq3,w)-J(freq3,2.73))*(1-math.exp(-b*z))-(J(freq2,x)-J(freq2,2.73))*(1-math.exp(-z)) f3 = c*(J(freq3,w)-J(freq3,2.73))*(1-math.exp(-b*z))-(J(freq1,y)-J(freq1,2.73))*(1-math.exp(-a*z)) f4 = d*(J((freq3+freq1)/2,(y+w)/2)-J((freq3+freq1)/2,2.73))-(J(freq2,x)-J(freq2,2.73))*(1-math.exp(-z)) return (f1,f2,f3,f4) So, I have defined the equations in the above code. However, I now wish to solve the above set of equations using fsolve or other alternative non-linear numerical routine. I tried the following syntax but with no avail: x,y,z,w = fsolve(equations, (1,1,1,1)) I keep getting the error that "x" is not defined. I am executing all commands at the command-line, since I have no idea how to run a batch of commands as above automatically in python. I welcome any advice on how to solve this.

    Read the article

  • What is the best practice for using lock within inherited classes

    - by JDMX
    I want to know if one class is inheriting from another, is it better to have the classes share a lock object that is defined at the base class or to have a lock object defined at each inheritance level. A very simple example of a lock object on each level of the class public class Foo { private object thisLock = new object(); private int ivalue; public int Value { get { lock( thisLock ) { return ivalue; } } set { lock( thisLock ) { ivalue= value; } } } } public class Foo2: Foo { private object thisLock2 = new object(); public int DoubleValue { get { lock( thisLock2 ) { return base.Value * 2; } } set { lock( thisLock2 ) { base.Value = value / 2; } } } } public class Foo6: Foo2 { private object thisLock6 = new object(); public int TripleDoubleValue { get { lock( thisLock6 ) { return base.DoubleValue * 3; } } set { lock( thisLock6 ) { base.DoubleValue = value / 3; } } } } A very simple example of a shared lock object public class Foo { protected object thisLock = new object(); private int ivalue; public int Value { get { lock( thisLock ) { return ivalue; } } set { lock( thisLock ) { ivalue= value; } } } } public class Foo2: Foo { public int DoubleValue { get { lock( thisLock ) { return base.Value * 2; } } set { lock( thisLock ) { base.Value = value / 2; } } } } public class Foo6: Foo2 { public int TripleDoubleValue { get { lock( thisLock ) { return base.DoubleValue * 3; } } set { lock( thisLock ) { base.DoubleValue = value / 3; } } } } Which example is the preferred way to manage locking within an inherited class?

    Read the article

  • C# Thread-safe Extension Method

    - by Wonko the Sane
    Hello All, I may be waaaay off, or else really close. Either way, I'm currently SOL. :) I want to be able to use an extension method to set properties on a class, but that class may (or may not) be updated on a non-UI thread, and derives from a class the enforces updates to be on the UI thread (which implements INotifyPropertyChanged, etc). I have a class defined something like this: public class ClassToUpdate : UIObservableItem { private readonly Dispatcher mDispatcher = Dispatcher.CurrentDispatcher; private Boolean mPropertyToUpdate = false; public ClassToUpdate() : base() { } public Dispatcher Dispatcher { get { return mDispatcher; } } public Boolean PropertyToUpdate { get { return mPropertyToUpdate; } set { SetValue("PropertyToUpdate", ref mPropertyToUpdate, value; } } } I have an extension method class defined something like this: static class ExtensionMethods { public static IEnumerable<T> SetMyProperty<T>(this IEnumerable<T> sourceList, Boolean newValue) { ClassToUpdate firstClass = sourceList.FirstOrDefault() as ClassToUpdate; if (firstClass.Dispatcher.Thread.ManagedThreadId != System.Threading.Thread.CurrentThread.ManagedThreadId) { // WHAT GOES HERE? } else { foreach (var classToUpdate in sourceList) { (classToUpdate as ClassToUpdate ).PropertyToUpdate = newValue; yield return classToUpdate; } } } } Obviously, I'm looking for the "WHAT GOES HERE" in the extension method. Thanks, wTs

    Read the article

  • Trouble getting started with Spring Roo and GWT

    - by Abdel Olakara
    Hi all, I am trying to get started with SpringRoo and GWT after seeing the keynote.. unfortunately I am stuck at this issue. I successfully created the project using Roo and added the persistence, the entities and when I perform the command "perform package" I get this error: 23/5/10 12:10:13 AM AST: [ERROR] ApplicationEntityTypesProcessor cannot be resolved 23/5/10 12:10:13 AM AST: [ERROR] ApplicationEntityTypesProcessor cannot be resolved to a type 23/5/10 12:10:13 AM AST: [WARN] advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch] 23/5/10 12:10:13 AM AST: [WARN] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch] 23/5/10 12:10:13 AM AST: Build errors for helloroo; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.0:compile (default) on project helloroo: Compiler errors : error at import tp.gwt.request.ApplicationEntityTypesProcessor; I see this in the Maven console and cannot complete the build..I know there is some jar missing but how and why? because I downloaded all the latest version including GWT milestone release. Any idea why this error is occurring? How do I resolve this issue? Thanks in Advance, Abdel Olakara

    Read the article

  • GWT CssResource Customization

    - by Eric Landry
    I'm writing a GWT widget using UIBinder and MVP. The widget's default styles are defined in TheWidgetView.ui.xml: <ui:style type="com.widgetlib.spinner.display.TheWidgetView.MyStyle"> .textbox { border: 1px solid #red; } .important { font-weight: bold; } </ui:style> The widget's CssResource interface is defined in TheWidgetView.java: public class TheWidgetView extends HorizontalPanel implements TheWidgetPresenter.Display { // ... some code @UiField MyStyle style; public interface MyStyle extends CssResource { String textbox(); String important(); } // ... more code } I'd like the consumer of this widget to be able to customize part of the widget's styles and to have this in their MyExample.ui.xml: <ui:style type="com.consumer.MyExample.MyStyle"> .textbox { border: 2px solid #black; } </ui:style> And this be their MyExample.java: public class MyExample extends Composite { // ... some code @UiField MyStyle style; interface MyStyle extends TheWidgetView.MyStyle{ String textbox(); } // ... more code } Is there a way that my widget can have default styles, but that the consumer of the widget can override one of them? When an interface extends TheWidgetView.MyStyle, the of the widget consumer needs to define all the styles listed in that parent interface. I've seen some widget libraries have the widget's constructor take in a ClientBundle as parameter, which I suppose could apply to CssResource. Although, I'm not sure how I'd pass in this style object in a constructor invoked by UIBinder. Thanks much in advance!

    Read the article

  • Set Server Side OnClick() event Programmatically

    - by Corey O.
    I am looking for a way to programmatically set the OnClick event handler for a TableCell object. The ASP equivalent of what I'm trying to do will look like this: <asp:TableCell OnClick="clickHandler" runat="server">Click Me!</asp:TableCell> In the above example, "clickHandler" is a server-side function defined in the .cs CodeBehind. public virtual void clickHandler(object sender, EventArgs args) {...} However, for my situation, this TableCell object needs to be created dynamically, so setting it in an ASP tag is not an option. I am trying to do something like the following in the CodeBehind: System.Web.UI.WebControls.TableRow row = new System.Web.UI.WebControls.TableRow(); System.Web.UI.WebControls.TableCell cell = new System.Web.UI.WebControls.TableCell(); cell.Text = "Click Me!"; cell.Attributes.Add("onClick", "clickHandler"); row.Cells.Add(cell); Unfortunately, in this situation: cell.Attributes.Add("onClick", "clickHandler"); the "clickHandler" only works as a client-side javascript function. What I'm looking for is a way to link the server-side clickHandler() function, defined in the .cs CodeBehind, to this table cell. After an afternoon of searching, I have been unable to come up with a working solution. Thanks in advance for any help.

    Read the article

  • making java SingleFrameApplication to appear second

    - by Karel Bílek
    Sorry if this question will sound too chaotic, feel free to edit it. I have an application made entirely in netbeans, which uses SingleFrameApplication and auto-generated the GUI code, named "MyApp", and FrameView, named "MyView". Now, the MyApp somehow has the main() function, but the MyView has all the graphic elements.. I don't entirely understand how that happens, so used it as black box (it somehow created the window, I didn't have to care why). But now, I need the window to be only a window, opened by another JFrame. I don't know, how to accomplish that. MyApp, which is extending SingleFrameApplication, have these methods: public class MyApp extends SingleFrameApplication { @Override protected void startup() { show(new MyView(this)); } @Override protected void configureWindow(java.awt.Window root) { } public static MyApp getApplication() { return Application.getInstance(MyApp.class); } public static void main(String[] args) { launch(MyApp.class, args); } } MyView has these methods: public class MyView extends FrameView { public MyView(SingleFrameApplication app) { super(app); initComponents(); } private void initComponents() { //all the GUI stuff is somehow defined here } } Now, I have no clue how the two classes work, I just want this window, defined in MyView, to appear after another window, "ordinary" JFrame. How can I call this MyApp/MyView?

    Read the article

  • C question: error: expected ')' before '*' token

    - by lhw
    ===EDIT I apologize for not putting the pcb struct into the code snippet. There is a struct called pcb defined in above the two structs I originally posted. Namely, typedef struct{ UINT32 proc; struct pcb *link; }pcb; Hi, I asked a question regarding structs in C a few minutes ago and got an answer blazing fast. But now I'm facing another problem, namely the error in the title of this question. I'm trying to implement a simple priority queue in C using arrays of queues. However, when I try to declare a function on pcb_pQ structure, I get the above error. I have the structs clearly defined in the heard file. In the header file: typedef struct{ pcb *head; pcb *tail; SINT32 size; } pcb_Q; typedef struct pcb_pQ { pcb_Q queues[5]; SINT32 size; } pcb_pQ; Function prototype in header file: /*priority queue operations*/ VOID pcb_pq_enqueue(pcb_pQ*, pcb*); Function impelmentation in .c file: VOID pcb_pq_enqueue(pcb_pQ* pcb_pQ, pcb* pcb) { pcb_Q* pcb_Q_p; int priority; priority = pcb->proc_priority; pcb_Q_p = &pcb_pQ->queues[priority]; pcb_enqueue(pcb_Q_p, pcb); } When I try to compile the above code, I get an "error: expected ')' before '*' token". This error is pointing to the function signature in the .c file, namely VOID pcb_pq_enqueue(pcb_pQ* pcb_pQ, pcb* pcb) { But I am not sure why I am getting this error, could someone give me a hand? Thanks a lot.

    Read the article

  • How to set different width for INPUT and DIV elements with Scriptaculous Ajax.Autocompleter?

    - by Grzegorz Gierlik
    Hello, I am working on autocompleter box based on Scriptaculous Ajax.Autocompleter. Here how my HTML/JS code looks like: <input type="text" maxlength="255" class="input iSearchInput" name="isearch_value" id="isearch" value="<wl@txt>Search</wl@txt>" onfocus="this.select()"> <br> <div id='isearch_choices' class='iSearchChoices'></div> <script> function iSearchGetSelectedId(text, li) { console.log([text, li.innerHTML].join("\n")); document.location.href = li.getAttribute("url"); } document.observe('dom:loaded', function() { new Ajax.Autocompleter("isearch", "isearch_choices", "/url", { paramName: "phrase", minChars: 1, afterUpdateElement : iSearchGetSelectedId }); $("isearch_choices").setStyle({width: "320px"}); }); </script> and CSS classes: input.iSearchInput { width: 155px; height: 26px; margin-top: 7px; line-height: 20px; } div.iSearchChoices { position:absolute; background-color:white; border:1px solid #888; margin:0; padding:0; width: 320px; } It works in general, but I need to have list of choices wider then input box. My first try was to set various width with CSS classes (like above), but it didn't work -- list of choices became as wide as input box. According to Firebug width defined by my CSS class was overwritten by width set by element.style CSS class, which seems to be defined by Ajax.Autocompleter. My second try was to set width for list of choices after creating Ajax.Autocompleter $("isearch_choices").setStyle({width: "320px"}); but it didn't work too :(. No more ideas :(. How to set different width for list of choices for Scriptaculous Ajax.Autocompleter?

    Read the article

  • Range-based `for` statement definition redundancy

    - by GMan - Save the Unicorns
    Looking at n3092, in §6.5.4 we find the equivalency for a range-based for loop. It then goes on to say what __begin and __end are equal to. It differentiates between arrays and other types, and I find this redundant (aka, confusing). It says for arrays types that __begin and __end are what you expect: a pointer to the first and a pointer to one-past the end. Then for other types, __begin and __end are equal to begin(__range) and end(__range), with ADL. Namespace std is associated, in order to find the std::begin and std::end defined in <iterator>, §24.6.5. However, if we look at the definition of std::begin and std::end, they are both defined for arrays as well as container types. And the array versions do exactly the same as above: pointer to the first, pointer to one-past the end. Why is there a need to differentiate arrays from other types, when the definition given for other types would work just as well, finding std::begin and std::end? Some abridged quotes for convenience: §24.6.5 The range-based for statement — if _RangeT is an array type, begin-expr and end-expr are __range and __range + __bound, respectively, where __bound is the array bound. If _RangeT is an array of unknown size or an array of incomplete type, the program is ill-formed. — otherwise, begin-expr and end-expr are begin(_range) and end(_range), respectively, where begin and end are looked up with argument-dependent lookup (3.4.2). For the purposes of this name lookup, namespace std is an associated namespace. and §24.6.5 range access template T* begin(T (&array)[N]); Returns: array. template T* end(T (&array)[N]); Returns: array + N.

    Read the article

  • Loading a UITableView From A Nib

    - by Garry
    Hi, I keep getting a crash when loading a UITableView. I am trying to use a cell defined in a nib file. I have an IBOutlet defined in the view controller header file: UITableViewCell *jobCell; @property (nonatomic, assign) IBOutlet UITableViewCell *jobCell; This is synthesised in the implementation file. I have a UITableViewCell created in IB and set it's identifier to JobCell. Here is the cellForRowAtIndexPath method: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"JobCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"JobsRootViewController" owner:self options:nil]; cell = jobCell; self.jobCell = nil; } // Get this job Job *job = [fetchedResultsController objectAtIndexPath:indexPath]; // Job title UILabel *jobTitle; jobTitle = (UILabel *)[cell viewWithTag:tagJobTitle]; jobTitle.text = job.title; // Job due date UILabel *dueDate; dueDate = (UILabel *)[cell viewWithTag:tagJobDueDate]; dueDate.text = [self.dateFormatter stringFromDate:job.dueDate]; // Notes icon UIImageView *notesImageView; notesImageView = (UIImageView *)[cell viewWithTag:tagNotesImageView]; if ([job.notes length] > 0) { // This job has a note attached to it - show the notes icon notesImageView.hidden = NO; } else { // Hide the notes icon notesImageView.hidden = YES; } // Job completed button // Return the cell return cell; } When I run the app - I get a hard crash and the console reports the following: objc[1291]: FREED(id): message style sent to freed object=0x4046400 I have hooked up all the outlets in IB correctly. What is the issue? Thanks,

    Read the article

  • using alias parameters in window command prompt

    - by freshWoWer
    Source:http://jpsoft.com/help/index.htm?alias.htm Aliases can use command line parameters or parameters like those in batch files. The command line parameters are numbered from %0 to %511. (%0 contains the alias name.) For example, the following alias will change directories, perform a command, and return to the original directory: alias in pushd %1 & %2$ & popd when i run the above, my command prompt gives error saying %1 * Unable to read value of alias * '%2' is not recognized as an internal or external command, operable program or batch file. 'popd`' is not recognized as an internal or external command, operable program or batch file. if you use double quote instead, alias in "pushd %1 & dir & popd" it doesn't interprets the %1 when you execute the alias C:\abc\defalias Dumping all defined aliases for CMD.EXE. in =pushd %1 & dir & popd alias def wont work ---------EDIT------------ let me try some sample output with a simple echo alias D:\abc\defalias /? Usage: ALIAS [-v] [-p programName] [-f filespec] [ ] [-v] means verbose output. [-d] means delete aliases. [-p programName] specifies which image file name these alias definitions are for. Default is CMD.EXE [-f filespec] specifies a file which contains the alises. C:\Office\dev15alias out 'echo %1' %1' * Unable to read value of alias * C:\Office\dev15alias out backtick echo %1 backtick %1` * Unable to read value of alias * C:\Office\dev15alias out "echo %1" C:\Office\dev15alias Dumping all defined aliases for CMD.EXE. out =echo %1 C:\Office\dev15out abc %1 C:\Office\dev15alias out echo %1 %1 * Unable to read value of alias * C:\Office\dev15out abc ECHO is on. Problem is, both single quote and back tick produces error, while double quote wont treat %1 as variable parameter

    Read the article

  • Add new types to Go

    - by nevalu
    I'm trying add new types for that been managed/used as in Go core types. To create new types is anything very interesting to validate data before of send it to a non-SQL DBMS or to check data from a form. Go uses univeral constants to define them at global level: var DateType = universe.DefineType("date", universePos, &dateType{}) In this case they're defined to be called from a package like types: var Date = &dateType{} I get these errors: test.go:58: o.lit undefined (cannot refer to unexported field lit) test.go:62: *dateType is not Type missing Pos() token.Position The code is based on: http://github.com/tav/go/blob/master/src/pkg/exp/eval/value.go http://github.com/tav/go/blob/master/src/pkg/exp/eval/type.go package main import ( "exp/eval" "fmt" // "go/token" ) // http://github.com/tav/go/blob/master/src/pkg/exp/eval/value.go type DateValue interface { eval.Value Get(*eval.Thread) string Set(*eval.Thread, string) } /* Date */ type dateV string func (v *dateV) String() string { return fmt.Sprint(*v) } func (v *dateV) Assign(t *eval.Thread, o eval.Value) { *v = dateV(o.(DateValue).Get(t)) } func (v *dateV) Get(*eval.Thread) string { return string(*v) } func (v *dateV) Set(t *eval.Thread, x string) { *v = dateV(x) } // http://github.com/tav/go/blob/master/src/pkg/exp/eval/type.go type Type interface { eval.Type // isDate returns true if this is a date type. isDate() bool } /* Common type */ type commonType struct{} // added func (commonType) isDate() bool { return false } /* Date */ type dateType struct { commonType } // * It should not be an universal constant //var universePos = token.Position{"<universe>", 0, 0, 0} // added //var DateType = universe.DefineType("date", universePos, &dateType{}) var Date = &dateType{} func (t *dateType) compat(o Type, conv bool) bool { t2, ok := o.lit().(*dateType) return ok && t == t2 } func (t *dateType) lit() Type { return t } func (t *dateType) isDate() bool { return true } func (t *dateType) String() string { return "<date>" } func (t *dateType) Zero() eval.Value { res := dateV("") return &res } /* Named types */ /* type NamedType struct { eval.NamedType Def Type }*/ type NamedType struct { // added // token.Position Name string // Underlying type. If incomplete is true, this will be nil. // If incomplete is false and this is still nil, then this is // a placeholder type representing an error. Def Type // True while this type is being defined. incomplete bool methods map[string]eval.Method } func (t *NamedType) isDate() bool { return t.Def.isDate() } /* *********************** */ func main() { print("foo") }

    Read the article

  • Spring factory beans not always initialised before being used.

    - by aos
    Hi, I am using spring to initialise my beans. I have configured a bean which I intend to use as a factory bean. <bean id="jsServicesFactory" class="x.y.z.JSServicesFactory" /> It is a very basic class - which has 4 getter methods. One example is public final PortletRegistry getPortletRegistry() { PortletRegistry registry = (PortletRegistry) JetspeedPortletServices .getSingleton().getService("PortletRegistryComponent"); return registry; } I have a 2nd bean which uses this factory beans to set one of its properties <bean id="batchManagerService" class="x.y.z.BatchManagerService"> ... <property name="portletRegistry"> <bean factory-bean="jsServicesFactory" factory-method="getPortletRegistry" /> </property> ... When I start my server in RAD, this all works perfectly. However when I deploy to Linux I sometimes get the following error ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchManagerService' defined in ServletContext resource [/WEB-INF/context/root/batchManagerContext.xml]: Cannot create inner bean 'jsServicesFactory$created#70be70be' while setting bean property 'portletRegistry'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jsServicesFactory$created#70be70be' defined in ServletContext resource [/WEB-INF/context/root/batchManagerContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public final org.apache.jetspeed.components.portletregistry.PortletRegistry x.y.z.JSServicesFactory.getPortletRegistry()] threw exception; nested exception is java.lang.NullPointerException I have tried adding depends-on="jsServicesFactory" to my bean batchManagerService but it didn't work. Any ideas? Thanks

    Read the article

  • Epoll in EPOLLET mode returning 2 EPOLLIN before reading from the socket

    - by Arkaitz Jimenez
    The epoll manpage says that a fd registered with EPOLLET(edge triggered) shouldn't notify twice EPOLLIN if no read has been done. So after an EPOLLIN you need to empty the buffer before epoll_wait being able to return a new EPOLLIN on new data. However I'm experiencing problems with this approach as I'm seeing duplicated EPOLLIN events for untouched fds. This is the strace output, 0x200 is EPOLLRDHUP that is not defined yet in my glibc headers but defined in the kernel. 30285 epoll_ctl(3, EPOLL_CTL_ADD, 9, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP|EPOLLET|0x2000, {u32=9, u64=9}}) = 0 30285 epoll_wait(3, {{EPOLLIN, {u32=9, u64=9}}}, 10, -1) = 1 30285 epoll_wait(3, {{EPOLLIN, {u32=9, u64=9}}}, 10, -1) = 1 30285 epoll_wait(3, <unfinished ...> 30349 epoll_ctl(3, EPOLL_CTL_DEL, 9, NULL) = 0 30306 recv(9, "7u\0\0\10\345\241\312\t\20\f\32\r\10\27\20\2\30\200\10 \31(C0\17\32\r\10\27\20\2\30"..., 20000, 0) = 20000 30349 epoll_ctl(3, EPOLL_CTL_DEL, 9, NULL) = -1 ENOENT (No such file or directory) 30305 recv(9, " \31(C0\17\32\r\10\27\20\2\30\200\10 \31(C0\17\32\r\10\27\20\2\30\200\10 \31("..., 20000, 0) = 10011 So, after adding fd number 9 I do receive 2 consecutive EPOLLIN events before having recving the file descriptor, the syscall trace shows how I do delete the fd before reading but it should only happen once, one per event. So either I am not reading the manpage properly or something is now working here.

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >