Daily Archives

Articles indexed Sunday June 17 2012

Page 4/15 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to store a function in a member of class? (Using function as callback)

    - by Dane
    I want to store a function as a class member and call it inside the class? Pretty much like a callback function. My class draw a document but every document must drawn differently. So I want to assign a function (written outside of the class) into one of the members of the class and then call it when I want to draw the document. This function mostly is responsible for transforming objects according to each specific document. Here is my class: class CDocument { public: CDocument(); ~CDocument(); void *TransFunc(); } void Transform() { } int main() CDocument* Doc = new CDocument(); Doc->TransFunc = Transform(); } I know that this is probably simple question, but I couldn't find the answer by googling or searching SO.

    Read the article

  • How to efficiently store and update binary data in Mongodb?

    - by Rocketman
    I am storing a large binary array within a document. I wish to continually add bytes to this array and sometimes change the value of existing bytes. I was looking for some $append_bytes and $replace_bytes type of modifiers but it appears that the best I can do is $push for arrays. It seems like this would be doable by performing seek-write type operations if I had access somehow to the underlying bson on disk, but it does not appear to me that there is anyway to do this in mongodb (and probably for good reason). If I were instead to just query this binary array, edit or add to it, and then update the document by rewriting the entire field, how costly will this be? Each binary array will be on the order of 1-2MB, and updates occur once every 5 minutes and across 1000s of documents. Worse, yet there is no easy way to spread these out (in time) and they will usually be happening close to one another on the 5 minute intervals. Does anyone have a good feel for how disastrous this will be? Seems like it would be problematic. An alternative would be to store this binary data as separate files on disk, implement a thread pool to efficiently manipulate the files on disk, and reference the filename from my mongodb document. (I'm using python and pymongo so I was looking at pytables). I'd prefer to avoid this though if possible. Is there any other alternative that I am overlooking here? Thanks in advnace.

    Read the article

  • How to set a bean property before executing this f:event listener

    - by user
    How to set a bean property from jsf page before executing this f:event listener: <f:event type="preRenderComponent" listener="bean.method}"/> I tried the below code but it does not set the value to the bean property. <f:event type="preRenderComponent" listener="bean.method}"> <f:setPropertyActionListener target="#{bean.howMany}" value="2"/> </f:event> JSF2.1.6 with PF 3.3 EDIT Any issues with this below code? (This works! but I just want to confirm if there are any issues with this!?) <f:event type="preRenderComponent" listener="#{bean.setHowMany(15)}"/> <f:event type="preRenderComponent" listener="#{bean.method}"/>

    Read the article

  • Printf is not printing anything to output? C++ SDL

    - by Qasim
    I am trying to use "printf" in my Visual C++ project however it is not working. Using Lazy Foo's tutorial, I set up SDL in my project, but when I play it, printf doesnt do anything. #include "SDL.h" #include <stdio.h> int main( int argc, char* args[] ) { printf("Testing"); return 0; } The output looks like this: The program '[4664] SDL Testing.exe: Native' has exited with code 0 (0x0). And that's about it. What could be wrong?

    Read the article

  • Facebook graph API post to user's wall

    - by Lance
    I'm using the FB graph api to post content to the user's wall. I orginally tried using this method: $wall_post = array(array('message' => 'predicted the', 'name' => 'predicted the'), array('message' => $winning_team, 'name' => $winning_team, 'link' => 'http://www.sportannica.com/teams.php?team='.$winning_team.'&amp;year=2012'), array('message' => 'to beat the', 'name' => 'to beat the',), array('message' => $losing_team, 'name' => $losing_team, 'link' => 'http://www.sportannica.com/teams.php?team='.$losing_team.'&amp;year=2012'), array('message' => 'on '.$game_date.'', 'name' => 'on '.$game_date.''), array('picture' => 'http://www.sportannica.com/img/team_icons/current_season_logos/large/'.$winning_team.'.png')); $res = $facebook->api('/me/feed/', 'post', '$wall_post'); But, much to my surprise, you can't post multiple links to a users wall. So, now I'm using the graph api to post content to a user's wall much like the way spotify does. So, now I've figured out that I need to create custom actions and objects with the open graph dashboard. So, I've created the "predict" action and gave it permission to edit the object "game." So, now I have the code: $facebook = new Facebook(array( 'appId' => 'appID', 'secret' => 'SECRET', 'cookie' => true )); $access_token = $facebook->getAccessToken(); $user = $facebook->getUser(); if($user != 0) { curl -F 'access_token='$.access_token.'' \ -F 'away_team=New York Yankees' \ -F 'home_team=New York Mets' \ -F 'match=http://samples.ogp.me/413385652011237' \ 'https://graph.facebook.com/me/predict-edit-add:predict' } I keep getting an error reading: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING Any ideas?

    Read the article

  • How should backbone.js handle a GET request that returns no results?

    - by Nyxynyx
    I have a number of text input elements that when its values are changed, will trigger a fetch on listingListView's collection listingCollection, which then updates listingListView with the new data via the function listingListView.refreshList as shown below. I am using PHP/Codeigniter to expose a RESTful API. Problem: Everything works fine if there are results retrieved from the fetch(). However, when the filters results in no result being returned, how should the server side and the client side handle it? Currently Chrome's javascript console displays a 404 error and in the Network tab, the XHR request is highlighted in red. All I want to do in the event of zero results returned, is to blank the listingListView and show a message like (No results returned) and not throw any errors in the javascript console. Thanks! PHP Code function listings_get() { // Get filters $price_min = $this->get('price_min'); $this->load->model('app_model'); $results = $this->app_model->get_listings($price_min); if($results) $this->response($results); else $this->response(NULL); } JS Code window.ListingListView = Backbone.View.extend({ tagName: 'table', initialize: function() { this.model.bind('reset', this.refreshList, this); this.model.bind('add', function(listing) { $(this.el).append(new ListingListItemView({ model: listing }).render().el); }, this); }, render: function() { _.each(this.model.models, function(listing) { $(this.el).append(new ListingListItemView({ model: listing }).render().el); }, this); return this; }, close: function() { $(this.el).unbind(); $(this.el).empty(); }, refreshList: function() { $(this.el).empty(); this.render(); } });

    Read the article

  • Unknown Entity namespace alias in symfony2

    - by Zoha Ali Khan
    Hey I have two bundles in my symfony2 project. one is Bundle and the other one is PatentBundle. My app/config/route.yml file is MunichInnovationGroupPatentBundle: resource: "@MunichInnovationGroupPatentBundle/Controller/" type: annotation prefix: / defaults: { _controller: "MunichInnovationGroupPatentBundle:Default:index" } MunichInnovationGroupBundle: resource: "@MunichInnovationGroupBundle/Controller/" type: annotation prefix: /v1 defaults: { _controller: "MunichInnovationGroupBundle:Patent:index" } login_check: pattern: /login_check logout: pattern: /logout inside my controller i have <?php namespace MunichInnovationGroup\PatentBundle\Controller; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; use JMS\SecurityExtraPatentBundle\Annotation\Secure; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\Security\Core\SecurityContext; use MunichInnovationGroup\PatentBundle\Entity\Log; use MunichInnovationGroup\PatentBundle\Entity\UserPatent; use MunichInnovationGroup\PatentBundle\Entity\PmPortfolios; use MunichInnovationGroup\PatentBundle\Entity\UmUsers; use MunichInnovationGroup\PatentBundle\Entity\PmPatentgroups; use MunichInnovationGroup\PatentBundle\Form\PortfolioType; use MunichInnovationGroup\PatentBundle\Util\SecurityHelper; use Exception; /** * Portfolio controller. * @Route("/portfolio") */ class PortfolioController extends Controller { /** * Index action. * * @Route("/", name="v2_pm_portfolio") * @Template("MunichInnovationGroupPatentBundle:Portfolio:index.html.twig") */ public function indexAction(Request $request) { $portfolios = $this->getDoctrine() ->getRepository('MunichInnovationGroupPatentBundle:PmPortfolios') ->findBy(array('user' => '$user_id')); // rest of the method } when i try to load localhost/web/app_dev.php/portfolio It says Unknown Entity namespace alias 'MunichInnovationGroupPatentBundle'. I am unable to figure out this error please help me if anyone has any idea I googled it a lot :( Thanks in advance 500 Internal Server Error - ORMException

    Read the article

  • Xcode/Interface Builder Mac App Development

    - by user1459546
    Well i want from the drop down menu(Menu Item List) one item to be working as an link, to open an url/website in safari - thats it. When this is so simple, why no one come up with a clue here - I tried many different ways in Xcode, with Apple Xcode Samples... i think i need an AppDelegate.m, drag or link some parts, get actions... i failed to get it going somewhere - now i'm lost. Any advice/help/link/tip would be much appreciate to solve this "simple" issue... Using Xcode/Interface Builder 3.2.6 - Please help or i go totally mad, insane and i will crash my f...ing mac right now - Thanks

    Read the article

  • How to redirect on apache after running a script through cgi

    - by Yotam
    I have an ubuntu machine which I have installed apache on. I want to use a web page to run some simple shell script through cgi and then go back to my home screen. I also want to the go-back step to be automatic. I have set a redirect in my apache.conf which works fine but the script doesn't run at all. Is there a way to run the script and only then apply the redirect? Comment: I think this may be the answer but I'm not sure.

    Read the article

  • autologin component doesn't work on remote server

    - by user606521
    I am using autologin component from http://milesj.me/code/cakephp/auto-login (v 3.5.1). It works on my localhost WAMP server but fails on remote server. I am using this settings in beforeFilter() callback: $this->AutoLogin->settings = array( // Model settings 'model' => 'User', 'username' => 'username', 'password' => 'password', // Controller settings 'plugin' => '', 'controller' => 'users', // Cookie settings 'cookieName' => 'rememberMe', 'expires' => '+1 month', // Process logic 'active' => true, 'redirect' => true, 'requirePrompt' => true ); On remote server it simply doesn't autolog users after the browser was closed. I can't figure out what may cause the problem. -------------------- edit I figured out what is causing the problem but I don't know how to fix this. First of all cookie is set like this: $this->Cookie->write('key',array('username' => 'someusername', 'hash' => 'somehash', ...) ); Then it's readed like this: $cookie = $this->Cookie->read('key'); On my WAMP server $cookie is array('username' => 'someusername', 'hash' => 'somehash', ...) and on remote server returned $cookie is string(159) "{\"username\":\"YWxlay5iYXJzsdsdZXdza2ldssd21haWwuY29t\",\"password\":\"YWxlazc3ODEy\",\"hash\":\"aa15bffff9ca12cdcgfgb351d8bfg2f370bf458\",\"time\":1339923926}" and it should be: array( 'username' => "YWxlay5iYXJzsdsdZXdza2ldssd21haWwuY29t", 'password' => "YWxlazc3ODEy", ...) Why the retuned cookie is string not array?

    Read the article

  • Simple regex split

    - by user1383058
    I have the following string: string = "Peter Pan, Pete Sampras; Little Pete" And I need to split it up by name: split_string = ["Peter Pan", "Pete Sampras", "Little Pete"] I am trying to use re.findall but am having a bit of trouble with it: print re.findall(r'[,;]', string) [";", ";", ";"] What am I doing wrong here and how would I properly use re.findall here or an equivalent to split up the string?

    Read the article

  • Unicorn: Which number of worker processes to use?

    - by blackbird07
    I am running a Ruby on Rails app on a virtual Linux server that is capped at 1GB RAM. Currently, I am constantly hitting the limit and would like to optimize memory utilization. One option I am looking at is reducing the number of unicorn workers. So what is the best way to determine the number of unicorn workers to use? The current setting is 10 workers, but the maximum number of requests per second I have seen on Google Analytics Real-Time is 3 (only scored once at a peak time; in 99% of the time not going above 1 request per second). So is it a save assumption that I can - for now - go with 4 workers, leaving room for unexpected amounts of requests? What are the metrics I should have a look at for determining the number of workers and what are the tools I can use for that on my Ubuntu machine?

    Read the article

  • New Facebook like button HTML validation

    - by Eric Di Bari
    After adding the new facebook like button to my page, it no longer validates using XHTML strict. The two errors I come across are: All of the "meta property" tags say that "there is no attribute "property"" All of the variables used in the like button line are listed that there are no attributes for it. The line is as follows: <fb:like href="http://www.pampamanta.org" layout="button_count" show_faces="false" width="120" action="like" font="arial" colorscheme="light"></fb:like>

    Read the article

  • HTTP Error 403.18 - Forbidden - asp.net mvc web api

    - by CoffeeCode
    I have deployed the default asp.net mvc 4 web api project to my windows server 2008 RC and am experiensing some issues with calling the web api actions. I'm quite new in the server/iis configuration part. I can open the home page, but the API part doesnt work. I'm getting such an error: HTTP Error 403.18 - Forbidden The specified request cannot be processed in the application pool that is configured for this resource on the Web server Module IIS Web Core Notification BeginRequest Handler StaticFile Error Code 0x00000000 Requested URL http://server.com:80/index.php?p=MvcApplication2_deploy/api/values/ Physical Path C:\Inetpub\vhosts\server.com\Webservice\index.php Logon Method Not yet determined Logon User Not yet determined I have checked Url Rewrite it is empty, have disabled WebDAV and also checked the Handler Mappings every thing seems to be ok there. Could any one give me some hints what could be wrong? Thanks!!!

    Read the article

  • WSUS report hide not approved updates

    - by Mike Christiansen
    I have a WSUS server which is configured as a replica of the upstream server. My parent organization requires that it is a replica. However, they are not always the fastest at approving updates. I would like to know if there is a way to exclude Unapproved updates from the "Updates Needed" tally. I consistently have 2-3 updates missing from all of my computers, and when I check on them, they are all listed as Unapproved. Any way to do this? Thanks!

    Read the article

  • the kvm's terminal works weirdly

    - by Lai Yu-Hsuan
    I connect to a remote machine from the local machine and use virsh console to enter the virtual machine. I don't know how to exactly depict how it works. Normally it works well, but when I run VIM: Then it can't be recovered unless I cut the connection up: It's very hard to work with a broken terminal. Any advice? My terminal works well on my local machine and the remote machine in which the virtual machine runs.

    Read the article

  • checksecurity / setuid changes, is this a bug or did somebody break in?

    - by Fabian Zeindl
    I received a mail by checksecurity from my ubuntu 12.04 server with the following content: --- setuid.today 2012-06-03 06:48:09.892436281 +0200 +++ /var/log/setuid/setuid.new.tmp 2012-06-17 06:47:51.376597730 +0200 @@ -30,2 +30,2 @@ - 131904 4755 2 root root 71280 Wed May 16 07:23:08.0000000000 2012 ./usr/bin/sudo - 131904 4755 2 root root 71280 Wed May 16 07:23:08.0000000000 2012 ./usr/bin/sudoedit + 143967 4755 2 root root 71288 Fri Jun 1 05:53:44.0000000000 2012 ./usr/bin/sudo + 143967 4755 2 root root 71288 Fri Jun 1 05:53:44.0000000000 2012 ./usr/bin/sudoedit @@ -42 +42 @@ - 130507 666 1 root root 0 Sat Jun 2 18:04:57.0752979385 2012 ./var/spool/postfix/dev/urandom + 130507 666 1 root root 0 Mon Jun 11 08:47:16.0919802556 2012 ./var/spool/postfix/dev/urandom First i was worried, then i realized that the change was actually 2 weeks ago, i think there was a sudo-update back then. Since checksecurity runs in /etc/cron.daily i wondered why i only get that email now. I looked into /var/log/setuid/ and found the following files: total 32 -rw-r----- 1 root adm 816 Jun 17 06:47 setuid.changes -rw-r----- 1 root adm 228 Jun 3 06:48 setuid.changes.1.gz -rw-r----- 1 root adm 328 May 27 06:47 setuid.changes.2.gz -rw-r----- 1 root root 1248 May 20 06:47 setuid.changes.3.gz -rw-r----- 1 root adm 4473 Jun 17 06:47 setuid.today -rw-r----- 1 root adm 4473 Jun 3 06:48 setuid.yesterday The obvious thing that confuses me is that the file setuid.yesterday is not from yesterday = Jun/16. Is this a bug?

    Read the article

  • Moving from VPS to Cloud

    - by GRIGORE-TURBODISEL
    ...and I have a few questions. I'm basically working on a MySQL+PHP based webapp. Since I don't have on-demand scaling with VPS, I'm planning to move from VPS to Cloud when I hit the 1000 subscribers barrier. I'm looking at Windows Azure but I'm ok with other suggestions. So here are my questions: Will it really cost me a kidney? Every subscriber needs to download around 4-5MB of static resources each day. Bandwidth is free on the VPS but here I see costs can easily get to $800.00/mo; this makes me very insecure about the whole thing, I mean VPS is just $2,000/yr. Do I need another VM or is PHP included in the Web Sites? I have basic sysadmin skills, I think I can handle setting up a PHP install, but will I have to do this? If yes, what other service do I need to setup manually? What about Memcached, MySQL, etc? What security protections does it include? For example I have some basic protection included, like directory traversals and executable files upload; I also have CloudFlare on my other websites for DDoS protection; will I need to do the same thing here too, can it even be installed, can I edit my DNS records, etc? How are e-mails, subdomains, add-on domains, parked domains, etc. handled? I haven't seen any references to e-mail boxes. On the VPS I simply add them from cPanel ([email protected] / whatever.mysite.com / ...); do I have a similar management interface here? Do I get SSH access? Or at least FTP, remote MySQL access and maybe some incremental back-ups or something? Can I see my quotas and advanced traffic info? I must mention that I really like the idea of the whole "cloud" concept, the added reliability and everything but I really need maybe a parallel to regular hosting or something so I know what to expect.

    Read the article

  • Mac OS X desktop background gets reset to "Andromeda Galaxy.jpg" when users log out

    - by smokris
    I'm running Mac OS 10.6 server, and have a set of 10.6 and 10.7 workstations connected to it for authentication and MCX. Users have network profiles (home folder stored on server, via AFP). When users are logged in, they can change their desktop background. So far so good. However, the next time they log in, their desktop background has been reset to "Andromeda Galaxy.jpg". Though MCX is enabled and used to control other settings, MCX is disabled for the Desktop. What is keeping the users' desktop background from being preserved? How can I fix it?

    Read the article

  • creating cookbooks and roles with out chef-server

    - by Josh Nankin
    I want to run: knife role create blah I use chef-solo and don't need knife to connect to a server. I just would like to run these commands for helping me prepopulate the files quickly. Everytime I run of these commands it attempts to connect to a server. This does not happen for knife cookbook create blah Double-ewe tee eff. Update: I've noticed this is the case for databags and environments as well. I've read elsewhere that knife is primarily intended for use with the chef-server API, but it seems ridiculous that something like this can't be done. It just needs to save the darn file.

    Read the article

  • Is it legal to install WIndows 7 Professional (OEM) on VMWare? [closed]

    - by Domina
    Possible Duplicate: Can you help me with my software licensing issue? I recently heard that Microsoft allow you to install OEM version of windows 7 into Virtual Machine. I'm not 100% sure whether it is true or not and would like to re-confirm with you guys. FYI, I have 2 computers. Let's say "computer A" and "Computer B". I bought a copy of WIndows 7 Professional OEM edition recently and already installed it on my Computer A. I've two questions: Is it legal to install it again on a VMWare/Virtual PC on my Computer A? Is it legal to install it on VMWare/Virtual PC on my Computer B? Thanks.

    Read the article

  • Windows 2008 R2 Scheduled Task Not Running With Admin Privileges even if granted?

    - by j.rightly
    I have a scheduled task that is running as USER. I have checked the box "Run with highest privileges" in the scheduled task properties. The task is a powershell script that, among other things, reboots the system. The script executes and runs normally, but as a scheduled task, it fails to reboot the system. Here is the kicker: When I manually run the script as USER using the exact same command line as what's in the scheduled task, the script still runs but this time it actually reboots the system. I have UAC disabled and USER is a member of the local Admins group. The local Admins group has the right to shut down the system. Nothing in the event logs offers any clues. Why would the same script running under the same credentials work interactively but not as a scheduled task? UPDATE: This is too weird. When the task ran on schedule, everything worked normally.

    Read the article

  • Best Configuration for Performance - ffmpeg streaming / mp4 /flv

    - by Sam Alex
    I have some mpeg video files and a web page. A visitor comes to that web page and according to the selected options, a php script calls ffmpeg and combines the different mpeg files and then converts it to a mp4 file. That mp4 file is then shown to the visitor using flowplayer. The MP4 creation takes some time and flowplayer takes some time to load the file. What do you think is the best way to accomplish this task ? Should i go for streaming server ? I need to reduce the time taken for conversion. Will converting to FLV be faster ?

    Read the article

  • Danger in running a proxy server? [closed]

    - by NessDan
    I currently have a home server that I'm using to learn more and more about servers. There's also the advantage of being able to run things like a Minecraft server (Yeah!). I recently installed and setup a proxy service known as Squid. The main reason was so that no matter where I was, I would be able to access sites without dealing with any network content filter (like at schools). I wanted to make this public but I had second thoughts on it. I thought last night that if people were using my proxy, couldn't they access illegal materials with it? What if someone used my proxy to download copyright material? Or launched an attack on another site via my proxy? What if someone actually looked up child pornography through the proxy? My question is, am I liable for what people use my proxy for? If someone does an illegal act and it leads to my proxy server, could I be held accountable for the actions done?

    Read the article

  • How to minimize the risk of employees spreading critical information? [closed]

    - by Industrial
    What's common sense when it comes to minimising the risk of employees spreading critical information to rivalling companies? As of today, it's clear that not even the US government and military can be sure that their data stays safely within their doors. Thereby I understand that my question probably instead should be written as "What is common sense to make it harder for employees to spread business critical information?" If anyone would want to spread information, they will find a way. That's the way life work and always has. If we make the scenario a bit more realistic by narrowing our workforce by assuming we only have regular John Does onboard and not Linux-loving sysadmins , what should be good precautions to at least make it harder for the employees to send business-critical information to the competition? As far as I can tell, there's a few obvious solutions that clearly has both pros and cons: Block services such as Dropbox and similar, preventing anyone to send gigabytes of data through the wire. Ensure that only files below a set size can be sent as email (?) Setup VLANs between departments to make it harder for kleptomaniacs and curious people to snoop around. Plug all removable media units - CD/DVD, Floppy drives and USB Make sure that no configurations to hardware can be made (?) Monitor network traffic for non-linear events (how?) What is realistic to do in a real world? How does big companies handle this? Sure, we can take the former employer to court and sue, but by then the damage has already been caused... Thanks a lot

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >