Daily Archives

Articles indexed Sunday January 2 2011

Page 14/27 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Argument type deduction, references and rvalues

    - by uj2
    Consider the situation where a function template needs to forward an argument while keeping it's lvalue-ness in case it's a non-const lvalue, but is itself agnostic to what the argument actually is, as in: template <typename T> void target(T&) { cout << "non-const lvalue"; } template <typename T> void target(const T&) { cout << "const lvalue or rvalue"; } template <typename T> void forward(T& x) { target(x); } When x is an rvalue, instead of T being deduced to a constant type, it gives an error: int x = 0; const int y = 0; forward(x); // T = int forward(y); // T = const int forward(0); // Hopefully, T = const int, but actually an error forward<const int>(0); // Works, T = const int It seems that for forward to handle rvalues (without calling for explicit template arguments) there needs to be an forward(const T&) overload, even though it's body would be an exact duplicate. Is there any way to avoid this duplication?

    Read the article

  • cant access nested ressource 'comments' in rails 3.0.1

    - by DannyRe
    Hey, I hope you can help me. /config/routes.rb resources :deadlines do resources :comments end /model/comment.rb class Comment < ActiveRecord::Base belongs_to :post, :class_name = "Post", :foreign_key = "post_id" end /model/post.rb class Post < ActiveRecord::Base has_many :comments end When I want to visit: http://localhost:3000/posts/1/comments/new it says: undefined method `comments_path' for #<#:0x4887138 in _form.html I use 'formtastic' and the _form.html.erb looks like this: <% semantic_form_for [@comment] do |form| % <% form.inputs do % <%= form.input :content % <% end % <% form.buttons do % <%= form.commit_button % <% end % <% end %

    Read the article

  • invite friends in a dialog in a Facebook application

    - by Shani1351
    I'm trying to create a Facebook application that displays a friend invite dialog within the application using Facebook's Javascript API (FB.ui). To do that I followed this tutorial I have two problems : The action url I've put in the request-form is "http://apps.facebook.com/appname/post_invite.php" but I see that the iframe source after the post is "http://mydomain.com/post_invite.php" and when this iframe tries to do : parent.closeInviteWidget(); I get an error saying : "Permission denied for < http: //mydomain.com (document.domain has not been set) to get property Window.closeInviteWidget from < http:// apps.facebook.com (document.domain=< http:// facebook.com)." The skip button inside the request-form opens the action url in a new window (new browser tab) and not post to itself like the invite button. How can I fix those problems? -------------------- UPDATE : -------------------------------- I've tried to do what ifaour said and changed the code to : function inviteFriends(user_name, category_id, category_name) { url = appBaseUrl + "/index.php?category_id=" + category_id; req = "<fb:req-choice url='" + url + "' label='Authorize My Application' />"; content = user_name + " opened a new category called " + category_name + ". " + req; action = 'post_invite.php'; fbmi_text = '<fb:request-form action="' + action + '" target="_self" method="post" invite="true" type="Invite" content="' + content + '" <fb:multi-friend-selector showborder="false" actiontext="Invite yor friends" email_invite="false" import_external_friends="false" /> </fb:request-form>'; FB.ui({ method:'fbml.dialog', width:'750px', fbml:fbmi_text }); } When I use FireBug and look at the invite form it looks like this: <form id="req_form_4d20682f73ddb6e71722794" content="I've opened a new category called dsfsd. <fb:req-choice url='http://apps.facebook.com/appname/index.php?category_id=60' label='Authorize My Application' /> type="Invite" invite="true" method="post" target="_self" action="http://apps.facebook.com/appname/post_invite.php"> ... </form> But I still get the same error : Permission denied for <http://mydomain.com> (document.domain has not been set) to get property Window.closeInviteWidget from <http://apps.facebook.com> (document.domain=<http://facebook.com>)...

    Read the article

  • what's called after returning from presentModalViewController / dismissModalViewControllerAnimated:

    - by Reinhard
    to show a modal uiview out of my mainView I use: [self presentModalViewController:myController animated:YES]; and in MyController I close that view with: [self dismissModalViewControllerAnimated:YES]; But how can I know in the mainView that the modal was finished (to redraw my table)? Currently I set a local variable to YES in my mainView after starting the modal view an react on viewWillAppear: [self presentModalViewController:myController animated:YES]; _reloadTableData = YES; -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; if (_reloadTableData) { _reloadTableData = NO; [_tableView reloadData]; } } Is there a better way to do so ?

    Read the article

  • How to inherit from a library in a MVC.NET view

    - by Dofs
    I am trying to implement CKFinder in my MVC.Net website, but the default setup only works for regular asp.net websites, so I am trying to alter it to work. One page inherits from a library CKFinder.Connector.Connector. In the old days my aspx would just inherit="CKFinder.Connector.Connector", but how is this done in MVC.NET? Is Inherits="System.Web.Mvc.ViewPage<CKFinder.Connector.Connector>" the same?

    Read the article

  • How to genrate a monochrome bit mask for a 32bit bitmap

    - by Mordachai
    Under Win32, it is a common technique to generate a monochrome bitmask from a bitmap for transparency use by doing the following: SetBkColor(hdcSource, clrTransparency); VERIFY(BitBlt(hdcMask, 0, 0, bm.bmWidth, bm.bmHeight, hdcSource, 0, 0, SRCCOPY)); This assumes that hdcSource is a memory DC holding the source image, and hdcMask is a memory DC holding a monochrome bitmap of the same size (so both are 32x32, but the source is 4 bit color, while the target is 1bit monochrome). However, this seems to fail for me when the source is 32 bit color + alpha. Instead of getting a monochrome bitmap in hdcMask, I get a mask that is all black. No bits get set to white (1). Whereas this works for the 4bit color source. My search-foo is failing, as I cannot seem to find any references to this particular problem. I have isolated that this is indeed the issue in my code: i.e. if I use a source bitmap that is 16 color (4bit), it works; if I use a 32 bit image, it produces the all-black mask. Is there an alternate method I should be using in the case of 32 bit color images? Is there an issue with the alpha channel that overrides the normal behavior of the above technique? Thanks for any help you may have to offer! ADDENDUM: I am still unable to find a technique that creates a valid monochrome bitmap for my GDI+ produced source bitmap. I have somewhat alleviated my particular issue by simply not generating a monochrome bitmask at all, and instead I'm using TransparentBlt(), which seems to get it right (but I don't know what they're doing internally that's any different that allows them to correctly mask the image). It might be useful to have a really good, working function: HBITMAP CreateTransparencyMask(HDC hdc, HBITMAP hSource, COLORREF crTransparency); Where it always creates a valid transparency mask, regardless of the color depth of hSource. Ideas?

    Read the article

  • Best wrapper for simultaneous API requests?

    - by bluebit
    I am looking for the easiest, simplest way to access web APIs that return either JSON or XML, with concurrent requests. For example, I would like to call the twitter search API and return 5 pages of results at the same time (5 requests). The results should ideally be integrated and returned in one array of hashes. I have about 15 APIs that I will be using, and already have code to access them individually (using simple a NET HTTP request) and parse them, but I need to make these requests concurrent in the easiest way possible. Additionally, any error handling for JSON/XML parsing is a bonus.

    Read the article

  • Move SELECT to SQL Server side

    - by noober
    Hello all, I have an SQLCLR trigger. It contains a large and messy SELECT inside, with parts like: (CASE WHEN EXISTS(SELECT * FROM INSERTED I WHERE I.ID = R.ID) THEN '1' ELSE '0' END) AS IsUpdated -- Is selected row just added? as well as JOINs etc. I like to have the result as a single table with all included. Question 1. Can I move this SELECT to SQL Server side? If yes, how to do this? Saying "move", I mean to create a stored procedure or something else that can be executed before reading dataset in while cycle. The 2 following questions make sense only if answer is "yes". Why do I want to move SELECT? First off, I don't like mixing SQL with C# code. At second, I suppose that server-side queries run faster, since the server have more chances to cache them. Question 2. Am I right? Is it some sort of optimizing? Also, the SELECT contains constant strings, but they are localizable. For instance, WHERE R.Status = "Enabled" "Enabled" should be changed for French, German etc. So, I want to write 2 static methods -- OnCreate and OnDestroy -- then mark them as stored procedures. When registering/unregistering my assembly on server side, just call them respectively. In OnCreate format the SELECT string, replacing {0}, {1}... with required values from the assembly resources. Then I can localize resources only, not every script. Question 3. Is it good idea? Is there an existing attribute to mark methods to be executed by SQL Server automatically after (un)registartion an assembly? Regards,

    Read the article

  • Great SharePoint Community Resources

    - by Enrique Lima
    3 sites that any person working with SharePoint should visit are: SharePoint Magazine SharePoint Magazine is an online magazine dedicated to the world of SharePoint and related Information Worker Technologies. End User SharePoint Community driven content, at this point in time the site is a historical archive of content released. Nothing But SharePoint I see this as the natural evolution of EndUserSharePoint.com Follows on the same great principle of community driven content, but expanding from the world of End User to the IT Pro and Developer realms.

    Read the article

  • Ubuntu 64bit Xen DomU Issues after upgrade from Karmic to Lucid

    - by Shoaibi
    I was upgrading my servers today and it all went fine except the last machine which has the following issues: [Resolved using http://www.ndchost.com/wiki/server-administration/upgrade-ubuntu-pre-10.04#post-1004-upgradefinal-steps] No login prompt on console Done. Begin: Mounting root file system... ... Begin: Running /scripts/local-top ... Done. [ 0.545705] blkfront: xvda: barriers enabled [ 0.546949] xvda: xvda1 [ 0.549961] blkfront: xvde: barriers enabled [ 0.550619] xvde: xvde1 xvde2 Begin: Running /scripts/local-premount ... Done. [ 0.870385] kjournald starting. Commit interval 5 seconds [ 0.870449] EXT3-fs: mounted filesystem with ordered data mode. Begin: Running /scripts/local-bottom ... Done. Done. Begin: Running /scripts/init-bottom ... Done. Also tried by pressing ENTER and CTRL+C many times, no use. Resolved: [/tmp was mounted as noexec, changing that fix it]: I get errors when i try to re-install udev in single user mode: Unpacking replacement udev ... Processing triggers for ureadahead ... ureadahead will be reprofiled on next reboot Processing triggers for man-db ... Setting up udev (151-12.1) ... udev start/running, process 1003 Removing `local diversion of /sbin/udevadm to /sbin/udevadm.upgrade' update-initramfs: deferring update (trigger activated) Processing triggers for initramfs-tools ... update-initramfs: Generating /boot/initrd.img-2.6.32-25-server /usr/sbin/mkinitramfs: 329: /tmp/mkinitramfs_yuuTSc/scripts/local-premount/fixrtc: Permission denied /usr/sbin/mkinitramfs: 329: /tmp/mkinitramfs_yuuTSc/scripts/local-premount/ntfs_3g: Permission denied /usr/sbin/mkinitramfs: 329: /tmp/mkinitramfs_yuuTSc/scripts/local-premount/resume: Permission denied /usr/sbin/mkinitramfs: 329: /tmp/mkinitramfs_yuuTSc/scripts/nfs-top/udev: Permission denied /usr/sbin/mkinitramfs: 329: /tmp/mkinitramfs_yuuTSc/scripts/panic/console_setup: Permission denied /usr/sbin/mkinitramfs: 329: /tmp/mkinitramfs_yuuTSc/scripts/init-top/all_generic_ide: Permission denied /usr/sbin/mkinitramfs: 329: /tmp/mkinitramfs_yuuTSc/scripts/init-top/blacklist: Permission denied /usr/sbin/mkinitramfs: 329: /tmp/mkinitramfs_yuuTSc/scripts/init-top/udev: Permission denied /usr/sbin/mkinitramfs: 329: /tmp/mkinitramfs_yuuTSc/scripts/init-bottom/udev: Permission denied /usr/sbin/mkinitramfs: 329: /tmp/mkinitramfs_yuuTSc/scripts/local-bottom/ntfs_3g: Permission denied

    Read the article

  • pyexiv2 build error src/exiv2wrapper.hpp:32:29: error: exiv2/preview.hpp: No such file or directory

    - by Jake
    The other day I used apt-get install python-pyexiv2 on my ubuntu server, but it seems to have given me an old version. It's not compatible with the code I wrote in my local development environment so I'd like to update it. I downloaded the latest tar.gz from the website, extracted it and ran scons as per the readme. But it will not build, I get the error src/exiv2wrapper.hpp:32:29: error: exiv2/preview.hpp: No such file or directory I've also user apt-get to install libboost-python-dev and libexiv2-dev Can anyone help me on this?

    Read the article

  • How to make the PC speaker beep from the Windows 7 command prompt?

    - by oKtosiTe
    I'm running some lengthy video encodes using the Handbrake command line interface. After all my encodes are done, I would like to have the PC speaker beep, as I usually turn my large external speakers off. On Linux I would install the "beep" package, but so far I haven't found such a program for Windows 7. Possibly related links: System "Beep" sound does not function in Windows Vista x64 with HD Audio devices (I am indeed using an HD Audio device: the SoundMAX ADI1986A) What’s up with the Beep driver in Windows 7?

    Read the article

  • Keyboard causing freezes

    - by fluteflute
    My problem started on Windows XP: a computer (that was working fine for many years) had a problem, that I can't quite remember (may have been to do with the startup process) - but I solved it by swapping the keyboard with one on another machine. Now for several years the problematic keyboard has been working fine - on my main machine that runs Ubuntu. I also dual boot Windows XP - and have had no problems on either OS. However I recently installed Ubuntu 11.04 Natty (pre-alpha) and found that any keyboard press causes freezes. (All still works fine on Ubuntu 10.10 and 10.04 and Windows XP) Just wondering why I might be experiencing this? Seems strange to me that's its not consistent.

    Read the article

  • I believe I need a wireless access point, but can I do it with a wifi router?

    - by Flotsam N. Jetsam
    My needs are simple, I think: I have a laptop upstairs with a usb wifi that I use to connect to my neighbor's wifi which I share (with their knowledge). I have a laser printer downstairs that my wife doesn't wants to stay down there (big, bulky and ugly), but that we both need to print stuff off. It has wired networking and I have wired hub and router down there. The usb wifi on the laptop has absolutley the best reception I've ever seen or heard of. I cannot get onto the neighbor's net with the thing downstairs though--sortof in the ground. What do I need downstairs to give printer access to my laptop wirelessly? One thing I can't do in this solution is have a computer on downstairs, so I would think that would eliminate a usb solution.

    Read the article

  • Nvidia driver on Windows 7 causing black screen

    - by inKit
    I have just installed Windows 7 on a desktop machine and for the first time ever have had a really tough time doing so, its normally a nice smooth install. This time I found that the monitor would simply go black after completing the installation. I tried reinstalling about 3 times and this did not help. After much searching I discovered that it was the nvidia drivers that were playing up with win 7, so i booted into safe mode, disabled the device, then rebooted to complete the installation. Windows 7 now works fine as long as the nvidia 9600 gt video card is disabled. The moment I enable it, the system requires a reboot and the screen will go black before even getting to the log in screen. I have tried downloading the latest driver and installing it manually, I have also tried uninstalling the device and allowing windows 7 to install it itself. Nothing seems to work. any clues?

    Read the article

  • Week in Geek: 4chan Falls Victim to DDoS Attack Edition

    - by Asian Angel
    This week we learned how to tweak the low battery action on a Windows 7 laptop, access an eBook collection anywhere in the world, “extend iPad battery life, batch resize photos, & sync massive music collections”, went on a reign of destruction with Snow Crusher, and had fun decorating our desktops with abstract icon collections. Photo by pasukaru76. Random Geek Links We have included extra news article goodness to help you catch up on any developments that you may have missed during the holiday break this past week. Note: The three 27C3 articles listed here represent three different presentations at the 27th Chaos Communication Congress hacker conference. 4chan victim of DDoS as FBI investigates role in PayPal attack Users of 4chan may have gotten a taste of their own medicine after the site was knocked offline by a DDoS attack from an unknown origin early Thursday morning. Report: FBI seizes server in probe of WikiLeaks attacks The FBI has seized a server in Texas as part of its hunt for the groups behind the pro-WikiLeaks denial-of-service attacks launched in December against PayPal, Visa, MasterCard, and others. Mozilla exposes older user-account database Mozilla has disabled 44,000 older user accounts for its Firefox add-ons site after a security researcher found part of a database of the account information on a publicly available server. Data breach affects 4.9 million Honda customers Japanese automaker Honda has put some 2.2 million customers in the United States on a security breach alert after a database containing information on the owners and their cars was hacked. Chinese Trojan discovered in Android games An Android-based Trojan called “Geinimi” has been discovered in the wild and the Trojan is capable of sending personal information to remote servers and exhibits botnet-like behavior. 27C3 presentation claims many mobiles vulnerable to SMS attacks According to security experts, an ‘SMS of death’ threatens to disable many current Sony Ericsson, Samsung, Motorola, Micromax and LG mobiles. 27C3: GSM cell phones even easier to tap Security researchers have demonstrated how open source software on a number of revamped, entry-level cell phones can decrypt and record mobile phone calls in the GSM network. 27C3: danger lurks in PDF documents Security researcher Julia Wolf has pointed out numerous, previously hardly known, security problems in connection with Adobe’s PDF standard. Critical update for WordPress A critical update has been made available for WordPress in the form of version 3.0.4. The update fixes a security bug in WordPress’s KSES library. McAfee Labs Predicts Geolocation, Mobile Devices and Apple Will Top the List of Targets for Emerging Threats in 2011 The list comprises 2010’s most buzzed about platforms and services, including Google’s Android, Apple’s iPhone, foursquare, Google TV and the Mac OS X platform, which are all expected to become major targets for cybercriminals. McAfee Labs also predicts that politically motivated attacks will be on the rise. Windows Phone 7 piracy materializes with FreeMarketplace A proof-of-concept application, FreeMarketplace, that allows any Windows Phone 7 application to be downloaded and installed free of charge has been developed. Empty email accounts, and some bad buzz for Hotmail In the past few days, a number of Hotmail users have been complaining about a rather disconcerting issue: their Hotmail accounts, some up to 10 years old, appear completely empty.  No emails, no folders, nothing, just what appears to be a new account. Reports: Nintendo warns of 3DS risk for kids Nintendo has reportedly issued a warning that the 3DS, its eagerly awaited glasses-free 3D portable gaming device, should not be used by children under 6 when the gadget is in 3D-viewing mode. Google eyes ‘cloaking’ as next antispam target Google plans to take a closer look at the practice of “cloaking,” or presenting one look to a Googlebot crawling one’s site while presenting another look to users. Facebook, Twitter stock trading drawing SEC eye? The high degree of investor interest in shares of hot Silicon Valley companies that aren’t yet publicly traded–like Facebook, Twitter, LinkedIn, and Zynga–may be leading to scrutiny from the U.S. Securities and Exchange Commission (SEC). Random TinyHacker Links Photo by jcraveiro. Exciting Software Set for Release in 2011 A few bloggers from great websites such as How-To Geek, Guiding Tech and 7 Tutorials took the time to sit down and talk about their software wishes for 2011. Take the time to read it and share… Wikileaks Infopr0n An infographic detailing the quest to plug WikiLeaks. The New York Times Guide to Mobile Apps A growing collection of all mobile app coverage by the New York Times as well as lists of favorite apps from Times writers. 7,000,000,000 (Video) A fascinating look at the world’s population via National Geographic Magazine. Super User Questions Check out the great answers to these hot questions from Super User. How to use a Personal computer as a Linux web server for development purposes? How to link processing power of old computers together? Free virtualization tool for testing suspicious files? Why do some actions not work with Remote Desktop? What is the simplest way to send a large batch of pictures to a distant friend or colleague? How-To Geek Weekly Article Recap Had a busy week and need to get caught up on your HTG reading? Then sit back and relax while enjoying these hot posts full of how-to roundup goodness. The 50 Best How-To Geek Windows Articles of 2010 The 20 Best How-To Geek Explainer Topics for 2010 The 20 Best How-To Geek Linux Articles of 2010 How to Search Just the Site You’re Viewing Using Google Search Ask the Readers: Backing Your Files Up – Local Storage versus the Cloud One Year Ago on How-To Geek Need more how-to geekiness for your weekend? Then look through this great batch of articles from one year ago that focus on dual-booting and O.S. installation goodness. Dual Boot Your Pre-Installed Windows 7 Computer with Vista Dual Boot Your Pre-Installed Windows 7 Computer with XP How To Setup a USB Flash Drive to Install Windows 7 Dual Boot Your Pre-Installed Windows 7 Computer with Ubuntu Easily Install Ubuntu Linux with Windows Using the Wubi Installer The Geek Note We hope that you and your families have had a terrific holiday break as everyone prepares to return to work and school this week. Remember to keep those great tips coming in to us at [email protected]! Photo by pjbeardsley. Latest Features How-To Geek ETC The 20 Best How-To Geek Linux Articles of 2010 The 50 Best How-To Geek Windows Articles of 2010 The 20 Best How-To Geek Explainer Topics for 2010 How to Disable Caps Lock Key in Windows 7 or Vista How to Use the Avira Rescue CD to Clean Your Infected PC The Complete List of iPad Tips, Tricks, and Tutorials Tune Pop Enhances Android Music Notifications Another Busy Night in Gotham City Wallpaper Classic Super Mario Brothers Theme for Chrome and Iron Experimental Firefox Builds Put Tabs on the Title Bar (Available for Download) Android Trojan Found in the Wild Chaos, Panic, and Disorder Wallpaper

    Read the article

  • What are the benefits of NoSQL?

    - by geekbrit
    I'm struggling to see how NoSQL brings any advantages to a system, so I'm interested in hearing from people who have chosen to use it, both the reasons they chose NoSQL, and positive and negative experiences in implementation and use. My first impressions are that NoSQL is a product of the availability of very large, very cheap storage; it seems that a million record database could easily have a 100MByte overhead in field labels embedded in the records. This goes against one of my software design instincts - remove redundancy in code and data whenever practical. However, NoSQL is being used with success in large high-traffic systems, so I must be missing something, looking forward to your responses.

    Read the article

  • Do you test your SQL/HQL/Criteria ?

    - by 0101
    Do you test your SQL or SQL generated by your database framework? There are frameworks like DbUnit that allow you to create real in-memory database and execute real SQL. But its very hard to use(not developer-friendly so to speak), because you need to first prepare test data(and it should not be shared between tests). P.S. I don't mean mocking database or framework's database methods, but tests that make you 99% sure that your SQL is working even after some hardcore refactoring.

    Read the article

  • Conky: Possible to automatically display the correct days of the week?

    - by begtognen
    I'd like to tweak my Conky so it automatically displays the days of the week correctly. So for example, if TODAY were Tuesday, it would look like this: Tuesday Wednesday Thursday Friday [etc.] And then tomorrow, automatically, it would look like this: Wednesday Thursday Friday [etc.] I know I can get it to display today's date like this: ${time %A} But how do I get it to display tomorrow's date? Thanks so much for any help/suggestions.

    Read the article

  • not being able to access any sudo function on my pc

    - by explorex
    Hi, I am not being to access any functions in my desktop and I don't have an OS besides Ubuntu 10.04 Lucid Linux and I am new to ubuntu. I think I rebooted my computer thinking that Google Chrome crashed. I opened Google Chrome but it showed opening message but never opened so I restarted my computer. and when my system was loading ('i was playing with keyboard dont know what I typed') and when by ubutnu loaded, I was unable to access anything some of characteristics are listed below I cannot hear any sound I cannot access wired ethernet connection on the right corner where I usually enable to access interne and I have no internet. There is no local apache server either. when ever I try to start apacer I get setuid must be root or something. When I type sudo then I get message setuid must be root. I cannot access orther external storage devices like pendrive and portable hard drive and cannot mount my other drives with FAT32 filesystem. When I try to start my apache webserver with out typing sudo then I get message cannnot open socket or something like it. EDIT:: i remember also doing command chown -R www-data / earlier and got error message EDIT:: and i cannot shutdown my computer, it only logs off

    Read the article

  • My self-generated CA is nearing it's end-of-life; what are the best practices for CA-rollover?

    - by Alphager
    Some buddies and me banded together to rent a small server to use for email, web-hosting and jabber. Early on we decided to generate our own Certificate Authority(CA) and sign all our certificates with that CA. It worked great! However, the original CA-cert is nearing it's end-of-life (it expires in five months). Obviously, we will have to generate a new cert and install it on all our computers. Are there any best practices we should follow? We have to re-generate all certs and sign them with the new CA, right?

    Read the article

  • 'Binary XML' for game data?

    - by bluescrn
    I'm working on a level editing tool that saves its data as XML. This is ideal during development, as it's painless to make small changes to the data format, and it works nicely with tree-like data. The downside, though, is that the XML files are rather bloated, mostly due to duplication of tag and attribute names. Also due to numeric data taking significantly more space than using native datatypes. A small level could easily end up as 1Mb+. I want to get these sizes down significantly, especially if the system is to be used for a game on the iPhone or other devices with relatively limited memory. The optimal solution, for memory and performance, would be to convert the XML to a binary level format. But I don't want to do this. I want to keep the format fairly flexible. XML makes it very easy to add new attributes to objects, and give them a default value if an old version of the data is loaded. So I want to keep with the hierarchy of nodes, with attributes as name-value pairs. But I need to store this in a more compact format - to remove the massive duplication of tag/attribute names. Maybe also to give attributes native types, so, for example floating-point data is stored as 4 bytes per float, not as a text string. Google/Wikipedia reveal that 'binary XML' is hardly a new problem - it's been solved a number of times already. Has anyone here got experience with any of the existing systems/standards? - are any ideal for games use - with a free, lightweight and cross-platform parser/loader library (C/C++) available? Or should I reinvent this wheel myself? Or am I better off forgetting the ideal, and just compressing my raw .xml data (it should pack well with zip-like compression), and just taking the memory/performance hit on-load?

    Read the article

  • howto catch jQuery for multiple links but not all

    - by user247245
    I'm trying to dig into jQuery but would like some feedback on how to do things the best way, I have a list with items, which each contains a hidden div that should show upon click on it's parent, list div:ed item1 with link hidden div div:ed item2 with link hidden div .. My current solution is to trace the calling link by it's id and then reusing that ID for showing the correct hidden one: $(document).ready(function() { //jQ should only trigger on links with id="cmLinkINT" $("a").click(function() { //see if it's a comment request. var s = $(this).attr("id"); if (s.indexOf('cmLink') != -1) { //ok, it was a 'show'-link, get the id.. var j = s.substring(6); //ok, now I have the id i want to show (detailsINT) return false; } }); }); What's not clear to me is the best approach, Should I use id for requesting a or trace the id of the parent div. How to avoid that the code triggers on any link? Class? Thankful for any feedback, regards //t

    Read the article

  • Som maps problem in matlab

    - by Serdar Demir
    I have a text file that include data. My text file: young, myopic, no, reduced, no young, myopic, no, normal, soft young, myopic, yes, reduced, no young, myopic, yes, normal, hard young, hyperopia, no, reduced, no young, hyperopia, no, normal, soft young, hyperopia, yes, reduced, no young, hyperopia, yes, normal, hard I read my text file load method %young=1 %myopic=2 %no=3 etc. load iris.txt net = newsom(1,[1 5]); [net,tr] = train(net,1); plotsomplanes(net); Error code: ??? Undefined function or method 'plotsomplanes' for input arguments of type 'network'.

    Read the article

  • Show iPad keyboard on select, focus or always (jQuery)

    - by Ryan
    I have a web app that is using jQuery to replace the RETURN key with TAB so that when I user presses return the form is not submitted but rather the cursor moves to the next text field. This works in all browsers but only 1/2 works on the iPad. On the iPad the next field is highlighted but the keyboard is hidden. How can I keep the keyboard visible or force it somehow? Here's my code (thanks to http://thinksimply.com/blog/jquery-enter-tab): function checkForEnter (event) { if (event.keyCode == 13) { currentBoxNumber = textboxes.index(this); if (textboxes[currentBoxNumber + 1] != null) { nextBox = textboxes[currentBoxNumber + 1] nextBox.focus(); nextBox.select(); event.preventDefault(); return false; } } } Drupal.behaviors.formFields = function(context) { $('input[type="text"]').focus(function() { $(this).removeClass("idleField").addClass("focusField"); }); $('input[type="text"]').blur(function() { $(this).removeClass("focusField").addClass("idleField"); }); // replaces the enter/return key function with tab textboxes = $("input.form-text"); if ($.browser.mozilla) { $(textboxes).keypress (checkForEnter); } else { $(textboxes).keydown (checkForEnter); } };

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >