Search Results

Search found 4350 results on 174 pages for 'chilly child'.

Page 38/174 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • NullPointerException using EndlessAdapter with SimpleAdapter

    - by android_dev
    Hello, I am using EndlessAdapter from commonsguy with a SimpleAdapter. I can load data when I make a scroll down without problems, but I have a NullPointerException when I make a scroll up. The problem is in the method @Override public View getView(int position, View convertView,ViewGroup parent) { return wrapped.getView(position, convertView, parent); } from the class AdapterWrapper. The call to wrapped.getView(position, convertView,parent) raises the exception and I don´t know why. This is my implementation of EndlessAdapter: //Inner class in SearchTextActivity class DemoAdapter extends EndlessAdapter { private RotateAnimation rotate = null; DemoAdapter(ArrayList<HashMap<String, String>> result) { super(new SimpleAdapter(SearchTracksActivity.this, result, R.layout.textlist_item, PROJECTION_COLUMNS, VIEW_MAPPINGS)); rotate = new RotateAnimation( 0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(600); rotate.setRepeatMode(Animation.RESTART); rotate.setRepeatCount(Animation.INFINITE); } @Override protected View getPendingView(ViewGroup parent) { View row=getLayoutInflater().inflate(R.layout.textlist_item, null); View child=row.findViewById(R.id.title); child.setVisibility(View.GONE); child=row.findViewById(R.id.username); child.setVisibility(View.GONE); child=row.findViewById(R.id.throbber); child.setVisibility(View.VISIBLE); child.startAnimation(rotate); return row; } @Override @SuppressWarnings("unchecked") protected void rebindPendingView(int position, View row) { HashMap<String, String> res = (HashMap<String, String>)getWrappedAdapter().getItem(position); View child=row.findViewById(R.id.title); ((TextView)child).setText(res.get("title")); child.setVisibility(View.VISIBLE); child=row.findViewById(R.id.username); ((TextView)child).setText(res.get("username")); child.setVisibility(View.VISIBLE); ImageView throbber=(ImageView)row.findViewById(R.id.throbber); throbber.setVisibility(View.GONE); throbber.clearAnimation(); } boolean mFinal = true; @Override protected boolean cacheInBackground() { EditText searchText = (EditText)findViewById(R.id.searchText); String textToSearch = searchText.getText().toString(); Util.getSc().searchText(textToSearch , offset, limit, new ResultListener<ArrayList<Text>>() { @Override public void onError(Exception e) { e.toString(); mFinal = false; } @Override public void onSuccess(ArrayList<Text> result) { if(result.size() == 0){ mFinal = false; }else{ texts.addAll(result); offset++; } } }); return mFinal; } @Override protected void appendCachedData() { for(Text text : texts){ result.add(text.getMapValues()); } texts.clear(); } } And I use it this way: public class SearchTextActivity extends AbstractListActivity { private static final String[] PROJECTION_COLUMNS = new String[] { TextStore.Text.TITLE, TextStore.Text.USER_NAME}; private static final int[] VIEW_MAPPINGS = new int[] { R.id.Text_title, R.id.Text_username}; ArrayList<HashMap<String, String>> result; static ArrayList<Text> texts; static int offset = 0; static int limit = 1; @Override void onAbstractCreate(Bundle savedInstance) { setContentView(R.layout.search_tracks); setupViews(); } private void setupViews() { ImageButton searchButton = (ImageButton)findViewById(R.id.searchButton); updateView(); } SimpleAdapter adapter; void updateView(){ if(result == null) { result = new ArrayList<HashMap<String, String>>(); } if(tracks == null) { texts = new ArrayList<Text>(); } } public void sendQuery(View v){ offset = 0; texts.clear(); result.clear(); setListAdapter(new DemoAdapter(result)); } } Does anybody knows what could be the problem? Thank you in advance

    Read the article

  • save the transient instance before flushing

    - by eugenn
    Exception: object references an unsaved transient instance - save the transient instance before flushing: Child How to reproduce issue: 1. Hibernate is load the entity "Parent". The property "child" is null 2. The "Parent" is rendered on the screen and after that the "child" property is auto instantiated. So I have the following graph: Parent.child != null Parent.child.childId = null Parent.child.childKey = "" Parent.child.childName = "" Question: How I could to force the Hibernate to ignore updating or inserting Child entity WHEN childId = null? If childId != null I would like just create relation. <hibernate-mapping> <class name="com.test.Parent" entity-name="ParentObject" table="parent" dynamic-insert="false" dynamic-update="true" optimistic-lock="version"> <id name="rowId" type="long"> <column name="RowID" /> <generator class="native" /> </id> <version name="versionSequence" type="integer" unsaved-value="null" generated="never" insert="false"> <column name="VersionSequence" /> </version> <many-to-one name="child" entity-name="Child" fetch="select" optimistic-lock="true" embed-xml="false" update="true" insert="false"> <column name="ChildID" /> </many-to-one> <property name="dateCreated" type="timestamp"> <column name="DateCreated" length="0" /> </property> <property name="dateUpdated" type="timestamp" update="false"> <column name="DateUpdated" length="0" /> </property> </class> </hibernate-mapping> <hibernate-mapping> <class name="com.Child" entity-name="Child" table="Child" dynamic-insert="false" dynamic-update="true" optimistic-lock="version"> <id name="childId" type="long" > <column name="ChildID" /> <generator class="native" /> </id> <version name="versionSequence" type="integer" insert="false" generated="never" > <column name="VersionSequence" /> </version> <property name="childKey" type="string" > <column name="ChildKey" length="20" /> </property> <property name="childName" type="string" > <column name="ChildName" length="30" /> </property> <property name="childNumber" type="string" > <column name="ChildNumber" /> </property> <property name="dateCreated" type="timestamp"> <column name="DateCreated" /> </property> <property name="dateUpdated" type="timestamp" update="false"> <column name="DateUpdated" /> </property> </class> </hibernate-mapping>

    Read the article

  • [Grails] How to enlist children of specified Parent in treeview colum (table)

    - by Rehman
    I am newbie in grails and tried to implement treeview using RichUI plugin, which shows all parents with individual children in Parent.list.gsp xml for parent and their children <parents name='Parents'> <Parent id='1' name='Parent_1'> <Children name='Children'> <child name='Child_2' id='2' /> <child name='Child_4' id='4' /> <child name='Child_1' id='3' /> <child name='Child_3' id='1' /> </Children> </Parent> <Parent id='2' name='Parent_2'> <Children name='Children'> <child name='Child_1' id='8' /> <child name='Child_2' id='7' /> <child name='Child_4' id='6' /> <child name='Child_3' id='5' /> </Children> </Parent> </parents> Parent Domain Class class Parent { String name static hasMany = [children:Child] } Child Domain Class class Child { String name Parent parent static belongsTo = [parent:Parent] } Parent Controller def list = { def writer = new StringWriter() def xml = new MarkupBuilder(writer) xml.parents(name: "Parents"){ Parent.list().each { Parent parentt = it Parent( id:parentt.id,name:parentt.name) { Children(name:'Children'){ parentt.children.each { Child childd = it child(name:childd.name,id:childd.id) } } } } } if(!params.max)params.max=10 ["data":writer.toString(),parentInstanceList: Parent.list(params), parentInstanceTotal: Parent.count()] } Parent.list.gsp <head> <resource:treeView/> ...</head> <body> <table> <thead> <tr> <g:sortableColumn property="id" title="${message(code: 'parent.id.label', default: 'Id')}" /> <g:sortableColumn property="name" title="${message(code: 'parent.name.label', default: 'Name')}" /> <g:sortableColumn property="relationship" title="${message(code: 'parent.relationhsip.label', default: 'Relationship')}" /> </tr> </thead> <tbody> <g:each in="${parentInstanceList}" status="i" var="parentInstance"> <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> <td><g:link action="show" id="${parentInstance.id}">${fieldValue(bean: parentInstance, field: "id")}</g:link></td> <td>${fieldValue(bean: parentInstance, field: "name")}</td> <td><richui:treeView xml="${data}" /></td> </tr> </g:each> </tbody> </table> </body> Problem Currently, in list view, every Parent entry has list of all parents and their children under relationship column Parent List view Snapshot link text Question how can i enlist all children only for each parent instead of enlisting all parents with their children in each Parent entry ? thanks in advance Rehman

    Read the article

  • Array filteration PHP

    - by Muhammad Sajid
    I have an array with values like: Array ( [0] => Array ( [parent] => Basic [parentId] => 1 [child] => Birthday [childId] => 2 ) [1] => Array ( [parent] => Basic [parentId] => 1 [child] => Gender [childId] => 3 ) [2] => Array ( [parent] => Geo [parentId] => 10 [child] => Current City [childId] => 11 ) [3] => Array ( [parent] => Known me [parentId] => 5 [child] => My personality [childId] => 7 ) [4] => Array ( [parent] => Known me [parentId] => 5 [child] => Best life moment [childId] => 8 ) ) And I want to filter this array such that their filtration based on parent index, and the final result would be like: Array ( [0] => Array ( [parent] => Basic [parentId] => 1 [child] => Array ( [0] => Birthday [1] => Gender ) ) [1] => Array ( [parent] => Geo [parentId] => 10 [child] => Array ( [0] => Current City ) ) [2] => Array ( [parent] => Known me [parentId] => 5 [child] => Array ( [0] => My personality [1] => Best life moment ) ) ) For that I coded : $filter = array(); $f = 0; for ($i=0; $i<count($menuArray); $i++) { $c = 0; for( $b = 0; $b < count($filter); $b++ ){ if( $filter[$b]['parent'] == $menuArray[$i]['parent'] ){ $c++; } } if ($c == 0) { $filter[$f]['parent'] = $menuArray[$i]['parent']; $filter[$f]['parentId'] = $menuArray[$i]['parentId']; $filter[$f]['child'][] = $menuArray[$i]['child']; $f++; } } But it results : Array ( [0] => Array ( [parent] => Basic [parentId] => 1 [child] => Array ( [0] => Birthday ) ) [1] => Array ( [parent] => Geo [parentId] => 10 [child] => Array ( [0] => Current City ) ) [2] => Array ( [parent] => Known me [parentId] => 5 [child] => Array ( [0] => My personality ) ) ) Could anyone point out my missing LOC?

    Read the article

  • Bash child proccess PID - how do you get it?

    - by Jason Tan
    Can any one tell me how to get the PID of a command executed in bash. E.g. I have a bash script that runs imapsync. When the script is killed the imapsync process does not always get killed, so I'd like to be able to identify the PID of imapsync programatically from my script, so that I can kill the imapsync process myself in a signal handler. So how do I programatically get the PID of a child process from a parent bash script? Thanks Folks

    Read the article

  • How to override puppet class arguments in child node?

    - by Jon Skarpeteig
    I'm attempting to accomplish something like the below: node 'basenode' { class { 'puppet' : disable => false, } } node 'child' inherits 'basenode' { class { 'puppet' : disable => true, } } This gives me: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate definition: Class[Puppet] is already defined How can I override this setting for this single node, and still have a parameterised class?

    Read the article

  • Create and manage child name servers (glue records) within my domain?

    - by basilmir
    Preface I use a top level domain provider that only allows me to add "normal" third-party name servers (a list where i can add "ns1.hostingcompany.com" type entries... nothing else) AND "child name servers" which i can later attach to my parent account ( ns1.myowndomain.com and an ip address). They do not provide other means of linking up. I want to host my own server and dns, even with just one name server (at first). My setup: Airport Extreme - get's a static ip address from my ISP Mac Mini Server - sits behind the Airport and get's a 10.0.1.2 My problem is that i can't seem to configure DNS correctly. I added a "child nameserver" with my airport's external static ip address at the top level provider, so to my understanding i should have all DNS traffic redirected to my Airport. I've opened port 53 UDP to let the traffic in. Now, what i don't get is this. My Mini Server is sitting on a 10.0.1.2 address and i have setup dns correctly, with an A record to point and resolve my server AND a reverse lookup to that 10.0.1.2. So it's ok for "internal stuff". Here is the clicker... How, when a request comes from the exterior for a reverse lookup, does the server "know" ... well look i have everything in 10.0.1.2 but the guy outside needs something from my real address. I can't begin to describe the MX record bonanza... How do i set this "right"? Do i "need" my Mini Server to sit on the external address directly (i can see how this could be the preferred solution, being close to a "real" server i have in my mind). If not... do i need a PTR record on the 10.0.1.2 server but with the external address in there? My dream: I will extend this "setup" with multiple Mini's in different cities where i work. I want a distributed something (Xgrid comes to mind). PS. Be gentle, i've read 2 books and the subject, and bought both the Lynda Essentials and DNS and Networking to boot, still i'm far from being on top of things.

    Read the article

  • Does it matter the direction of a Huffman's tree child node?

    - by Omega
    So, I'm on my quest about creating a Java implementation of Huffman's algorithm for compressing/decompressing files (as you might know, ever since Why create a Huffman tree per character instead of a Node?) for a school assignment. I now have a better understanding of how is this thing supposed to work. Wikipedia has a great-looking algorithm here that seemed to make my life way easier. Taken from http://en.wikipedia.org/wiki/Huffman_coding: Create a leaf node for each symbol and add it to the priority queue. While there is more than one node in the queue: Remove the two nodes of highest priority (lowest probability) from the queue Create a new internal node with these two nodes as children and with probability equal to the sum of the two nodes' probabilities. Add the new node to the queue. The remaining node is the root node and the tree is complete. It looks simple and great. However, it left me wondering: when I "merge" two nodes (make them children of a new internal node), does it even matter what direction (left or right) will each node be afterwards? I still don't fully understand Huffman coding, and I'm not very sure if there is a criteria used to tell whether a node should go to the right or to the left. I assumed that, perhaps the highest-frequency node would go to the right, but I've seen some Huffman trees in the web that don't seem to follow such criteria. For instance, Wikipedia's example image http://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Huffman_tree_2.svg/625px-Huffman_tree_2.svg.png seems to put the highest ones to the right. But other images like this one http://thalia.spec.gmu.edu/~pparis/classes/notes_101/img25.gif has them all to the left. However, they're never mixed up in the same image (some to the right and others to the left). So, does it matter? Why?

    Read the article

  • How to implement child-parent aggregation link in C++?

    - by Giorgio
    Suppose that I have three classes P, C1, C2, composition (strong aggregation) relations between P <>- C1 and P <>- C2, i.e. every instance of P contains an instance of C1 and an instance of C2, which are destroyed when the parent P instance is destroyed. an association relation between instances of C1 and C2 (not necessarily between children of the same P). To implement this, in C++ I normally define three classes P, C1, C2, define two member variables of P of type boost::shared_ptr<C1>, boost::shared_ptr<C2>, and initialize them with newly created objects in P's constructor, implement the relation between C1 and C2 using a boost::weak_ptr<C2> member variable in C1 and a boost::weak_ptr<C1> member variable in C2 that can be set later via appropriate methods, when the relation is established. Now, I also would like to have a link from each C1 and C2 object to its P parent object. What is a good way to implement this? My current idea is to use a simple constant raw pointer (P * const) that is set from the constructor of P (which, in turn, calls the constructors of C1 and C2), i.e. something like: class C1 { public: C1(P * const p, ...) : paren(p) { ... } private: P * const parent; ... }; class P { public: P(...) : childC1(new C1(this, ...)) ... { ... } private: boost::shared_ptr<C1> childC1; ... }; Honestly I see no risk in using a private constant raw pointer in this way but I know that raw pointers are often frowned upon in C++ so I was wondering if there is an alternative solution.

    Read the article

  • I want to host my own multiple Websites on my server. How do i setup my own child nameserver?

    - by basilmir
    I host my own multiple Websites on my server. How do i setup my own child nameserver? There are 4 different websites, with .com and .net and .ro at the end. I moved them to my own server. My Domain Administration (Registrar) let's me define my own child nameserver with my own IP and i've added my nameserver as my domain nameservers list. ns.something.ro as the first and only in the nameservers list ns.something.ro with my own IP address as the child nameserver I've setup everything and it works (kind of). When i use my ns IP adress directly i can of course access everything. Using "normal" external dnses will not work. As expected others on the web can't resolve correctly. What's wrong? Am i missing something?

    Read the article

  • Container item implementation

    - by onurozcelik
    Hi, I am working in Train Traffic Controller software project. My responsibility in this project is to develop the visual railroad GUI. We are implementing the project with Qt. By now I am using QGraphicsLinearLayout to hold my items. I am using the layout because I do not want to calculate coordinates of each item. So far I wrote item classes to add the layout. For instance SwitchItem class symbolizes railroad switch in real world. Each item class is responsible for its own painting and events. So far so good. Now I need a composite item that can contain two or more item. This class is going to be responsible for painting the items contained in it. I need this class because I have to put two or more items inside same layout cell. If I don' t put them in same cell I can' t use layout. See the image below. BlockSegmentItem and SignalItem inside same cell. Here is my compositeitem implementation. #include "compositeitem.h" CompositeItem::CompositeItem(QString id,QList<FieldItem *> _children) { children = _children; } CompositeItem::~CompositeItem() { } QRectF CompositeItem::boundingRect() const { FieldItem *child; QRectF rect(0,0,0,0); foreach(child,children) { rect = rect.united(child->boundingRect()); } return rect; } void CompositeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget ) { FieldItem *child; foreach(child,children) { child->paint(painter,option,widget); } } QSizeF CompositeItem::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { QSizeF itsSize(0,0); FieldItem *child; foreach(child,children) { // if its size empty set first child size to itsSize if(itsSize.isEmpty()) itsSize = child->sizeHint(Qt::PreferredSize); else { QSizeF childSize = child->sizeHint(Qt::PreferredSize); if(itsSize.width() < childSize.width()) itsSize.setWidth(childSize.width()); itsSize.setHeight(itsSize.height() + childSize.height()); } } return itsSize; } void CompositeItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { qDebug()<<"Test"; } This code works good with painting but when it comes to item events it is problematic. QGraphicsScene treats the composite item like a single item which is right for layout but not for events. Because each item has its own event implementation.(e.g. SignalItem has its special context menu event.) I have to handle item events seperately. Also I need a composite item implementation for the layout. How can I overcome this dilemma?

    Read the article

  • How do I get basic ProxyPass to work on Apache 2.2.17?

    - by Ansis Malins
    I'm trying to get around the ERR_UNSAFE_PORT restriction in Chrome by making Apache reverse proxy other HTTP servers on the machine. I load mod_proxy with sudo e2enmod proxy I add ProxyPass /znc/ http://localhost:6667/ to my httpd.conf I restart Apache with sudo /etc/init.d/apache2 restart When I open up /znc/, I get 500 Internal Server Error. I added LogLevel debug, restarted apache, tried again, and got nothing suspicous: [Fri Oct 19 18:55:17 2012] [debug] proxy_util.c(1818): proxy: grabbed scoreboard slot 0 in child 21528 for worker http://localhost:6667/ [Fri Oct 19 18:55:17 2012] [debug] proxy_util.c(1934): proxy: initialized single connection worker 0 in child 21528 for (localhost) [Fri Oct 19 18:55:17 2012] [debug] proxy_util.c(1818): proxy: grabbed scoreboard slot 1 in child 21528 for worker proxy:reverse [Fri Oct 19 18:55:17 2012] [debug] proxy_util.c(1934): proxy: initialized single connection worker 1 in child 21528 for (*) [Fri Oct 19 18:55:17 2012] [notice] Apache/2.2.17 (Ubuntu) PHP/5.3.8 configured -- resuming normal operations [Fri Oct 19 18:55:17 2012] [info] Server built: Feb 14 2012 17:59:20 [Fri Oct 19 18:55:17 2012] [debug] prefork.c(1018): AcceptMutex: sysvsem (default: sysvsem) [Fri Oct 19 18:55:22 2012] [debug] proxy_util.c(1818): proxy: grabbed scoreboard slot 0 in child 21532 for worker http://localhost:6667/ [Fri Oct 19 18:55:22 2012] [debug] proxy_util.c(1837): proxy: worker http://localhost:6667/ already initialized [Fri Oct 19 18:55:22 2012] [debug] proxy_util.c(1934): proxy: initialized single connection worker 0 in child 21532 for (localhost) [Fri Oct 19 18:55:22 2012] [debug] proxy_util.c(1818): proxy: grabbed scoreboard slot 1 in child 21532 for worker proxy:reverse [Fri Oct 19 18:55:22 2012] [debug] proxy_util.c(1837): proxy: worker proxy:reverse already initialized [Fri Oct 19 18:55:22 2012] [debug] proxy_util.c(1934): proxy: initialized single connection worker 1 in child 21532 for (*) So I'm stumped at this point. What to do? I'm running Ubuntu Server 11.10. ZNC responds with a correct 200 OK and HTML when queried directly both from the local machine and the Internet.

    Read the article

  • WPF 4.0 Custom panel won't show dynamically added controls in VS 2010 Designer

    - by Matt Ruwe
    I have a custom panel control that I'm trying to dynamically add controls within. When I run the application the static and dynamically added controls show up perfectly, but the dynamic controls do not appear within the visual studio designer. Only the controls placed declaratively in the XAML appear. I'm currently adding the dynamic control in the CreateUIElementCollection override, but I've also tried this in the constructor without success. Public Class CustomPanel1 Inherits Panel Public Sub New() End Sub Protected Overrides Function MeasureOverride(ByVal availableSize As System.Windows.Size) As System.Windows.Size Dim returnValue As New Size(0, 0) For Each child As UIElement In Children child.Measure(availableSize) returnValue.Width = Math.Max(returnValue.Width, child.DesiredSize.Width) returnValue.Height = Math.Max(returnValue.Height, child.DesiredSize.Height) Next returnValue.Width = If(Double.IsPositiveInfinity(availableSize.Width), returnValue.Width, availableSize.Width) returnValue.Height = If(Double.IsPositiveInfinity(availableSize.Height), returnValue.Height, availableSize.Height) Return returnValue End Function Protected Overrides Function ArrangeOverride(ByVal finalSize As System.Windows.Size) As System.Windows.Size Dim currentHeight As Integer For Each child As UIElement In Children child.Arrange(New Rect(0, currentHeight, child.DesiredSize.Width, child.DesiredSize.Height)) currentHeight += child.DesiredSize.Height Next Return finalSize End Function Protected Overrides Function CreateUIElementCollection(ByVal logicalParent As System.Windows.FrameworkElement) As System.Windows.Controls.UIElementCollection Dim returnValue As UIElementCollection = MyBase.CreateUIElementCollection(logicalParent) returnValue.Add(New TextBlock With {.Text = "Hello, World!"}) Return returnValue End Function Protected Overrides Sub OnPropertyChanged(ByVal e As System.Windows.DependencyPropertyChangedEventArgs) MyBase.OnPropertyChanged(e) End Sub End Class And my usage of this custom panel <Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:CustomPanel" Title="MainWindow" Height="364" Width="434"> <local:CustomPanel1> <CheckBox /> <RadioButton /> </local:CustomPanel1> </Window>

    Read the article

  • Context Menu on QGraphicsWidget

    - by onurozcelik
    Hi, In my application I have two object type. One is field item, other is composite item. Composite items may contain two or more field items. Here is my composite item implementation. #include "compositeitem.h" CompositeItem::CompositeItem(QString id,QList<FieldItem *> _children) { children = _children; } CompositeItem::~CompositeItem() { } QRectF CompositeItem::boundingRect() const { //Not carefully thinked about it return QRectF(QPointF(-50,-150),QSizeF(250,250)); } void CompositeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget ) { FieldItem *child; foreach(child,children) { child->paint(painter,option,widget); } } QSizeF CompositeItem::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { QSizeF itsSize(0,0); FieldItem *child; foreach(child,children) { // if its size empty set first child size to itsSize if(itsSize.isEmpty()) itsSize = child->sizeHint(Qt::PreferredSize); else { QSizeF childSize = child->sizeHint(Qt::PreferredSize); if(itsSize.width() < childSize.width()) itsSize.setWidth(childSize.width()); itsSize.setHeight(itsSize.height() + childSize.height()); } } return itsSize; } void CompositeItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { qDebug()<<"Test"; } My first question is how I can propagate context menu event to specific child. Picture on the above demonstrates one of my possible composite item. If you look on the code above you will see that I print "Test" when context menu event occurs. When I right click on the line symbol I see that "Test" message is printed. But when I right click on the signal symbol "Test" is not printed and I want it to be printed. My second question what cause this behaviour. How do I overcome this.

    Read the article

  • How does the PHP IteratorIterator class work?

    - by WilliamMartin
    Try as I might I cannot get my head around what the IteratorIterator class actually does. I understand that classes can implement Traversable so the engine knows it can loop using foreach and I realise that IteratorIterator is supposed to convert anything that is Traversable into an Iterator but I cannot for the life of me understand how. Take for example, the PDOStatement class; how would the standard Iterator methods (next, key, rewind, etc) be implemented to allow iteration over a PDOStatement? Sorry if my question is unclear, I am just struggling to grasp the exact reason for this class and the documentation on it is scant. Thanks, Will Update: Going through the phpt files, I found one test which uses IteratorIterator: <?php $root = simplexml_load_string('<?xml version="1.0"?> <root> <child>Hello</child> <child>World</child> </root> '); foreach (new IteratorIterator($root->child) as $child) { echo $child."\n"; } ?> The expected output is: Hello World I don't really follow how the IteratorIterator construct takes $root-child as an argument and how it manages to iterate over the child elements.

    Read the article

  • Using C code in c#

    - by karthik
    When i googled to find the way to change the window style i could find the code in "C" language How can i use the snippet below in my c# application, so that i can hide the Title Bar of external application ? I have not used "C" before.. //Finds a window by class name [DllImport("USER32.DLL")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); //Sets a window to be a child window of another window [DllImport("USER32.DLL")] public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); //Sets window attributes [DllImport("USER32.DLL")] public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); //Gets window attributes [DllImport("USER32.DLL")] public static extern int GetWindowLong(IntPtr hWnd, int nIndex); //assorted constants needed public static int GWL_STYLE = -16; public static int WS_CHILD = 0x40000000; //child window public static int WS_BORDER = 0x00800000; //window with border public static int WS_DLGFRAME = 0x00400000; //window with double border but no title public static int WS_CAPTION= WS_BORDER | WS_DLGFRAME; //window with a title bar /* This function sets the parent of the window with class ClassClass to the form/control the method is in. */ public void Reparent() { //get handle of parent form (.net property) IntPtr par = this.Handle; //get handle of child form (win32) IntPtr child = FindWindow("ClassClass", null); //set parent of child form SetParent(child, par); //get current window style of child form int style = GetWindowLong(child, GWL_STYLE); //take current window style and remove WS_CAPTION from it SetWindowLong(child, GWL_STYLE, (style & ~WS_CAPTION)); }

    Read the article

  • Mapping an instance of IList in NHibernate

    - by Martin Kirsche
    I'm trying to map a parent-child relationship using NHibernate (2.1.2), MySql.Data (6.2.2) and MySQL Server (5.1). I figured out that this must be done using a <bag> in the mapping file. I build a test app which is running without yielding any errors and is doing an insert for each entry but somehow the foreign key inside the children table (ParentId) is always empty (null). Here are the important parts of my code... Parent public class Parent { public virtual int Id { get; set; } public virtual IList<Child> Children { get; set; } } <class name="Parent"> <id name="Id"> <generator class="native"/> </id> <bag name="Children" cascade="all"> <key column="ParentId"/> <one-to-many class="Child"/> </bag> </class> Child public class Child { public virtual int Id { get; set; } } <class name="Child"> <id name="Id"> <generator class="native"/> </id> </class> Program using (ISession session = sessionFactory.OpenSession()) { session.Save( new Parent() { Children = new List<Child>() { new Child(), new Child() } }); } Any ideas what I did wrong?

    Read the article

  • Appending unique values only in a linked list in C

    - by LuckySlevin
    typedef struct child {int count; char word[100]; inner_list*next;} child; typedef struct parent { char data [100]; inner_list * head; int count; outer_list * next; } parent; void append(child **q,char num[100],int size) { child *temp,*r,*temp2,*temp3; parent *out=NULL; temp = *q; temp2 = *q; temp3 = *q; char *str; if(*q==NULL) { temp = (child *)malloc(sizeof(child)); strcpy(temp->word,num); temp->count =size; temp->next=NULL; *q=temp; } else { temp = *q; while(temp->next !=NULL) { temp=temp->next; } r = (child *)malloc(sizeof(child)); strcpy(r->word,num); r->count = size; r->next=NULL; temp->next=r; } } This is my append function which I use for adding an element to my child list. But my problem is it only should append unique values which are followed by a string. Which means : Inputs : aaa bbb aaa ccc aaa bbb ccc aaa Append should act : For aaa string there should be a list like bbb->ccc(Not bbb->ccc->bbb since bbb is already there if bbb is coming more than one time it should be increase count only.) For bbb string there should be list like aaa->ccc only For ccc string there should be list like aaa only I hope i could make myself clear. Is there any ideas? Please ask for further info.

    Read the article

  • What are the javascript performance tradeoffs in adding id's to dom elements?

    - by Blinky
    For example, I have a website which has a dynamically-generated segment of its dom which looks roughly like this: <div id="master"> <div class="child"> ... </div> <div class="child"> ... </div> <div class="child"> ... </div> ... <div class="child"> ... </div> </div> There might be hundreds of child elements in this manner, and they, too, might have yet more children. At present, none of them have id's except for the master. Javascript manipulates them via dom-walking. It's a little scary. I'd like to add id's, e.g.: <div id="master"> <div id="child1" class="child"> ... </div> <div id="child2" class="child"> ... </div> <div id="child3" class="child"> ... </div> ... <div id="childN" class="child"> ... </div> </div> What are the tradeoffs in adding id's to these divs? Certainly, jQuery must maintain a hash of id's, so there's going to be some sort of performance hit. Any general guidelines in when adding additional id's is a bad idea? Is jQuery so awesome that, in practice, it doesn't matter?

    Read the article

  • How is this function being made use of?

    - by Kay
    Hello all, I am just studying a few classes given to me by my lecturer and I can't understand how the function heapRebuild is being made used of! It doesn't change any global variables and it doesn't print out anything ad it doesn't return anything - so should this even work? It shouldn't, should it? If you were told to make use of heapRebuild to make a new function removeMac would you edit heapRebuild? public class MaxHeap<T extends Comparable<T>> implements Heap<T>{ private T[] heap; private int lastIndex; public T removeMax(){ T rootItem = heap[0]; heap[0] = heap[lastIndex-1]; lastIndex--; heapRebuild(heap, 0, lastIndex); return rootItem; } protected void heapRebuild(T[ ] items, int root, int size){ int child = 2*root+1; if( child < size){ int rightChild = child+1; if ((rightChild < size) && (items[rightChild].compareTo(items[child]) > 0)){ child = rightChild; } if (items[root].compareTo(items[child]) < 0){ T temp = items[root]; items[root] = items[child]; items[child] = temp; heapRebuild(items, child, size);} } } }

    Read the article

  • Jquery hiding all descendents of a ul tag...showing child elements as tree menu...

    - by Ronedog
    I want to hide all the descendents of the "ul" for my tree menu when the page loads up, then as each "main" "li" link is clicked display the direct child, and if the direct child has children (grandchild), when the the "Child" is clicked I want it to show the "grandchild" elements. should be simple, but some how I screwed things up and when i click on the main "li" (Heading 1) it displays all of the descendents (Including the "Sub page A - 1"), instead of just the direct children ("Sub Page A"). Which I think means the children, grandchildren, etc. were never hidden to begin with with the .hide(). What I really want to happen is to hide all the descendents (except the main top-level headings) and as I walk down the tree display the children as needed. Any tips on how to make this work? Here's the HTML: <ul id="nav"> <li>Heading 1 <ul> <li>Sub page A <ul> <li>Sub page A - 1</li> <li>Sub page A - 3</li> <li>Sub page A - 2</li> </ul> </li> <li>Sub page B</li> <li>Sub page C</li> </ul> </li> <li>Heading 2 <ul> <li>Sub page D</li> <li>Sub page E</li> <li>Sub page F</li> </ul> </li> <li>Heading 3 <ul> <li>Sub page G</li> <li>Sub page H</li> <li>Sub page I</li> </ul> </li> Here's my Jquery: $(function(){ $('#nav ul').hide(); //Supposed to Hide all <ul> tags for all descendents, but doesn't work $('#nav>li').mouseover(function(){ $(this).addClass("a_hand") }); //Add the class that displays the hand $('#nav>li').toggle(function() { $(this).find('ul').slideDown(200); }, function() { $(this).find('ul').slideUp(200); });//END TOGGLE });//END MAIN FUNCTION thanks.

    Read the article

  • Android: How to receive process signals in an activity to kill child process ?

    - by user355993
    My application calls Runtime.exec() to launch an executable in a separate process at start up time. I would like this child process to get killed when the parent activity exits. Now I can use onDestroy() to handle regular cases, but not "Force quit", shutdowns from DDMS, or kill from the console since those don't run onDestroy(). The addShutdownHandler() does not seem to be invoked in these cases either. Is there any other hook or signal handler that informs my activity that it's about to get terminated ? As an alternative is there a way to have the system automatically kill the child process when the parent dies ?

    Read the article

  • How to let parent control know that its child got focus?

    - by Axarydax
    Hi there, imagine that I have a Form with 9 controls (TabbedStuffControl) in a 3x3 tile, and these controls contain TabControls containing another control (StuffControl) with ListBoxes and TextBoxes. I'd like to know a proper way to let TabbedStuffControl that its child has received a focus? e.g. user clicks into a textbox of StuffControl or drags something to listbox of StuffControl. Eventually the Form should know which TabbedStuffControl is active Do I need to hook up GotFocus event of TextBoxes and ListBoxes and TabControls, then dispatch another event to finally let Form know who got focus? I think that there should be a simpler way - that somehow TabbedStuffControl knows that its child got focus, so there would be only one place in code that I'll hook up. Thanks.

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >