Daily Archives

Articles indexed Tuesday January 11 2011

Page 16/37 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Clarification of atomic memory access for different OSs

    - by murrekatt
    I'm currently porting a Windows C++ library to MacOS as a hobby project as a learning experience. I stumbled across some code using the Win Interlocked* functions and thus I've been trying to read up on the subject in general. Reading related questions here in SO, I understand there are different ways to do these operations depending on the OS. Interlocked* in Windows, OSAtomic* in MacOS and I also found that compilers have builtin (intrinsic) operations for this. After reading gcc builtin atomic memory access, I'm left wondering what is the difference between intrinsic and the OSAtomic* or Interlocked* ones? I mean, can I not choose between OSAtomic* or gcc builtin if I'm on MacOS when I use gcc? The same if I'd be on Windows using gcc. I also read that on Windows Interlocked* come as both inline and intrinsic versions. What to consider when choosing between intrinsic or inline? In general, are there multiple options on OSs what to use? Or is this again "it depends"? If so, what does it depend on? Thanks!

    Read the article

  • where is latest tutorial for twitter status update using oAuth ?

    - by diEcho
    Hello All, i want to update my status on twitter by PHP application. i surf a lot that how to use twitter API ( whatever it is called, i really don't know) to tweet from php application. i did try a lot.... it goes to twitter page, ask to access that application and after that it comes back to my local application as i set callback URL to http://localhost/myproject/shareWIthTweet.php but that status is not shown on my twitter home page?? will someone please tell me the updated tutorial of twitter. i seen all tutorial are written on either 2009 or in early 2010, whereas on twitter developer website said that October 19, 2010 Twitter's ID format is changing. Please read, this affects nearly everyone Update i m using below code snippetgit Thanks

    Read the article

  • Remote Postgresql - extremely slow

    - by Muffinbubble
    Hi, I have setup PostgreSQL on a VPS I own - the software that accesses the database is a program called PokerTracker. PokerTracker logs all your hands and statistics whilst playing online poker. I wanted this accessible from several different computers so decided to installed it on my VPS and after a few hiccups I managed to get it connecting without errors. However, the performance is dreadful. I have done tons of research on 'remote postgresql slow' etc and am yet to find an answer so am hoping someone is able to help. Things to note: The query I am trying to execute is very small. Whilst connecting locally on the VPS, the query runs instantly. While running it remotely, it takes about 1 minute and 30 seconds to run the query. The VPS is running 100MBPS and then computer I'm connecting to it from is on an 8MB line. The network communication between the two is almost instant, I am able to remotely connect fine with no lag whatsoever and am hosting several websites running MSSQL and all the queries run instantly, whether connected remotely or locally so it seems specific to PostgreSQL. I'm running their newest version of the software and the newest compatible version of PostgreSQL with their software. The database is a new database, containing hardly any data and I've ran vacuum/analyze etc all to no avail, I see no improvements. I don't understand how MSSQL can query almost instantly yet PostgreSQL struggles so much. I am able to telnet to the post 5432 on the VPS IP with no problems, and as I say the query does execute it just takes an extremely long time. What I do notice is on the router when the query is running that hardly any bandwidth is being used - but then again I wouldn't expect it to for a simple query but am not sure if this is the issue. I've tried connecting remotely on 3 different networks now (including different routers) but the problem remains. Connecting remotely via another machine via the LAN is instant. I have also edited the postgre conf file to allow for more memory/buffers etc but I don't think this is the problem - what I am asking it to do is very simple - it shouldn't be intensive at all. Thanks, Ricky

    Read the article

  • Should downcasting be avoided while using a class hierarchy in C++?

    - by neuviemeporte
    Let's say I'm writing an application which works with projects, and exposes different functionality depending on the type of the project. I have a hierarchy of classes for the different types of projects: class AbstractProject { }; class ProjectA : public AbstractProject { }; class ProjectB : public AbstractProject { }; class ProjectC : public AbstractProject { }; Now, I was planning to have an AbstractProject *_currentProject pointer as a member in the application's main class, pop up a dialog box on startup and based on the selection, do: _currentProject = new ProjectB(); // e.g. Later, I'll have to downcast the pointer to the specific type to utilize the functionality specific to different Project-s. Somehow this makes me feel uneasy. Is there a Better Way of doing this?

    Read the article

  • Google Translate API in a .NET Windows Application

    - by user415042
    Hi , I have a .NET windows application which uses the Google Translate API. When trying to translate strings today i got a "Terms of Abuse" exception. To use a google API effectively, it is recommended that you register for a key which should resolve this problem. My translate API does not use a key. However to use a key,the site states that we would need to enter a valid URL of ours - e.g. http://localhost etc. However this one is a windows application. How do i get a valid key?

    Read the article

  • How do you send an array as part of an (jquery) ajax request

    - by Ankur
    I tried to send an array as part of an ajax request like this: var query = []; // in between I add some values to 'query' $.ajax({ url: "MyServlet", data: query, dataType: "json", success: function(noOfResults) { alert(noOfResults); } }); } I wanted to see what I get back in the servlet, so I used this line: System.out.println(request.getParameterMap().toString()); Which returned {} suggesting an empty map. Firebug tells me I am getting a 400 bad request error If I send a queryString like attribute=value as the 'data' then everything works fine, so it has to do with not being able to send an array as is. What do I have to do to get that data into the servlet for further processing. I don't want to pull it out and turn it into a queryString in the JS if I can avoid it. EDIT: I used the .serializeArray() (jQuery) function before sending the data. I don't get the 400 but nothing useful is being sent through.

    Read the article

  • PHP5.3 is not working with MySQL5.1 IIS7 Times out

    - by Thorn007
    I have set up PHP5.3, MySQL5.1, and IIS7 on Window 7 but php doesn't want to work with MySQL. I'm assuming it is a configuration error or an incomplete install on my part. MySQL5.1 is working PHP5.3 is working, phpinfo() shows info and that i have enabled MySQL IIS is setup and using fastCgiModule to run PHP IIS registers php.ini updates port 3306 is firewall free and open to the world php.ini is configured correctly I have added c:\php to the Windows systems PATH In the past I remember moving a file, libmysql.dll, to System32 but I doesn't look like that come with php5.3.1, as the driver comes built in now http://us3.php.net/manual/en/mysqlnd.install.php. (This has been giving me so much trouble I have been documenting my findings on my blog as http://inteldesigner.com/2010/code/having-problems-getting-php5-3-to-work-with-mysql5-1 ) NEED: I need to install PHP manually, don't want to use the quick installer or an older version I need to get PHP5.3 to work with MySQL5.1 so i can install Wordpress2.9 and Drupal7a Any links or suggestion would be great, I have already done everything on the iis web site, nothing is working. I'm guessing they have not updated for new software. BUGS/SOLUTION: The solution is here: http://bugs.php.net/bug.php?id=50172 thanks go to don.raman on the iis.net forums http://forums.iis.net/p/1164911/1933894.aspx SYMPTOMS: The php function mysql_connect() in conjunction with php5.3 locks up sever and returns error 500. (IPv6 is the problem see above link) TEST CODE: <?php $con = mysql_connect("localhost","root","***"); if (!$con) { die('Could not connect: ' . mysql_error()); } // some code mysql_close($con); ?> ERRORS: From Browser: HTTP Error 500.0 - Internal Server Error C:\php\php-cgi.exe - The FastCGI process exceeded configured activity timeout When i run php -f c:\public_html\index.php from the command line i got: PHP Warning: mysql_connect(): [2002] A connection attempt failed because the co nnected party did not (trying to connect via tcp://localhost:3306) in C:\public _html\index.php on line 10 Warning: mysql_connect(): [2002] A connection attempt failed because the connect ed party did not (trying to connect via tcp://localhost:3306) in C:\public_html \index.php on line 10 PHP Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connectio n failed because connected host has failed to respond. in C:\public_html\index.php on line 10 Warning: mysql_connect(): A connection attempt failed because the connected part y did not properly respond after a period of time, or established connection fai led because connected host has failed to respond. in C:\public_html\index.php on line 10 Could not connect: A connection attempt failed because the connected party did n ot properly respond after a period of time, or established connection failed bec ause connected host has failed to respond. C:\Users\Kevin>

    Read the article

  • What is the meaning of this pData[1+2*i]<<8|pData[2+2*i] C++ syntax?

    - by user543265
    what is the meqaning of pData[1+2*i]<<8|pData[2+2*i] where pData[ ] is the array containing BYTE data? I have the following function in the main function { .......... .... BYTE Receivebuff[2048]; .. ReceiveWavePacket(&Receivebuff[i], nNextStep); .... ... .. } Where Receivebuff is the array of type BYTE. ReceiveWavePacket(BYTE * pData, UINT nSize) { CString strTest; for(int i = 0 ; i < 60 ; i++) { strTest.Format("%d\n",(USHORT)(pData[1+2*i]<<8|pData[2+2*i])); m_edStatData.SetWindowTextA(strTest); } } I want to know the meaning of ",(USHORT)(pData[1+2*i]<<8|pData[2+2*i]). Can any body please help me?

    Read the article

  • How would I change this Query builder from Kohana 2.4 to Kohana 3?

    - by Thorpe Obazee
    I have had this website built for a few months and I am just getting on Kohana 3. I'd just like to convert this K2.4 query builder to K3 query builder. return DB::select(array('posts.id', 'posts.created', 'posts.uri', 'posts.price', 'posts.description', 'posts.title', 'image_count' => db::expr('COUNT(images.id)'))) ->from('posts') ->join('images')->on('images.post_id', '=', 'posts.id') ->group_by(array('posts.id')) ->order_by('posts.id', 'DESC') ->limit($limit) ->offset($offset) ->execute();

    Read the article

  • Performance question: Inverting an array of pointers in-place vs array of values

    - by Anders
    The background for asking this question is that I am solving a linearized equation system (Ax=b), where A is a matrix (typically of dimension less than 100x100) and x and b are vectors. I am using a direct method, meaning that I first invert A, then find the solution by x=A^(-1)b. This step is repated in an iterative process until convergence. The way I'm doing it now, using a matrix library (MTL4): For every iteration I copy all coeffiecients of A (values) in to the matrix object, then invert. This the easiest and safest option. Using an array of pointers instead: For my particular case, the coefficients of A happen to be updated between each iteration. These coefficients are stored in different variables (some are arrays, some are not). Would there be a potential for performance gain if I set up A as an array containing pointers to these coefficient variables, then inverting A in-place? The nice thing about the last option is that once I have set up the pointers in A before the first iteration, I would not need to copy any values between successive iterations. The values which are pointed to in A would automatically be updated between iterations. So the performance question boils down to this, as I see it: - The matrix inversion process takes roughly the same amount of time, assuming de-referencing of pointers is non-expensive. - The array of pointers does not need the extra memory for matrix A containing values. - The array of pointers option does not have to copy all NxN values of A between each iteration. - The values that are pointed to the array of pointers option are generally NOT ordered in memory. Hopefully, all values lie relatively close in memory, but *A[0][1] is generally not next to *A[0][0] etc. Any comments to this? Will the last remark affect performance negatively, thus weighing up for the positive performance effects?

    Read the article

  • StreamReader not working as expected

    - by Jon Preece
    Hi, I have written a simple utility that loops through all C# files in my project and updates the copyright text at the top. For example, a file may look like this; //Copyright My Company, © 2009-2010 The program should update the text to look like this; //Copyright My Company, © 2009-2010 However, the code I have written results in this; //Copyright My Company, � 2009-2011 Here is the code I am using; public bool ModifyFile(string filePath, List<string> targetText, string replacementText) { if (!File.Exists(filePath)) return false; if (targetText == null || targetText.Count == 0) return false; if (string.IsNullOrEmpty(replacementText)) return false; string modifiedFileContent = string.Empty; bool hasContentChanged = false; //Read in the file content using (StreamReader reader = File.OpenText(filePath)) { string file = reader.ReadToEnd(); //Replace any target text with the replacement text foreach (string text in targetText) modifiedFileContent = file.Replace(text, replacementText); if (!file.Equals(modifiedFileContent)) hasContentChanged = true; } //If we haven't modified the file, dont bother saving it if (!hasContentChanged) return false; //Write the modifications back to the file using (StreamWriter writer = new StreamWriter(filePath)) { writer.Write(modifiedFileContent); } return true; } Any help/suggestions are appreciated. Thanks!

    Read the article

  • Use CSS selectors to collect HTML elements from a streaming parser (e.g. SAX stream)

    - by Jakub Narebski
    How to parse CSS (CSS3) selector and use it (in jQuery-like way) to collect HTML elements not from DOM (from tree structure), but from stream (e.g. SAX), i.e. using sequential access parser? Are there CSS selectors that need access to DOM (Wikipedia SAX page says that XPath selectors "need to be able to access any node at any time in the parsed XML tree")? I am most inetersted in implementing selector combinators, e.g. 'A B' descendant selector. I prefer solutions describing algorithm, or in Perl.

    Read the article

  • C#, XmlDocument, and special ISO Latin characters

    - by Trent
    I'm trying to load up xml into an XmlDocument, but it doesn't recognize the encoded '&eacute' and throws an error 'An error occurred while parsing Entity Name'. Now I can add a custom entity set in a DTD of my xml, so the XmlDocument loads properly. But what I'm hoping is that I can reference a url that has a common set of these ISO Latin encoded characters. Is this possible, or do I need to inject a custom list of DTD sets?

    Read the article

  • Use branching in TFS for 32 bit and 64 bit version of a software?

    - by Malkier
    Hi everyone, we are in the process of porting a 32bit application, which uses the Outlook Redemption DLL to a 64 bit version, since redemption has recently been released as a 64 bit version as well. We'd like to maintain two versions of the application, one for 32 and one for 64 bit. What is the best way to organize these projects under team foundation server source control? Would I create a branch of the existing 32 bit version? Copying the whole project seems sub-optimal since it would duplicate all the business logic code. Any suggestions?

    Read the article

  • Optimizing simple search script in PowerShell

    - by cc0
    I need to create a script to search through just below a million files of text, code, etc. to find matches and then output all hits on a particular string pattern to a CSV file. So far I made this; $location = 'C:\Work*' $arr = "foo", "bar" #Where "foo" and "bar" are string patterns I want to search for (separately) for($i=0;$i -lt $arr.length; $i++) { Get-ChildItem $location -recurse | select-string -pattern $($arr[$i]) | select-object Path | Export-Csv "C:\Work\Results\$($arr[$i]).txt" } This returns to me a CSV file named "foo.txt" with a list of all files with the word "foo" in it, and a file named "bar.txt" with a list of all files containing the word "bar". Is there any way anyone can think of to optimize this script to make it work faster? Or ideas on how to make an entirely different, but equivalent script that just works faster? All input appreciated!

    Read the article

  • Why is connecting to external FTP sites slow on virtual 2008 R2 and not on host?

    - by subkamran
    I have Windows Server 2008 R2 installed as a virtual guest in my Windows 7 host via VirtualBox 4.0. I did this to move my development activity to a controlled environment that doesn't affect my host OS when I don't want to develop. The problem I have is that when I try to connect to my shared hosting FTP, it's slow as hell on the virtual OS but perfectly fast on the host. I tried: Disabling Windows Firewall Trying several different FTP clients Anyone else have this issue?

    Read the article

  • Server seems up, but accepts no connections whatsoever

    - by Rnatau
    Hi, I have a problem with a Debian based Server, unfortunately housed in a remote location. Two days ago, it was suddenly down and completely unreachable. After having someone reboot it, it worked for about a day, then seemed to be down again. This time, however, it was different: -The server reacts to pings -It is scannable, and all the relevant ports are open But: -Open shells were immediately blocked, and no warning had been shown -It's not possible to open any connection - the TCP/IP handshake seems to have some problems: SSH handshake As this is a private server of a small community, we don't have the resources to pay a technician to fix the problem for us, so any hints how to fix the problem after the next reboot would be highly appreciated... Thanks a lot!

    Read the article

  • re-direct SSL pages using header statement based on port

    - by bob's your brother
    I found this in the header.php file of a e-commerce site. Is this better done in a .htaccess file. Also what would happen to any post parameters that get caught in the header statement. // flip between secure and non-secure pages $uri = $_SERVER['REQUEST_URI']; // move to secure SSL pages if required if (substr($uri,1,12) == "registration") { if($_SERVER['SERVER_PORT'] != 443) { header("HTTP/1.1 301 Moved Permanently"); header("Location: https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); exit(); } } // otherwise us regular non-SSL pages else { if($_SERVER['SERVER_PORT'] == 443) { header("HTTP/1.1 301 Moved Permanently"); header("Location: http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); exit(); } }

    Read the article

  • Plesk SSL Certificate (Default cert when SSL enabled, CORRECT cert when SSL is disabled)

    - by hztetra
    I'm running Plesk 8.6.0: I have an SSL cert installed through Plesk's admin interface. But I have a bit of an issue: When I enabled SSL for the site, and selected my cert, then restart httpd, Plesk defaults to using my self-signed default certificate. Conversely, when I disable SSL support for the domain, all of a sudden Plesk is using my new SSL certificate. Unfortunately, when I try to view any folder on the site (mydomain.tld/folder) I'm simply met with a 404 (with files placed both in httpdocs and httpsdocs). I switch SSL support back on, and Plesk defaults back to the default self-signed cert and I can then view the folders that were not previously accessible. Any ideas? One further note: I tried following http://kb.parallels.com/en/939 . Once I tried to restart httpd with the edited ssl.conf file, I received an httpd could not start error. I restored the original ssl.conf file, and still received the could not start error. So as of now, I am running without an ssl.conf file. The following is the error I receive when I attempt to reintroduce ssl.conf: Starting httpd: [Mon Aug 23 15:45:40 2010] [warn] module ssl_module is already loaded, skipping (98)Address already in use: make_sock: could not bind to address 0.0.0.0:443 no listening sockets available, shutting down Unable to open logs

    Read the article

  • Outbound ports to allow through firewall

    - by dunxd
    This question was asked before, but in a rather general way. I'm asking more specifically based on my current requirements. We have a number of remote offices made up of a bunch of PCs and an ASA 5505 which is used as firewall and VPN termination point. In the offices we share the internet connection with one or more other organisations over whom we have very little control, asides from the config on the ASAs. For a bunch of reasons I'd like to lock down these ASA 5505s to only allow outbound traffic to ports used by applications we know we need. I'm putting a standard config to roll out to all the ASAs, and if we need to open up ports for the other orgs we can do it on request. But I want to leave open the most commonly required ports so we can get up and running without waiting on other folks technical staff to get back. I plan to allow the following TCP ports to support commonly required resources: POP3 (110 and 995) HTTP (80 and 443) IMAP4 (143 and 993) SMTP (25 and and 465) The question really is, what other ports do I need to leave open to allow for "normal" working. I've seen UDP port 53 for DNS as one. Are there any others that would be worth opening up? Just to note - I'll also be setting up monitoring systems to keep an eye on the ports we do allow. Any of the above could be misused of course. We'll also back all this up with signed agreements. But I'm aiming for a technical solutions where I don't have to start out with the full requirements of everyone we share connections with. See also: outbound ports that are always open

    Read the article

  • Cisco 2911 - problem with DHCP

    - by bluszcz
    Hi, i am configuring DHCP daemon on Cisco 2911. At some point i assigned address 192.168.50.50 to one box (using MAC address 'relation'). When I wanted to saved config - I got warning, that address 192.168.50.50 is already in Pool, which sounds bit weird - it was first host which I started configuring. I tried with following commands: clear ip dhcp server statistics clear ip dhcp conflict but first one doesn't output anything (and show statistics shows that there are 2 addresses in pool), and second one throws "there is no conflicted ips" message. How I can force/purge/clear/allow to bind 192.168.50.50 to this box?

    Read the article

  • How to know currently open ports on the Windows Firewall?

    - by QIU Quan
    On Windows XP and Windows Server 2003, I can know currently open ports on the Windows Firewall using the following command: netsh firewall show state However, on Windows 7 and Hyper-V Server 2008 R2, when I give that command, it says: No ports are currently open on all network interfaces. IMPORTANT: Command executed successfully. However, "netsh firewall" is deprecated; use "netsh advfirewall firewall" instead. Apparently there are ports open because services such as NetBIOS NS, Remote Desktop, and Hyper-V remote administration are functioning. I tried a few 'netsh advfirewall' show commands, but didn't get a way to find out which ports are permit by Windows Firewall. Knowing the currently open ports, I can be sure that I'm permitting necessary and sufficient traffic to pass in, no more, no less. Going through the whole set of advanced firewall rules is so tedious and error-prone. Is there a command on Windows 7 and Windows Server 2008 to do this efficiently?

    Read the article

  • Formula in table header cells

    - by Cylindric
    I have a table in Excel 2007 that I want to summarise, in a similar fashion to a Pivot Table, but for various reasons I can't use a pivot table. I like the "Format as table" features of sort and filter buttons, automatic formatting etc, so have used that to create a simple table: A B C N +-----------+------------+------------+-------+------------+ 1 | | 01/01/2010 | 01/02/2010 | ... | 01/12/2010 | +-----------+------------+------------+-------+------------+ 2 | CategoryA | 15 | 545 | | 634 | 3 | CategoryB | 32 | 332 | | 231 | 4 | CategoryC | 5 | 234 | | 644 | | ... | | | | | 27 | CategoryZ | 2 | 123 | | 64 | +-----------+------------+------------+-------+------------+ The numbers are retrieved from a "back-end" pivot table using GETPIVOTDATA(). All that works fine. Now, the problem is that I can't seem to use formulas for my column headings in these new "smart" tables - they are converted to text or just broken. For example if in B1 I put NOW(), I don't get the date, I get 00/01/1900. Is there any way of getting a formula to work in the auto tables? Or do I have to use standard tables and manually alternate-colour my rows etc?

    Read the article

  • Secure Browsing, how [closed]

    - by Jhonny Bigodes
    Possible Duplicate: How to browse safely? What's the best way to browse "suspicious" sites safely. I know Firefox used to be "the thing", but now I don't think it is (IMHO). What I'm using now is a virtual machine (with virtual box), rhat I periodically format. I heard some time ago of a project that glued the 2 together (kinda... everytime you startup the program it used a fresh machine with a fresh browser), but I lost track of them So my question is: How can I Browse the web securely ? Ps.: In in ubuntu

    Read the article

  • Removing file with strange characters in filename in OS X

    - by SiggyF
    After a memory error in my program, I am stuck with a file with a strange filename. It's proving quite resistant to all normal methods to remove files with strange names. The filename is: %8BUȅ҉%95d%F8%FF%FF\x0f%8E%8F%FD%FF%FF%8B%B5T%F8%FF%FF%8B%85\%F8%FF%FF\x03%85x%F8%FF%FF%8B%95D%F8%FF%FF%8B%BD%9C%F8%FF%FF%8D\x04%86%8B%B5@%F8%FF%FF%89%85%90%F8%FF%FF%8B%85X%F8%FF%FF\x03%85%9C%F8%FF%FF%C1%E7\x02%8B%8Dx I tried the following: rm * - "No such file or directory" rm -- filename - "No such file or directory" rm "filename" - "No such file or directory" ls -i to get the inode number - "No such file or directory" stat filename - "No such file or directory" zip the directory where the file is in - error occured while adding "" to the archive. delete directory in finder - error -43 in python: os.unlink(os.listdir(u'.')[0]) - OSError No such file or directory find . -type f -exec rm {} \; - "No such file or directory" checked for locks on the file with lsof - no locks All these attempts result in a file (long filename here) not found error, or error -43. Even the ls -i. I couldn't find anymore options, so before reformatting or repairing my filesystem (fsck might help) I thought maybe there is something I missed. I wrote this small c program to get the inode: #include <stdio.h> #include <stddef.h> #include <sys/types.h> int main(void) { DIR *dp; struct dirent *ep; dp = opendir ("./"); if (dp != NULL) { while (ep = readdir (dp)) { printf("d_ino=%ld, ", (unsigned long) ep->d_ino); printf("d_name=%s.\n", ep->d_name); } (void) closedir (dp); } else perror ("Couldn't open the directory"); return 0; } That works. I now have the inode, but the normal find -inum inode -exec rm '{}' \; doesn't work. I think I have to use the clri now.

    Read the article

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