Daily Archives

Articles indexed Friday May 7 2010

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

  • find window text and save txt to file named that wont work.

    - by blood
    hi, my code wont work and idk why. the point of my code is to find the top window and save a text file with the name the same as the text on the top menu bar (task bar i think?). then save some data to that text file. but everytime i try to use it the write fails if i set the name of the text file before hand so it wont change it will write the data to the file. but if i don't set it before hand it will make the text doc but not write anything to it. or sometimes it will just write numbers for the name (i think it's the handle number) then it will write the data. :\ it's odd can anyone help? #include <iostream> #include <windows.h> #include <fstream> #include <string> #include <sstream> #include <time.h> using namespace std; string header_str = ("NULL"); #define DTTMFMT "%Y-%m-%d %H:%M:%S " #define DTTMSZ 21 char buff[DTTMSZ]; fstream filestr; string ff = ("C:\\System logs\\txst.txt"); TCHAR buf[255]; int main() { GetWindowText(GetForegroundWindow(), buf, 255); stringstream header(stringstream::in | stringstream::out); header.flush(); header << ("C:\\System logs\\"); header << buf; header << (".txt"); header_str = header.str(); ff = header_str; cout << header_str << "\n"; filestr.open (ff.c_str(), fstream::in | fstream::out | fstream::app | ios_base::binary | ios_base::out); filestr << "dfg"; filestr.close(); Sleep(10000); return 0; }

    Read the article

  • Why does my site look weird on some pcs

    - by user334948
    I have a search site but when the results are displayed on some computers you can not see the entire website.Now someone here said to change the resolution to 1000px atleast but i do not know how.Please help this is all that i need to finish to complete my first website..thanks

    Read the article

  • ASP.Net JSON Web Service Post Form Data

    - by Will D
    I have a ASP.NET web service decorated with System.Web.Script.Services.ScriptService() so it can return json formatted data. This much is working for me, but ASP.Net has a requirement that parameters to the web service must be in json in order to get json out. I'm using jquery to run my ajax calls and there doesn't seem to be an easy way to create a nice javascript object from the form elements. I have looked at serialiseArray in the json2 library but it doesn't encode the field names as property name in the object. If you have 2 form elements like this <input type="text" name="namefirst" id="namefirst" value="John"/> <input type="text" name="namelast" id="namelast" value="Doe"/> calling $("form").serialize() will get you the standard query string namefirst=John&namelast=Doe calling JSON.stringify($("form").serializeArray()) will get you the (bulky) json representation [{"name":"namefirst","value":"John"},{"name":"namelast","value":"Doe"}] This will work when passing to the web service but its ugly as you have to have code like this to read it in: Public Class NameValuePair Public name As String Public value As String End Class <WebMethod()> _ Public Function GetQuote(ByVal nvp As NameValuePair()) As String End Function You would also have to wrap that json text inside another object nameed nvp to make the web service happy. Then its more work as all you have is an array of NameValuePair when you want an associative array. I might be kidding myself but i imagined something more elegant when i started this project - more like this Public Class Person Public namefirst As String Public namelast As String End Class which would require the json to look something like this: {"namefirst":"John","namelast":"Doe"} Is there an easy way to do this? Obviously it is simple for a form with two parameters but when you have a very large form concatenating strings gets ugly. Having nested objects would also complicate things The cludge I have settled on for the moment is to use the standard name value pair format stuffed inside a json object. This is compact and fast {"q":"namefirst=John&namelast=Doe"} then have a web method like this on the server that parses the query string into an associate array. <WebMethod()> _ Public Function AjaxForm(ByVal q As String) as string Dim params As NameValueCollection = HttpUtility.ParseQueryString(q) 'do stuff return "Hello" End Sub As far a cludges go this one seems reasonably elegant in terms of amount of code, but my question is: is there a better way? Is there a generally accepted way of passing form data to asp.net web/script services?

    Read the article

  • How do I set the rounded corner radius of a color drawable using xml?

    - by Jay Askren
    On the android website, there is a section about color drawables. Defining these drawables in xml looks like this: <resources> <drawable name="solid_red">#f00</drawable> <drawable name="solid_blue">#0000ff</drawable> <drawable name="solid_green">#f0f0</drawable> </resources> In the java api, they have thr following method to define rounded corners: setCornerRadius(float radius) Is there a way to set the rounded corners in the xml?

    Read the article

  • How to interact with checkbox actions ? (QTableView with QStandardItemModel)

    - by Claire Huang
    I'm using QTableView and QStandardItemModel to show some data. For each row, there is a column which has a check Box, this check box is inserted by setItem, the code is as follows: int rowNum; QStandardItemModel *tableModel; QStandardItem* __tmpItem = new QStandardItem(); __tmpItem->setCheckable(true); __tmpItem->setCheckState(Qt::Unchecked); tableModel->setItem(rowNum,0,__tmpItem); Now I want to interact with the check box. If a check box changes its state by user (from checked to unchecked or vice versa), I want to do something on the corresponding data row. I know I can use signal-slot to catch the change of checkbox, but since there are lots of data row, I don't want to connect each row one by one. Is there anyway to interact with the check action more effectively? Thanks :)

    Read the article

  • segmentation fault on Unix - possible stack corruption

    - by bob
    hello, i'm looking at a core from a process running in Unix. Usually I can work my around and root into the backtrace to try identify a memory issue. In this case, I'm not sure how to proceed. Firstly the backtrace only gives 3 frames where I would expect alot more. For those frames, all the function parameters presented appears to completely invalid. There are not what I would expect. Some pointer parameters have the following associated with them - Cannot access memory at address Would this suggest some kind of complete stack corruption. I ran the process with libumem and all the buffers were reported as being clean. umem_status reported nothing either. so basically I'm stumped. What is the likely causes? What should I look for in code since libumem appears to have reported no errors. Any suggestions on how I can debug furhter? any extra features in mdb I should consider? thank you.

    Read the article

  • Stanford iPhone dev Paparazzi 1 setup help

    - by cksubs
    Hi, I'm having trouble using a tab bar control. Basically, when I build and run I'm just getting the blank white default "Window" screen. I was following this guide: http://www.iphoneosdevcafe.com/2010/03/assignment-4-part-1/#comment-36 Drag a Tab Bar Controller from the Library to MainWindow.xib. Control drag from the App Delegate to the Tab Bar Controller. Drag a Navigation Controller from the Library to MainWindow.xib. Control drag from the App Delegate to the Navigation Controller. Drag a second Navigation Controller from the Library to MainWindow.xib. Control drag from the App Delegate to the Navigation Controller. This completes all the connections between the App Delegate and the tab bar and two navigation controllers. By using IB to set up the tab bar and navigation controllers in this way, you need not allocate and init the controllers in AppDelegate.m. When you build and run this, you will see the tab bar controller and two navigation controllers. Is there a step there that he missed? How do I hook the Tab Bar Controller up to the Window? EDIT: Do I need to do something like this? mainTabBar = [[UITabBarController alloc] init]; [window addSubview:mainTabBar.view]; That's still not working, but I feel like I'm on the right track? Why can't this all be done from Interface Builder?

    Read the article

  • Most Frequent Number

    - by VBeginner
    Hello, I've used an array of strings to populate a DataGridView. How do I go about finding the most frequently occurring number? Or, even better, order them by most frequently occuring? Thank You.

    Read the article

  • UNIX script to parse Zone file (is this the best code?)

    - by Steve
    Hi, FOund the following on: http://mike.murraynet.net/2009/08/23/parsing-the-verisign-zone-file-with-os-x/ Can unix-masters have a look at it and see if its the best possible way to gather the unique domainsnames in a zone file? For .NET domains: grep “^[a-zA-Z0-9-]+ NS .” net.zone|sed “s/NS .//”|uniq netdomains.txt For .COM domains: grep “^[a-zA-Z0-9-]+ NS .” com.zone|sed “s/NS .//”|uniq comdomains.txt For .EDU domains: grep “^[a-zA-Z0-9-]+ NS .” edu.zone|sed “s/NS .//”|uniq edudomains.txt

    Read the article

  • How can I determine when an InnoDB table was last changed?

    - by David M
    I've had success in the past storing the (heavily) processed results of a database query in memcached, using the last update time of the underlying tables(s) as part of the cache key. For MyISAM tables, that last changed time is available in SHOW TABLE STATUS. Unfortunately, that's usually NULL for InnoDB tables. In MySQL 4.1, the ctime for an InnoDB in its SHOW TABLE STATUS line was usually its actual last update time, but that doesn't seem to be true for MySQL 5.1. There is a DATETIME field in the table, but it only shows when a row has been modified - it cannot show the deletion time of a row that's not there anymore! So, I really cannot use MAX(update_time). Here's the really tricky part. I have a number of replicas that I do reads from. Can I figure out the state of the table that doesn't rely on when the changes have actually been applied? My conclusion after working on this for a while is that it's not going to be possible to get this information as cheaply as I'd like. I'm probably going to cache data until the time that I expect the table to change (it's updated once a day), and let the query cache help out where it can.

    Read the article

  • Accessing webserver behind cheap router

    - by malfist
    I have a trendNET wireless/wired router, and inside the LAN I have a webserver on 192.168.10.103:80. Does anyone know how I can access the webserver from outside the LAN? I setup a "VirtualSever" to portforward publicIP:8080 to 192.168.10.103:80, but it never loads. Port scanning the external IP shows the port as "filtered" on the router, and from the inside, it shows 192.168.10.103:80 as open. Does anyone know how I can make this work?

    Read the article

  • improving data extraction from text file in Java

    - by owca
    I have CSV file with sample data in this form : 220 30 255 0 0 Javascript 200 20 0 255 128 Thinking in java , where the first column is height, second thickness, next three are rgb values for color and last one is title. All need to be treated as separate variables. I have already written my own solution for this, but I'm wondering if there are no better/easier/shorter ways of doing this. Extracted data will then be used to create Book object, throw every Book into array of books and print it with swing. Here's the code : private static Book[] addBook(Book b, Book[] bookTab){ Book[] tmp = bookTab; bookTab = new Book[tmp.length+1]; for(int i = 0; i < tmp.length; i++){ bookTab[i] = tmp[i]; } bookTab[tmp.length] = b; return bookTab; } public static void main(String[] args) { Book[] books = new Book[0]; try { BufferedReader file = new BufferedReader(new FileReader("K:\\books.txt")); String s; while ((s = file.readLine()) != null) { int hei, thick, R, G, B; String tit; hei = Integer.parseInt(s.substring(0, 3).replaceAll(" ", "")); thick = Integer.parseInt(s.substring(4, 6).replaceAll(" ", "")); R = Integer.parseInt(s.substring(10, 13).replaceAll(" ", "")); G = Integer.parseInt(s.substring(14, 17).replaceAll(" ", "")); B = Integer.parseInt(s.substring(18, 21).replaceAll(" ", "")); tit = s.substring(26); System.out.println(tyt+wys+grb+R+G+B); books = addBook(new Book(wys, grb, R, G, B, tyt),books); } file.close(); } catch (IOException e) { //do nothing } }

    Read the article

  • How do you delete rows from UITableView?

    - by James
    This has been bugging me for hours now and i have not been able to figure it out. I am importing data into a tableview using core data and NSMutableArray. As shown below. CORE DATA ARRAY NSMutableArray *mutableFetchResults = [CoreDataHelper getObjectsFromContext:@"Spot" :@"Name" :YES :managedObjectContext]; self.entityArray = mutableFetchResults; TABLE VIEW - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSManagedObject *object = (NSManagedObject *)[entityArray objectAtIndex:indexPath.row]; NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; } NSString *lat1 = [object valueForKey:@"Email"]; //NSLog(@"Current Spot Latitude:%@",lat1); float lat2 = [lat1 floatValue]; //NSLog(@"Current Spot Latitude Float:%g", lat2); NSString *long1 = [object valueForKey:@"Description"]; //NSLog(@"Current Spot Longitude:%@",long1); float long2 = [long1 floatValue]; //NSLog(@"Current Spot Longitude Float:%g", long2); //Getting current location from NSDictionary CoreDataTestAppDelegate *appDelegate = (CoreDataTestAppDelegate *) [[UIApplication sharedApplication] delegate]; NSString *locLat = [NSString stringWithFormat:appDelegate.latitude]; float locLat2 = [locLat floatValue]; //NSLog(@"Lat: %g",locLat2); NSString *locLong = [NSString stringWithFormat:appDelegate.longitude]; float locLong2 = [locLong floatValue]; //NSLog(@"Long: %g",locLong2); //Distance Shizzle //Prime's Location CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2]; //Home Location CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:locLat2 longitude:locLong2]; double distance = [loc1 getDistanceFrom: loc2] / 1000; int myInt = (int)(distance + (distance>0 ? 0.5 : -0.5)); //NSLog(@"INT VAL :%i", myInt); NSMutableString* converted = [NSMutableString stringWithFormat:@"%.1f", distance]; [converted appendString: @" Km"]; //NSLog(@"Distance between Prime and home = %g", converted); if (myInt < 11) { cell.textLabel.text = [object valueForKey:@"Name"]; cell.detailTextLabel.text = [NSString stringWithFormat:converted]; } else { } // Configure the cell... return cell; } I am trying to get the table only to display results that are within a certain distance. This method here works apart from the fact that the results over a certain distance are still in the table, they are just not graphically visible. I am led to believe that i have to carry out the filtering process before the formatting the table but i can not seem to do this. Please help. My xcode skills are not brilliant so code suggestions would be helpfull.

    Read the article

  • Wordpress 403/404 Errors: You don't have permission to access /wp-admin/themes.php on this server

    - by Glen
    Some background: I setup six blogs this week, all using Wordpress 2.92, installed with Fantastico on a baby croc plan with Hostgator. I used the same theme (heatmap 2.5.4) and plugins for each blog. They were all up and running, no issues at all. I go to create a new blog this morning, using the same setup, and when I try to change the theme settings, I get the following error: Forbidden You don't have permission to access /wp-admin/themes.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8n DAV/2 mod_fcgid/2.3.5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at http://www.mydomain.com Port 80 I tried uninstalling WP and doing a clean install, still the same issue with a clean installation. So I went back and checked the six other blogs that I had setup over the last week or so, and they are also now giving me 403 or 404 errors when trying to change theme settings, and everytime there's an error it points to either themes.php or functions.php At this point I'm at my wits end trying to figure out what the problem is. Hostgator support looked at it and thought maybe it was a permissions issue but they reset those and I'm still having the problem. At first I thought the problem might have been related to a plugin I recently installed on the previous six blogs that morning (ByREV Fix Missed Shedule Plugin) to deal with a missed schedule bug with WP 2.92, and that maybe that had mucked things up. But then I checked a blog I built months ago, also using the same theme and plugins, and now it too is also encountering the same problem. Any ideas? I tried deleting my htaccess, uploading a blank one, uploading one with this snippet I found on the hostgator forum: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress Nothing has worked. I still get 403 or 404 errors everytime. Everything was working perfectly yesterday so I know this setup DOES WORK, I've just mucked something up somewhere and I'm clueless what it is. I read a related thread here and tried chmoding the wp-content folder to 0755 and still having the issue. Any thoughts? Thanks!

    Read the article

  • accepts_nested_attributes_for and nested_form plugin

    - by Denis
    Hi folks, I've the following code in a _form.html.haml partial, it's used for new and edit actions. (fyi I use the Ryan Bates' plugin nested_form) .fields - f.fields_for :transportations do |builder| = builder.collection_select :person_id, @people, :id, :name, {:multiple => true} = builder.link_to_remove 'effacer' = f.link_to_add "ajouter", :transportations works fine for the new action... for the edit action, as explain in the doc, I've to add the :id of already existing associations, so, I've to add something like = builder.hidden_field :id, ?the value? if ?.new_record? How can I get the value? Here is the doc of accepts_nested_attributes_for for reference (source: http://github.com/rails/rails/blob/master/activerecord/lib/active_record/nested_attributes.rb#L332) # Assigns the given attributes to the collection association. # # Hashes with an <tt>:id</tt> value matching an existing associated record # will update that record. Hashes without an <tt>:id</tt> value will build # a new record for the association. Hashes with a matching <tt>:id</tt> # value and a <tt>:_destroy</tt> key set to a truthy value will mark the # matched record for destruction. # # For example: # # assign_nested_attributes_for_collection_association(:people, { # '1' => { :id => '1', :name => 'Peter' }, # '2' => { :name => 'John' }, # '3' => { :id => '2', :_destroy => true } # }) # # Will update the name of the Person with ID 1, build a new associated # person with the name `John', and mark the associatied Person with ID 2 # for destruction. # # Also accepts an Array of attribute hashes: # # assign_nested_attributes_for_collection_association(:people, [ # { :id => '1', :name => 'Peter' }, # { :name => 'John' }, # { :id => '2', :_destroy => true } # ]) Thanks for your help.

    Read the article

  • teamcity force checkout

    - by stacker
    I have teamcity project that use mercurial. I did a few manually changes to the files in teamcity/buildAgent/work directory. The problem is that now I cannot update the files to the files in the repository. How can I force re checkout for the teamcity? Is there any option to get rid of the old checkout?

    Read the article

  • Installing CakePHP on Windows with Apache

    - by GeoSQL
    Hi, I'm trying to install CakePHP on my Windows XP machine running Apache 2.2. I have installed the Cake folder in my doc root. I've read the installation instructions that say to include this line in the httpd.conf file; <Directory /path/to/cake> Does anyone know how to translate that into Windows? I currently have the following in my conf file: <Directory "C:/Apache/Apache2.2/htdocs/cakeapp/"> Whenever I uncomment this line it crashes Apache. I've tried switching the slashes to "\" and I tried taking the slash off the end. Any advice? Thanks

    Read the article

  • Writing to a log4net FileAppender with multiple threads performance problems

    - by Wayne
    TickZoom is a very high performance app which uses it's own parallelization library and multiple O/S threads for smooth utilization of multi-core computers. The app hits a bottleneck where users need to write information to a LogAppender from separate O/S threads. The FileAppender uses the MinimalLock feature so that each thread can lock and write to the file and then release it for the next thread to write. If MinimalLock gets disabled, log4net reports errors about the file being already locked by another process (thread). A better way for log4net to do this would be to have a single thread that takes care of writing to the FileAppender and any other threads simply add their messages to a queue. In that way, MinimalLock could be disabled to greatly improve performance of logging. Additionally, the application does a lot of CPU intensive work so it will also improve performance to use a separate thread for writing to the file so the CPU never waits on the I/O to complete. So the question is, does log4net already offer this feature? If so, how do you do enable threaded writing to a file? Is there another, more advanced appender, perhaps? If not, then since log4net is already wrapped in the platform, that makes it possible to implement a separate thread and queue for this purpose in the TickZoom code. Sincerely, Wayne

    Read the article

  • How to work with NServiceBus in gateway mode

    - by Mike737
    I've been trying to get the pubsub sample in the NServiceBus download to work in a gateway mode. I haven't really been able to find out much detail at all about how to get NServiceBus to run in gateway mode. How do I setup the publisher/server in gateway mode? When I did try I received an access denied exception which would either be due to the account I'm running it under or I'm missing something. How do I setup the subscribers/clients to communicate to the gateway? Can anyone point me in the right direction?

    Read the article

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