Search Results

Search found 1365 results on 55 pages for 'joe z'.

Page 28/55 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • Using read() directly into a C++ std:vector

    - by Joe
    I'm wrapping up user space linux socket functionality in some C++ for an embedded system (yes, this is probably reinventing the wheel again). I want to offer a read and write implementation using a vector. Doing the write is pretty easy, I can just pass &myvec[0] and avoid unnecessary copying. I'd like to do the same and read directly into a vector, rather than reading into a char buffer then copying all that into a newly created vector. Now, I know how much data I want to read, and I can allocate appropriately (vec.reserve). I can also read into &myvec[0], though this is probably a VERY BAD IDEA. Obviously doing this doesn't allow myvec.size to return anything sensible. Is there any way of doing this that 1) Doesn't completely feel yucky from a safety/C++ perspective and 2) Doesn't involve two copies of the data block - once from kernel to user space and once from a C char * style buffer into a C++ vector. Any thoughts collective?

    Read the article

  • What's the best NAME for "quick" Category you add to a file?

    - by Joe Blow
    So the other day I was sick of typing out repetetive addTarget:action:forControlEvents:s, and macros are only entertaining for so long, so I did this: @implementation UIControl (xx) -(void)addTarget:(id)target action:(SEL)action { [self addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; } @end *and simply added it at the top of the .m file in question. Works great of course, but notice the "xx".* What's the best thing to NAME a "quick" Category like this? Annoyingly, it appears you can not leave the xx blank - it would then become an "Extension" (which, incidentally, I don't understand at all). I was thinking maybe: a single underscore the name of the class again identically "quick" perhaps the name of the class in this file (as in "quick extra routines for UIControl in CherryBomb") - so it would be UIControl(CherryBomb), ie, remind you that these extra routines are handy for CherryBomb "x" your or your company's initials (use the same "quick" Category name everywhere) "ThisTextNeverUsedAnywhere" By the way, I've been assuming that Categories only happen in the files that see them (CherryBomb.m in the example) - they do not from then on apply app-wide. ie they only apply where you include the header file (UIControl+NattyStuff) or in the "quick" case only in the file to which one adds the text. (By the way ... it appears you do not actually need to include an interface for such a Category, i.e. you can omit... //you can actually get away without these lines... //#import <UIKit/UIControl.h> //@interface UIControl (x) //-(void)addTarget:(id)target action:(SEL)action; //@end ... that part and it works fine.) For people who love Categories, and who doesn't, what's the answer to this troubling question? What should you name a "quick" Category where the name is never going to be referenced again and is irrelevant? Is "_" a solution?

    Read the article

  • unique items from an observableArray of object properties

    - by Joe
    I'm trying to extract unique properties from a knockout.js observableArray of objects, to populate a drop menu. Being new to knockout, I'm really struggling with this! I want to iterate over a contacts list, and populate a drop menu with a unique value from each person object within the observableArray. So in my code example below, I wish to populate my drop menu with a list of people 'type' - family, friend etc. Looking on Google, I found a similar function, but it does not return any values, even if I console.log the results? //dummy data more rows in actual code... var people = [ { name: "Contact 1", address: "1, a street, a town, a city, AB12 3CD", tel: "0123456789", email: "[email protected]", type: "family" }, { name: "Contact 2", address: "1, a street, a town, a city, AB12 3CD", tel: "0123456789", email: "[email protected]", type: "friend" } ]; function ContactsViewModel(people) { var self = this; self.contacts = ko.observableArray(people); self.uniqueSelect = ko.dependentObservable(function() { return( ko.utils.arrayGetDistinctValues(self.contacts().type).sort()); }, self); }; ko.applyBindings(new ContactsViewModel()); And HTML template <p>Show me: <select data-bind="options: ContactsViewModel.uniqueSelect"></select></p> Any help appreciated, as a noob I'm lost! Thanks

    Read the article

  • Acts as Tree with Multiple Models

    - by Joe
    I've got several models that I'd like to relate together hierarchically. For simplicity's sake, let's say I've got these three: class Group < ActiveRecord::Base acts_as_tree has_many :users end class User < ActiveRecord::Base acts_as_tree belongs_to :group has_many :posts end class Post < ActiveRecord::Base acts_as_tree belongs_to :user end Under the current acts_as_tree, each node can individually can relate hierarchically to other nodes provided they are of the same type. What I'd like is to remove this restriction on type identity, so that SomePost.parent could have a User or a Post as its' parent, and that SomeUser.parent could have another user or a group as its parent. Any thoughts?

    Read the article

  • in asp.net mvc is it possible to register routes somewhere other than application.Start()

    - by joe q.
    Hi, is it possible to create and register routes after Application.Start() is called? let's say have a controller, PersonController. With default routing, URLs could look something like www.site.com/Person/Edit/4, with 'Person' matching the controller. now imagine I have several users, some may prefer we use the term 'Friends'. I would like to use the same controller, and have /Friends/Edit/4 map to the same controller/action/id. Maybe someone else prefers /Comrades/Edit/4. with the naming preferences stored in a database, is there a way that I can dynamically create these routes at some point mid-application, after the user has logged in? thanks!

    Read the article

  • XPath: How to check multiple attributes across similar nodes

    - by Justin
    Hi, If I have some xml like: <root> <customers> <customer firstname="Joe" lastname="Bloggs" description="Member of the Bloggs family"/> <customer firstname="Joe" lastname="Soap" description="Member of the Soap family"/> <customer firstname="Fred" lastname="Bloggs" description="Member of the Bloggs family"/> <customer firstname="Jane" lastname="Bloggs" description="Is a member of the Bloggs family"/> </customers> </root> How do I get, in pure XPath - not XSLT - an xpath expression that detects rows where lastname is the same, but has a different description? So it would pull the last node above? Thanks a mill if you can help, been scratching at it for ages, and I can't find it by searching (apologies if it is) Cheers, J

    Read the article

  • Selected option in view when SIZE is greater than 1

    - by joe
    How do you get the selected option to be in view on page load? <select name="whatever" size="5"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7" selected>7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select>

    Read the article

  • Append message to JBoss Console using jboss-log4j.xml

    - by Random Joe
    I'm unable to append messages from my application to the JBoss console. The following are the changes that I made to the jboss-log4j.xml configuration file: <category name="com.tricubes"> <priority value="INFO"/> <appender-ref ref="CONSOLE"/> </category> Here is my code: public class OneToOneValidation2 { private static final Logger logger = Logger.getLogger("com.tricubes"); public boolean validate(byte[] fpImage, byte[] fpTemplate, String desc, String ticket) { ... logger.info("BES INFO: SOCKET MSG SENT " + intToByteArray(x)); ... return b; } } What am I missing? TIA!

    Read the article

  • How to write two-dimensional array to xml in Scala 2.8.0

    - by Shadowlands
    The following code (copied from a question from about a year ago) works fine under Scala 2.7.7, but does not behave correctly under Scala 2.8.0 (Beta 1, RC8). import scala.xml class Person(name : String, age : Int) { def toXml(): xml.Elem = <person><name>{ name }</name><age>{ age }</age></person> } def peopleToXml(people: Array[Person]): xml.Elem = { <people>{ for {person <- people} yield person.toXml }</people> } val data = Array(new Person("joe",40), new Person("mary", 35)) println(peopleToXml(data)) The output (according to 2.7.7) should be: <people><person><name>joe</name><age>40</age></person><person><name>mary</name><age>35</age></person></people> but instead comes out as: <people>\[Lscala.xml.Elem;@17821782</people> How do I get this to behave as it did in 2.7.x?

    Read the article

  • Custom app.config section with a simple list of "add" elements

    - by Joe
    How do I create a custom app.config section that is just a simple list of add elements? I have found a few examples (e.g. http://stackoverflow.com/questions/1316058) for custom sections that look like this: <RegisterCompanies> <Companies> <Company name="Tata Motors" code="Tata"/> <Company name="Honda Motors" code="Honda"/> </Companies> </RegisterCompanies> But how do I avoid the extra collection element ("Companies") so that it looks the same as the appSettings and connectionStrings sections? In other words, I'd like: <registerCompanies> <add name="Tata Motors" code="Tata"/> <add name="Honda Motors" code="Honda"/> </registerCompanies>

    Read the article

  • How do I know which include path will be used in PHP?

    - by Joe Majewski
    When I run phpinfo() and look by the Configuration category under PHP Core, I see a directive titled include_path, with a local value and a master value. In this case, my local value is set to .: ./include: ../include: /usr/share/php: /usr/share/php/smarty: /usr/share/pear and my master value is set to .: /usr/share/php: /usr/share/pear: /usr/share/php/pear: /usr/share/php/smarty The reason I am trying to learn how this works is because there is a file in the system I am working on titled Smarty.class.php, which I'm sure sounds very familiar to anyone who uses Smarty Templating Engine. One of the PHP files has the following includes: require_once("Smarty.class.php"); require_once("user_info_class.inc"); The file user_info_class.inc is in the same directory as the file making the include, which makes perfect sense to me, and is the way that I've always referenced files. I decided that I wanted to open up the Smarty.class.php file and had assumed it would be in the same directory, but it was not. After doing a bit of digging, I discovered those php_ini variables, and was finally able to locate the file in the directory usr/share/php/smarty/. So it would seem that when making an include, it follows some sort of order between the Local and Master values for the include_path. Assuming that my deductions were correct thus far, can someone explain the order in which PHP searches for the files to be included?

    Read the article

  • CTE to build a list of departments and managers (hierarchical)

    - by Milky Joe
    I need to generate a list of users that are managers, or managers of managers, for company departments. I have two tables; one details the departments and one contains the manager hierarchy (simplified): CREATE TABLE [dbo].[Manager]( [ManagerId] [int], [ParentManagerId] [int]) CREATE TABLE [dbo].[Department]( [DepartmentId] [int], [ManagerId] [int]) Basically, I'm trying to build a CTE that will give me a list of DepartmentIds, together with all ManagerIds that are in the manager hierarchy for that department. So... Say Manager 1 is the Manager for Department 1, and Manager 2 is Manager 1's Manager, and Manager 3 is Manager 2's Manager, I'd like to see: DepartmentId, ManagerId 1, 1 1, 2 1, 3 Basically, managers are able to deal with all of their sub-manager's departments. Building the CTE to return the Manager hierarchy was fairly simple, but I'm struggling to inject the Departments in there: WITH DepartmentManagers AS ( SELECT ManagerId, ParentManagerId, 0 AS Depth From Manager UNION ALL SELECT Manager.ManagerId, Manager.ParentManagerId, DepartmentManagers.Depth + 1 AS Depth FROM Manager INNER JOIN DepartmentManagers ON DepartmentManagers.ManagerId = Manager.ParentManagerId ) Can anyone help?

    Read the article

  • rotating circle with swipe question

    - by Joe
    Okay so I'm making something that basically works as a knob, but only half on the screen -- so I just need horizontal swipes to cause it to rotate. I have it nearly all sorted with one exception: if you change direction of your swipe in mid-swipe, the rotation doesn't change direction. I even can see the problem, but not sure what to do about a solution. So in my touchesMoved, I get the swipe into radians in the predictable way: CGFloat radians = atan2f(location.y - centerY, location.x - centerX); I then store radians, add/subtract it to previous rotation and then give the result to the CATransform3D. So the prob is that even though the swipe changes direction, there is a "balance" which doesn't allow an immediate change of direction. Does this make any sense?

    Read the article

  • Developing Job References

    - by Joe Smith
    How do you develop references for jobs? I have 6 years of programming experience spanning two jobs, but sadly I don't have a lot of people I can draw on as references. It's been several years since I left my last job, which was at a small company, and I've lost touch with the few people I knew there. I now work at another small company. I think I've gone as far as I can in my current position, and would like to look for greener pastures, but I can't exactly use my current boss as a reference, even though I have a very good repore with him. I'm sure he'd make a great reference down the road, but I'm afraid I'd insult him or jeopardize my current job by mentioning that I'm thinking of leaving and would like him to help me. I've applied to some jobs, and I have gotten several replies like, "Oh, you're exactly what we're looking for. Send us a couple references and we'll schedule an interview. Oh, no references? You must be a psychopath, nevermind." I've tried doing some small freelance work on the side, just so I can have a contact who can vouch for my work, but the competition for even small projects is pretty fierce and I can rarely devote adequate time to freelancing while holding a full time job. In addition, I often encounter a Catch-22 where a lot of freelancing jobs also require references. So how do programmers maintain existing references and develop new ones, especially while holding a full time job?

    Read the article

  • oracle hibernate + maven dependenciesm dbcp.basicdatasource exception

    - by Joe
    I'm trying to create a web application using maven, tomcat and hibernate. Now I'm getting a cannot find class for org.appache.commons.dbcp.basicdatasource for bean with name datasource... exception. Without the hibernate aspects it works fine, but if I add <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> <prop key="hibernate.hbm2ddl.auto">create</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingResources"> <list> </list> </property> </bean> to my applicationContext then I get the error. What I did was: -add org.hibernate to my pom -put ojdbc16.jar in my tomcat bin folder -add the above snippet to my applicationContext.xml I use a bat file to compile my project (using maven), copy it to my tomcat webapp folder and to start the server. Any input on what I'm doing wrong is welcome.

    Read the article

  • Creating a skin engine in MVC

    - by Joe
    Does anyone have any experience creating a skin engine for asp.net MVC? I know the suggested approach is to use flexible markup with CSS, but I would like the ability for a new view to be dropped in, and the application use that one instead of the default one. Basically, I want to know how to tell the framework (at run time) to look into a specific folder for the views/content, and if the item isn't there to check the default locations. I started to look into how the Oxite blog engine does it, but it seems like that might be a bit much for what I need (I am still looking through it, so I could be wrong.) Any help is appreciated.

    Read the article

  • Python, how to tell if screen is running.

    - by Joe Spoon
    Hello, I am very new to programming and am trying to run a python code to see if the screen program is running and if it is then to not run the rest of the code. This is what I have and it's not working. !/usr/bin/python import os var1 = os.system ('screen -r /root/screenlog/screen.log') fd = open("/root/screenlog/screen.log") content = fd.readline() while content: if content == "There is no screen to be resumed.": os.system ('/etc/init.d/tunnel.sh') print "The tunnel is now active." else: print "The tunnel is running." fd.close() I know there are probably several things here that don't need to be and quite a few that I'm missing. I will be running this program in cron. Thanks for any help.

    Read the article

  • Using named_scope with counts of child models

    - by Joe Cairns
    Hi, I have a simple parent object having many children. I'm trying to figure out how to use a named scope for bringing back just parents with specific numbers of children. Is this possible? class Foo < ActiveRecord::Base has_many :bars named_scope :with_no_bars, ... # count of bars == 0 named_scope :with_one_bar, ... # count of bars == 1 named_scope :with_more_than_one_bar, ... # count of bars > 1 end class Bar < ActiveRecord::Base belongs_to :foo end I'm hoping to do something like Foo.with_one_bar I could write methods on the parent class for something like this, but I'd rather have the power of the named scope

    Read the article

  • Django + Ajax

    - by Joe
    So, I am just starting to use jQuery with one of my Django projects, but I have a pretty noobie question. In a django view you have to return an HttpResponse object from the view, but sometimes I don't need to return anything. For instance, I might just be updating the database via ajax and don't need to send anything back. So my question is, what do you do in that situation? Thanks

    Read the article

  • How to port Iphone style app into Android?

    - by edwar12345
    first, please see the blog as the link showed below: http://blogs.nitobi.com/joe/2008/10/17/phonegap-now-for-android/comment-page-1/#comment-12918 the author made iPhone Style app in Android emulator, the pic showed below: http: blogs.nitobi.com/joe/wp-content/uploads/2008/10/droidgap.png if anyone knows, Would you please tell me how to make the iphone sytle app in android, as the pic shows? I checked the phonegap demo in the github, it's not the same as the picture showed in the blog. I am so curious about how can make iphone style app in Android? Since it need the Iphone OS to display such effect. Would anyone please tell me how to make it? so pity that the link doesn't work now: https: github.com/bowserj/gap/ your reply will be great appriciated. the same question i asked can be found with link: http: stackoverflow.com/questions/2786787/how-to-implement-iphone-titlebar-in-android

    Read the article

  • How to Store and Retrieve Images Using MsSQL (Server Management Studio)

    - by Joe Majewski
    I am having difficulties when trying to insert files into an MsSQL database. I'll try to break this down as best as I can: What data type should I be using to store image files (jpeg/png/gif/etc)? Right now my table is using the image data type, but I am curious if varbinary would be a better option. How would I go about inserting the image into the database? Does Microsoft SQL Server Management Studio have any built in functions that allow insertions of files into tables? If so, how is that done? Also, how could this be done through the use of an HTML form with PHP handling the input data and placing it into the table? How would I fetch the image from the table and display it on the page? I understand how to SELECT the cell's contents, but how would I go about translating that into a picture. Would I have to have a header(Content type: image/jpeg)? I have no problem doing any of these things with MySQL, but the MsSQL environment is still new to me, and I am working on a project for my job that requires the use of stored procedures to grab various data. Any and all help is appreciated. Thank you very much for your responses!

    Read the article

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