Search Results

Search found 2682 results on 108 pages for 'michael mao'.

Page 85/108 | < Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >

  • Html, table, img & css - how to get text to wrap correctly?

    - by Michael Pasqualone
    I've got the following code; however it's not given me the desired result - what I am after is as per the image below, what am I doing wrong? <style> table.control_grid tr { text-align: center; width: 200px; } table.control_grid td { width: 120px; height: 48px; } table.control_grid a { text-decoration: none; } table.control_grid img { vertical-align: text-top; } </style> <table class="control_grid"> <tr> <td><img width="48" height="48" src="icon1.gif">My text & stuff, overflow??</td> <td><img width="48" height="48" src="icon1.gif">Icon1</td> <td><img width="48" height="48" src="icon1.gif">Icon2</td> <td></td> <td></td> </tr> </table> Desired result:

    Read the article

  • How to discover getters and setters on hibernate objects

    - by Michael Jones
    I need to find a way of taking a hibernate object and discovering at runtime all of the getter methods that relate to persistable fields. I'm using annotations in the classes but have previously had difficulties working with them (I ran into a 2 year old bug the java developers still haven't fixed). Does anyone know how I can do this please, ideally without using annotations? Thanks. PS - What I'm trying to do here is to update a new object with values from an existing object dynamically.

    Read the article

  • Loading a UIView from a UITableview

    - by Michael Robinson
    I can firgure out how to push a UIView from a Tableview and have the "child" details appear. Here is the view I'm trying to load: Here is the code that checks for children and either pushes a itemDetail.xib or an additional UITable, I want to use the above .xib but load the correct contents "tableDataSource" into the UItable: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //Get the dictionary of the selected data source. NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row]; //Get the children of the present item. NSArray *Children = [dictionary objectForKey:@"Children"]; if([Children count] == 0) { ItemDetailViewController *dvController = [[ItemDetailViewController alloc] initWithNibName:@"ItemDetailView" bundle:[NSBundle mainBundle]]; [self.navigationController pushViewController:dvController animated:YES]; [dvController release]; } else { //Prepare to tableview. FirstTab *rvController = [[FirstTab alloc] initWithNibName:@"FirstView" bundle:[NSBundle mainBundle]]; //Increment the Current View rvController.CurrentLevel += 1; //Set the title; rvController.CurrentTitle = [dictionary objectForKey:@"Title"]; //Push the new table view on the stack [self.navigationController pushViewController:rvController animated:YES]; rvController.tableDataSource = Children; [rvController release]; } } Thanks for the help. I see lots of stuff on this but can't find the correct push instructions.

    Read the article

  • An array of MySQL results...

    - by Michael Falk
    What am I doing wrong here? I am attempting to return a json object and I can't seem to get past the array... I've built hundreds of regular array and returned them as a json object but I am having a hard time wrapping my head around this one. $rows = array(); $post_array = array(); $i = 0; $result = mysql_query(" SELECT * FROM forum_posts WHERE permalink = '$permalink' AND LOWER(raw_text) LIKE '%$str%' " ); while($row = mysql_fetch_assoc($result)) { $post_array[$i] = $rows[ "id" => htmlentities($row["id"]), "post_content" => htmlentities($row["content"]), "author" => $row["author"], "last_updated" => $row["last_updated"], "author_id" => $row["author_id"], "editing_author" => $row["editing_author"], "date" => $outputQuoteDate ]; $i++; }

    Read the article

  • probelm with recv() on a tcp connection

    - by michael
    Hi, I am simulating TCP communication on windows in C I have sender and a receiver communicating. sender sends packets of specific size to receiver. receiver gets them and send an ACK for each packet it received back to the sender. If the sender didn't get a specific packet (they are numbered in a header inside the packet) it sends the packet again to the receiver. Here is the getPacket function on the receiver side: //get the next packet from the socket. set the packetSize to -1 //if it's the first packet. //return: total bytes read // return: 0 if socket has shutdown on sender side, -1 error, else number of bytes received int getPakcet(char *chunkBuff,int packetSize,SOCKET AcceptSocket){ int totalChunkLen = 0; int bytesRecv=-1; bool firstTime=false; if (packetSize==-1) { packetSize=MAX_PACKET_LENGTH; firstTime=true; } int needToGet=packetSize; do { char* recvBuff; recvBuff = (char*)calloc(needToGet,sizeof(char)); if(recvBuff == NULL){ fprintf(stderr,"Memory allocation problem\n"); return -1; } bytesRecv = recv(AcceptSocket, recvBuff, needToGet, 0); if (bytesRecv == SOCKET_ERROR){ fprintf(stderr,"recv() error %ld.\n", WSAGetLastError()); totalChunkLen=-1; return -1; } if (bytesRecv == 0){ fprintf(stderr,"recv(): socket has shutdown on sender side"); return 0; } else if(bytesRecv > 0) { memcpy(chunkBuff + totalChunkLen,recvBuff,bytesRecv); totalChunkLen+=bytesRecv; } needToGet-=bytesRecv; } while ((totalChunkLen < packetSize) && (!firstTime)); return totalChunkLen; } i use firstTime because for the first time the receiver doesn't know the normal package size that the sender is going to send to it, so i use a MAX_PACKET_LENGTH to get a package and then set the normal package size to the num of bytes i have received my problem is the last package. it's size is less than the package size so lets say last package size is 2 and the normal package size is 4. so recv() gets two bytes, continues to the while condition, then totalChunkLen < packetSize because 2<4 so it iterates the loop again and the gets stuck in recv() because it's blocking because the sender has nothing to send. on the sender side i can't close the connection because i didn't ACK back, so it's kind of a deadlock. receiver is stuck because it's waiting for more packages but sender has nothing to send. i don't want to use a timeout for recv() or to insert a special character to the package header to mark that it is the last one what can i do ? thanks

    Read the article

  • Python Threading, loading one thread after another

    - by Michael
    Hi, I'm working on a media player and am able to load in a single .wav and play it. As seen in the code below. foo = wx.FileDialog(self, message="Open a .wav file...", defaultDir=os.getcwd(), defaultFile="", style=wx.FD_MULTIPLE) foo.ShowModal() queue = foo.GetPaths() self.playing_thread = threading.Thread(target=self.playFile, args=(queue[0], 'msg')) self.playing_thread.start() But the problem is, when I try to make the above code into a loop for multiple .wav files. Such that while playing_thread.isActive == True, create and .start() the thread. Then if .isActive == False, pop queue[0] and load the next .wav file. Problem is, my UI will lock up and I'll have to terminate the program. Any ideas would be appreciated.

    Read the article

  • Is directly executing SQL bad app design?

    - by Michael Lowman
    I'm developing an iOS application that's a manager/viewer for another project. The idea is the app will be able to process the data stored in a database into a number of visualizations-- the overall effect being similar to cacti. I'm making the visualizations fully user-configurable: the user defines what she wants to see and adds restrictions. She might specify, for instance, to graph a metric over the last three weeks with user accounts that are currently active and aren't based in the United States. My problem is that the only design I can think of is more or less passing direct SQL from the iOS app to the backend server to be executed against the database. I know it's bad practice and everything should be written in terms of stored procedures. But how else do I maintain enough flexiblity to keep fully user-defined queries? While the application does compose the SQL, direct SQL is never visible or injectable by the user. That's all abstracted away in UIDateTimeChoosers, UIPickerViews, and the like.

    Read the article

  • Show or hide fields depending on the Acl9 role - Ruby on Rails

    - by Michaël
    Hi, I am using Acl9 to manage the roles and I want to hide the checkbox usertype if the user has the role :customer and show it if the role is :manager. I want that just the :manager can edit all the fields and some for the :customer. Thank you for your help! <h1>Editing user</h1> <% form_for(@user) do |f| %> <%= f.error_messages %> <p> <%= f.label :usertype %><br /> <%= f.check_box :usertype %> </p> <p> <%= f.label :surname %><br /> <%= f.text_field :surname %> </p> <p> <%= f.label :firstname %><br /> <%= f.text_field :firstname %> </p> <p> <%= f.label :phone %><br /> <%= f.text_field :phone %> </p> <p> <%= f.label :email %><br /> <%= f.text_field :email %> </p> <p> <%= f.label :registrationdate %><br /> <%= f.datetime_select :registrationdate %> </p> <p> <%= f.label :login %><br /> <%= f.text_field :login %> </p> <p> <%= f.label :password %><br /> <%= f.text_field :password %> </p> <p> <%= f.submit 'Update' %> </p> <% end %> <%= link_to 'Show', @user %> | <%= link_to 'Back', users_path %>

    Read the article

  • Creating a "virtual" path (/bla) in Mac OS X and Linux that calls custom code

    - by Michael Stum
    Just something I'd like to play with, I would like to create a "virtual" file/directory in the File System of Linux or Mac OS X (Not sure if I can share the same code - does POSIX help?), for example /foo and then perform custom code when something is read or written to it. Similar how /dev/null allows for stuff like echo "Hello!" > /dev/null I don't care if it's in /dev, /proc or anywhere else, as said it's mainly something to play with...

    Read the article

  • How do you deploy your Rails application?

    - by Michael Sync
    Do you upload your rail application to your host via FTP first? I'm currently using Passenger and Capistrano. If I do "cap deploy" in my local machine then I think Capistrano should upload my rail application to my host, right? Someone from my host is saying that I need to run "cap deploy" in server. I think it doesn't make sense.

    Read the article

  • Perl ENV variable contains newline and tab

    - by Michael
    Say I have an environment variable myvar myvar=\tapple\n when the following command will print out this variable perl -e 'print "$ENV{myvar}"' I will literally have \tapple\n, however, I want those control chars to be evaluated and not escaped. How would I achieve it? In the real world $ENV residing in substitution, but I hope the answer will cover that.

    Read the article

  • Question about fwrite API

    - by michael
    Hi, In C++, there is a fwrite() which writes a buffer to a file on disk: http://www.cplusplus.com/reference/clibrary/cstdio/fwrite/ Can you please tell me if there is any buffer inside that fwrite implementation? i.e. if I call fwrite() multiple times (say 10 times), does it actually invoke file i/o 10 different times? Thank you.

    Read the article

  • android ListView question

    - by michael
    Hi, I have a ListView in my android application. If I flick up/down the ListView, which method will return my 'selected' element in my list View? How about if I use the track ball to navigate up/down my list view, which method will return the index of my selected element? Thank you.

    Read the article

  • How to create DataSource dependency property on a wpf User Control

    - by Michael Hedgpeth
    I have a user control that wraps a grid. I want to be able to set the underlying grid's data source, but through the user control, like this: <my:CustomGrid DataSource="{Binding Path=CollectionView}" /> I have set this up in the grid like this: private static readonly DependencyProperty DataSourceProperty = DependencyProperty.Register("DataSource", typeof(IEnumerable), typeof(CustomGrid)); public IEnumerable DataSource { get { return (IEnumerable)GetValue(DataSourceProperty); } set { SetValue(DataSourceProperty, value); underlyingGrid.DataSource = value; } } But this doesn't work (it doesn't give me an error either). The data source is never set. What am I missing?

    Read the article

  • regular expression repeating subexpression

    - by Michael Z
    I have the following text <pattern name="pattern1"/> <success>success case 1</success> <failed> failure 1</failed> <failed> failure 2</failed> <unknown> unknown </unknown> <pattern name="pattern2"/> <success>success case 2</success> <otherTag>There are many other tags.</otherTag> <failed> failure 3</failed> And the regular expression <failed>[\w|\W]*?</failed> matches all the lines contains failed tag. What do I need to to if I want to include the lines contains pattern tag as well? Basically, I want the following output: <pattern name="pattern1"/> <failed> failure 1</failed> <failed> failure 2</failed> <pattern name="pattern2"/> <failed> failure 3</failed> I am doing this in javascript, I do not mind of doing some intermediate steps.

    Read the article

  • Java Null Pointer Exception :-(

    - by John-Michael Reed
    I've got a Null Pointer Exception in my main that just won't go away and I'm totally out of ideas. The error is on the line "Board[x][y].color = 2;" in which Board is a public, static array of piece objects that contain instance variables like the one "color" that is being set to 2 in the above statement. Pieces is not static - that is there are many different copies of pieces, each with its own data, but only one board. The array has been initialized and defined as both public Piece[][] Board = new Piece[8][8] and public static Piece[][] Board = new Piece[8][8], but no matter how I mess around with it (getting rid of static, putting the variable in another object, etc.), I can't seem to get the error to go away. Help?

    Read the article

  • Greasemonkey script, that creates Kineticjs drag and drop canvas over every website

    - by Michael Moeller
    I'd like to put a drag and drop canvas over every website I visit in Firefox. My Greasemonkey script puts a drag and drop canvas under every page: kinetic.user.js: // ==UserScript== // @name kineticjs_example // @description Canvas Drag and Drop // @include * // @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js // @require http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.7.2.min.js // ==/UserScript== var div = document.createElement( 'div' ); with( div ) { setAttribute( 'id', 'container' ); } // append at end document.getElementsByTagName( 'body' )[ 0 ].appendChild( div ); var stage = new Kinetic.Stage({ container: 'container', width: 1000, height: 1000 }); var layer = new Kinetic.Layer(); var rectX = stage.getWidth() / 2 - 50; var rectY = stage.getHeight() / 2 - 25; var box = new Kinetic.Rect({ x: rectX, y: rectY, width: 100, height: 50, fill: '#00D2FF', stroke: 'black', strokeWidth: 4, draggable: true }); // add cursor styling box.on('mouseover', function() { document.body.style.cursor = 'pointer'; }); box.on('mouseout', function() { document.body.style.cursor = 'default'; }); layer.add(box); stage.add(layer); How can I drag and drop this shape over the entire website?

    Read the article

  • How to access a subset of XML data in Java when the XML data is too large to fit in memory?

    - by Michael Jones
    What I would really like is a streaming API that works sort of like StAX, and sort of like DOM/JDom. It would be streaming in the sense that it would be very lazy and not read things in until needed. It would also be streaming in the sense that it would read everything forwards (but not backwards). Here's what code that used such an API would look like. URL url = ... XMLStream xml = XXXFactory(url.inputStream()) ; // process each <book> element in this document. // the <book> element may have subnodes. // You get a DOM/JDOM like tree rooted at the next <book>. while (xml.hasContent()) { XMLElement book = xml.getNextElement("book"); processBook(book); } Does anything like this exist?

    Read the article

  • Implementing a Version check between an Abstract class and it's implementation

    - by Michael Stum
    I have this abstract class and concrete implementation (they are in different assemblies): public abstract class MyAbstractClass { private static readonly int MyAbstractClassVersion = 1; public abstract int ImplementedVersion { get; } protected MyAbstractClass() { CheckVersion(); } private void CheckVersion() { var message = string.Format( "MyAbstractClass implements Version {0}, concrete is Version {1}", RepositoryVersion, ImplementedVersion); if (!MyAbstractClassVersion.Equals(ImplementedVersion)) throw new InvalidOperationException(message); } } public class ConcreteClass : MyAbstractClass { public ConcreteClass() : base() { // ConcreteClass is guaranteed to have // a constructor that calls the base constructor // I just simplified the example } public override int ImplementedVersion { get { return 2; } } } As you see, I call CheckVersion() from the abstract constructor, to get rid of the "virtual member call in base constructor" message, but I am not sure if that's really the way to do it. Sure, it works, but that doesn't mean it will always work, will it? Also, I wonder if I can get the name of the Concrete Type from the CheckVersion() function? I know that adding new abstract members will force an error anyway (System.TypeLoadException) and I'm not sure if I want this type of strict Versioning, but I'm just curious how it would be done properly given only the abstract class and an implementation (I know I could do it by using interfaces and/or a Factory pattern).

    Read the article

  • Python NameError when attempting to use a user-defined class

    - by Michael Herold
    I'm getting a weird instance of a NameError when attempting to use a class I wrote. In a directory, I have the following file structure: dir/ ReutersParser.py test.py reut-xxx.sgm Where my custom class is defined in ReutersParser.py and I have a test script defined in test.py. The ReutersParser looks something like this: from sgmllib import SGMLParser class ReutersParser(SGMLParser): def __init__(self, verbose=0): SGMLParser.__init__(self, verbose) ... rest of parser if __name__ == '__main__': f = open('reut2-short.sgm') s = f.read() p = ReutersParser() p.parse(s) It's a parser to deal with SGML files of Reuters articles. The test works perfectly. Anyway, I'm going to use it in test.py, which looks like this: from ReutersParser import ReutersParser def main(): parser = ReutersParser() if __name__ == '__main__': main() When it gets to that parser line, I'm getting this error: Traceback (most recent call last): File "D:\Projects\Reuters\test.py", line 34, in <module> main() File "D:\Projects\Reuters\test.py", line 19, in main parser = ReutersParser() File "D:\Projects\Reuters\ReutersParser.py", line 38, in __init__ SGMLParser.__init__(self, verbose) NameError: global name 'sgmllib' is not defined For some reason, when I try to use my ReutersParser in test.py, it throws an error that says it cannot find sgmllib, which is a built-in module. I'm at my wits' end trying to figure out why the import won't work. What's causing this NameError? I've tried importing sgmllib in my test.py and that works, so I don't understand why it can't find it when trying to run the constructor for my ReutersParser.

    Read the article

  • How to return a 'read-only' copy of a vector

    - by michael
    Hi, I have a class which has a private attribute vector rectVec; class A { private: vector<Rect> rectVec; }; My question is how can I return a 'read-only' copy of my Vector? I am thinking of doing this: class A { public: const vect<Rect>& getRectVec() { return rectVect; } } Is that the right way? I am thinking this can guard against the callee modify the vector(add/delete Rect in vector), what about the Rect inside the vector?

    Read the article

  • Linq Order By a subtable

    - by Michael
    Hello, My question is how to sort a Linq query by a sub table: Table Apps: - app_id - name Table AppStatus: - app_status_id - app_id - severity - status_date I would like to have a query with all the apps, sorted by the last status severity: app_id name 1 first 2 second 3 third app_status_id app_id severity status_date 1 1 5 12-4-2010 2 1 2 15-4-2010 3 2 7 10-4-2010 4 3 3 13-4-2010 Now i want it sorted like: app_id name 3 third 1 first 2 second Can anyone help me with a LINQ query for this. I tried the following already, but that didn't work: var apps = from apps in dc.Apps orderby apps.AppStatus.LastOrDefault().severity select apps;

    Read the article

  • Start a thread using a method pointer

    - by Michael
    Hi ! I'm trying to develop a thread abstraction (POSIX thread and thread from the Windows API), and I would very much like it to be able to start them with a method pointer, and not a function pointer. What I would like to do is an abstraction of thread being a class with a pure virtual method "runThread", which would be implanted in the future threaded class. I don't know yet about the Windows thread, but to start a POSIX thread, you need a function pointer, and not a method pointer. And I can't manage to find a way to associate a method with an instance so it could work as a function. I probably just can't find the keywords (and I've been searching a lot), I think it's pretty much what Boost::Bind() does, so it must exist. Can you help me ?

    Read the article

< Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >