Daily Archives

Articles indexed Sunday November 18 2012

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

  • How can I solve this SAT direct corner intersection edge case?

    - by ssb
    I have a working SAT implementation, but I am running into a problem where direct collisions at a corner do not work for tiled surfaces. That is, it clips on the surface when going in a certain direction because it gets hung up on one of the tiles, and so, for example, if I walk across a floor while holding both down and left, the player will stop when meeting the next shape because the player will be colliding with the right side rather than with the top of the floor tile. This illustration shows what I mean: The top block will translate right first and then up. I have checked here and here which are helpful, but this does not address what I should do in a situation where I don't have a tile-based world. My usage of the term "tile" before isn't really accurate since what I'm doing here is manually placing square obstacles next to each other, not assigning them spots on a grid. What can I do to fix this?

    Read the article

  • Deleting xml file using radio value

    - by ???? ???
    i using php to delete file, but i got table loop like this: <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table"> <tr class="bg_tableheader"> <th class="table-header-check"><a id="toggle-all" ></a> </th> <th class="table-header-check"><a href="#"><font color="white">Username</font></a> </th> <th class="table-header-check"><a href="#"><font color="white">First Name</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Last Name</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Email</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Group</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Birthday</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Gender</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Age</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Country</font></a></th> </tr> <?php $files = glob('users/*.xml'); foreach($files as $file){ $xml = new SimpleXMLElement($file, 0, true); echo ' <tr> <td></td> <form action="" method="post"> <td class="alternate-row1"><input type="radio" name="file_name" value="'. basename($file, '.xml') .'" />'. basename($file, '.xml') .'</td> <td>'. $xml->name .'&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td> <td class="alternate-row1">'. $xml->lastname .'</td> <td>'. $xml->email .'</td> <td class="alternate-row1">'. $xml->level .'</td> <td>'. $xml->birthday .'</td> <td class="alternate-row1">'. $xml->gender .'</td> <td>'. $xml->age .'</td> <td class="alternate-row1">'. $xml->country .'</td> </tr>'; } ?> </table> </div> <?php if(isset($_POST['file_name'])){ unlink('users/'.$_POST['file_name']); } ?> <input type="submit" value="Delete" /> </form> so as you can see i got radio value set has basename (xml file name) but from some reason it not working, any idea why is that? Thanks in advance.

    Read the article

  • Windows Phone Mango: Making a drawing app with various brushes option

    - by Md. Abdul Munim
    I am trying to make a drawing app. The purpose is simple. Let the user draw something on a canvas with various brush options like square brush,far brush,pencil brush and many more like any other drawing app available in android market. At present I can let the user draw smooth curves using following code: currentPoint = e.GetPosition(this.canvas); Line line = new Line() { X1 = currentPoint.X, Y1 = currentPoint.Y, X2 = oldPoint.X, Y2 = oldPoint.Y }; line.Stroke = new SolidColorBrush(Colors.Purple); line.StrokeThickness = 2; this.drawnImage.Add(line); this.canvas.Children.Add(line); oldPoint = currentPoint; Now I want some custom brush options and let the user draw using that.How can I achieve that? Thanks in advance.

    Read the article

  • Windows 8 Data Binding Bug - OnPropertyChanged Updates Wrong Object

    - by Andrew
    I'm experiencing some really weird behavior with data binding in Windows 8. I have a combobox set up like this: <ComboBox VerticalAlignment="Center" Margin="0,18,0,0" HorizontalAlignment="Right" Height="Auto" Width="138" Background="{StaticResource DarkBackgroundBrush}" BorderThickness="0" ItemsSource="{Binding CurrentForum.SortValues}" SelectedItem="{Binding CurrentForum.CurrentSort, Mode=TwoWay}"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock HorizontalAlignment="Right" Text="{Binding Converter={StaticResource SortValueConverter}}"/> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> Inside of a page with the DataContext set to a statically located ViewModel. When I change that ViewModel's CurrentForm attribute, who's property is implemented like this... public FormViewModel CurrentForm { get { return _currentForm; } set { _currentForm = value; if (!_currentForm.IsLoaded) { _currentSubreddit.Refresh.Execute(null); } RaisePropertyChanged("CurrentForm"); } } ... something really strange happens. The previous FormViewModel's CurrentSort property is changed to the new FormViewModel's current sort property. This happens as the RaisePropertyChanged event is called, through a managed-to-native transition, with native code invoking the setter of CurrentSort of the previous FormViewModel. Does that sound like a bug in Win8's data binding? Am I doing something wrong?

    Read the article

  • NSUserDefaults with in-app Settings bundle

    - by Hema Vasudevan
    I'm in the process of building an app and would prefer to have an in-app specific Settings bundle rather than make it available in the Settings application. I'm using NSUserDefaults class to save and retrieve them but would like to have the same Settings app look and feel. I wanted to use InAppSettingsKit or the llamasettings but don't know how to use the NSUserDefaults class. Those kits tell me how to create a .plist file and use their kits. All I need is use the Settings app look and feel while at the same time use NSUserDefaults class to save and retrieve values. Please help.

    Read the article

  • Problems with sticky footer html css

    - by CJava
    I'm having trouble making a sticky footer, whatever I do the code completely messes up and re-arranged positioning of other elements. I'm using multiple div elements. I have tried pretty much most tutorials on stickying footers online like http://www.cssstickyfooter.com/using-sticky-footer-code.html Help would be much appreciated. Thanks a lot! html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta name="generator" content="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org"> <title>Southend-on-Sea Independant Tourist Guide</title> <!--Attached CSS to keep constant throughout site--> <link rel="stylesheet" type="text/css" href="style.css"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="description" content="An independant tourist guide on Southend-on-Sea"> <meta name="keywords" content="southend, southend-on-sea, tourist guide, tourist, independant"> <meta name="author" content="Callum Stevens"> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"><!--[if !IE 7]> <style type="text/css"> #wrap {display:table;height:100%} </style> <![endif]--> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="navigation.css"> </head> <body> <div id="container"> <div id="content"> <div id="header"> <table width="200" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="southendpiersept2006edit.jpg" width="700" height="389" alt="southend pier site logo"></td> </tr> </table> </div> <div id="navigation"> <ul> <li class="home"><a href="index.htm">Home</a></li> <li class="places"><a href="places.htm">Places to go</a></li> <li class="things"><a href="things.htm">Things to do</a></li> <li class="where"><a href="where.htm">Where to stay</a></li> <li class="getting"><a href="getting.htm">Getting&lt; here/a&gt;</a></li> <li class="about"><a href="getting.htm"></a><a href="getting.htm"></a><a href="about.htm">About the town</a></li> <li class="contact"><a href="contact.htm">Contact us</a></li> </ul> <table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td></td> </tr> </table> </div> <br> <br> <h1>Southend-On-Sea</h1> <br> <h2>Welcome to Southend-On-Sea Tourist Information Site. You're #1 stop for finding out about Southend!</h2> <br> <h3>This site aims to help you in getting here, finding accomodation, and letting you know whats going on.</h3> <p>paragraph</p> <p id="p2">paragraph2</p> </div> </div> <div id="footer"></div> </body> </html> style.css: html, body { margin: 0px; padding: 0px; text-align:center } body{ background: url(bg.jpg) repeat-x;} #content { text-align:center width:67%; } h2 { text-transform: capitalize;} navigation.css #navigation ul { width: 700px; height: 50px; position: absolute; /** Places image at the top of the page **/ top: 389px; /** Determines the height from the top of the page **/ left: 15.3%; /** Determines the width from the left of the page **/ background: url(menu.jpg) no-repeat 0 0; list-style: none; margin: 0; padding: 0; } #navigation li { display: inline; } #navigation li a:link, #navigation li a:visited { border: none; width: 100px; height: 50px; display: block; position: absolute; top: 0; text-indent: -7000px; outline: none; } #navigation li.home a:link, #navigation li.home a:visited { left: 0; } #navigation li.places a:link, #navigation li.places a:visited { left: 100px } #navigation li.things a:link, #navigation li.things a:visited { left: 200px } #navigation li.where a:link, #navigation li.where a:visited { left: 300px } #navigation li.getting a:link, #navigation li.getting a:visited { left: 400px } #navigation li.about a:link, #navigation li.about a:visited { left: 500px } #navigation li.contact a:link, #navigation li.contact a:visited { left: 600px } #navigation li.home a:hover { background: url(menu.jpg) no-repeat 0 -50px; } #navigation li.places a:hover { background: url(menu.jpg) no-repeat -100px -50px; } #navigation li.things a:hover { background: url(menu.jpg) no-repeat -200px -50px; } #navigation li.where a:hover { background: url(menu.jpg) no-repeat -300px -50px; } #navigation li.getting a:hover { background: url(menu.jpg) no-repeat -400px -50px; } #navigation li.about a:hover { background: url(menu.jpg) no-repeat -500px -50px; } #navigation li.contact a:hover { background: url(menu.jpg) no-repeat -600px -50px; }

    Read the article

  • Can't use method from class in other file

    - by user1833848
    I am not able to use one of my methods that i implemented in my tableviewcell file in my tableview controller implementation. I tried searching the web and xcode help with no luck. My codes looks like this: TableViewController.h: #import TableViewCell.h @interface TableViewController : UITableViewController @property (nonatomic, strong) IBOutlet UIBarButtonItem *A1Buy; @property (nonatomic, getter = isUserInteractionEnabled) BOOL userInteractionEnabled; - (IBAction)A1Buy:(UIBarButtonItem *)sender; TableViewController.m: @implementation A1ViewController @synthesize A1Buy = _A1Buy; @synthesize userInteractionEnabled; - (IBAction)A1Buy:(UIBarButtonItem *)sender { [TableViewCell Enable]; //this is where it gives an error } TableViewCell.h: @interface TableViewCell : UITableViewCell { BOOL Enable; BOOL Disable; } @property (nonatomic, getter = isUserInteractionEnabled) BOOL userInteractionEnabled; TableViewCell.m: @implementation TableViewCell; @synthesize userInteractionEnabled; - (BOOL) Enable { return userInteractionEnabled = YES; } - (BOOL) Disable { return userInteractionEnabled = NO; } As you can see i am trying to enable user interaction with a button, but Xcode only gives me errors like "class does not have this method" and stuff like that. All files are importet correctly so thats not why. Would appreciate any help. Thanks!

    Read the article

  • If statement doesn't work? do download without filed name and email

    - by user1833871
    I've created some if / else statements to get a download when a user hit click jf he fields name and email but doesn"t work for my site http://my-easy-woodworking-projects.com because it is do download without field name and email contact.php is <?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_message = $_POST['cf_message']; $mail_to = '[email protected]'; $subject = 'Message from a site visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Message: '.$field_message; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { echo <script>\n" echo "var str = \"download\"; \n"" echo "document.write(str.link("http://www.myshedplans.com/12BY8SHED.pdf"));\n" echo "</script>\n" } echo else { echo <script language="javascript" type="text/javascript"> echo // Print a message echo alert('Message failed. Please, send an email to [email protected]'); echo // Redirect to some page of the site. You can also specify full URL, e.g. http://template-help.com window.location = 'contact_page.html'; echo </script> }?>

    Read the article

  • Having an issue while trying to implement In-App Purchase

    - by Raymond
    This is my first time to implement In-App purchase and I am using the tutorial located here: Ray Wenderlich Now I am sure this is something simple, but I am having issues figuring out, so I figured I would ask all of the gurus out here. The compiler is saying that _products is Use of undeclared identifier - (void)productPurchased:(NSNotification *)notification { NSString * productIdentifier = notification.object; [_products enumerateObjectsUsingBlock:^(SKProduct * product, NSUInteger idx, BOOL *stop) { if ([product.productIdentifier isEqualToString:productIdentifier]) { *stop = YES; } }]; }

    Read the article

  • Jquery form Ajax Submit

    - by user1766080
    I want to submit a form using ajax in the background. I tried: <div class="form-horizontal" id="form"> <label for="name" class="control-label">Username</label> <div class="controls"> <span id="name_input"><input type="text" name="name" id="medium" class='input-medium input-square'></span> <span class="help-inline" id = "ajax_load"></span> </div> <div class="form-actions"> <button class="btn btn-red5" onclick="resolve()">Login</button> <input type="reset" class='btn btn-danger' value="Reset"> </div> </div> And the Javascript: <script type="text/javascript"> var resolve = function () { jAlert('test', 'test'); $('#ajax_load').html('<a href="#" class="btn btn-mini btn-square tip" title="Reloading"><img src="templates/img/ajax-loader.gif" alt=""></a>'); $.ajax( { url : 'plugin.php?plugin=test', type : 'post', data: $("#form").serialize(), success : function( resp ) { if(resp.ajax_success == false) { } else { jAlert('test', 'test'); } } }); }; </script> I get an alert, but there is no form submit. I checked that with Live http headers. Why does it not submit the form?

    Read the article

  • How do I get a button to show on mouseover using jQuery?

    - by sharataka
    I am trying to get a button to appear over an image when there is a mouseover event over the image. I have multiple images on the screen that I would like to have the same functionality. I'm having trouble getting this to work as the button is always present. Any advice on how to get it to work? Below is the rendered html and javascript. javascript <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script> <script type = "text/javascript"> $(document).ready(function() { $('.image').mouseover(function(){ $('.munchbutton').show(); }); }); </script> css div.munchbutton{ position: absolute; bottom: 5px; right: 0px; left: 60px; } div.wrapper{ float:left; /* important */ position:relative; /* important(so we can absolutely position the description div */ padding: 5px; } html <!-- wrapper div --> <div class='wrapper'> <!-- image --> <div class="image" style="position: relative; left: 0; top: 0;"> <a href="/partners/Business/CNNMoney" > <img src="/static/CNNMoney.png" style="position: relative; top: 0; left: 0;"/> </a> <!-- partner munchbutton div --> <div class='munchbutton'> <form method='post'><div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='7wq8pRYNCDkXUGRv7eU6qI1BU7RKyoT8' /></div> <input type="hidden" name="channel" id="channel" value="CNNMoney" /> <input type='submit' class = 'add' value='Add to plate'/> </form> </div> <!-- end munchbutton div --> </div> <!-- end image div --> </div> <!-- end wrapper div --> <!-- wrapper div --> <div class='wrapper'> <!-- image --> <div class="image" style="position: relative; left: 0; top: 0;"> <a href="/partners/Business/EconomistMagazine" > <img src="/static/EconomistMagazine.png" style="position: relative; top: 0; left: 0;"/> </a> <!-- partner munchbutton div --> <div class='munchbutton'> <form method='post'><div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='7wq8pRYNCDkXUGRv7eU6qI1BU7RKyoT8' /></div> <input type="hidden" name="channel" id="channel" value="EconomistMagazine" /> <input type='submit' class = 'add' value='Add to plate'/> </form> </div> <!-- end munchbutton div --> </div> <!-- end image div --> </div> <!-- end wrapper div -->

    Read the article

  • How to show specific link to user that's signed in and on specific page in rails?

    - by sevens
    I have the following code for part of my navigation: <% if user_signed_in? %> <li><%= link_to 'Edit Profile', edit_profile_path(current_user.profile) %></li> <li><%= link_to 'Edit Account', edit_user_registration_path %></li> <% elsif user_signed_in? and params[:controller] == 'profiles#edit' %> <li><%= link_to 'View Profile', profile_path(current_user.profile) %></li> <li><%= link_to 'Edit Account', edit_user_registration_path %></li> <% else %> <li><%= link_to 'Sign up', new_user_registration_path %></li> <% end %> I want different links to show depending on where the "user_signed_in" is. However, my <% elsif user_signed_in? and params[:controller] == 'profiles#edit' %> doesn't seem to be working. What am I doing wrong?

    Read the article

  • Remove newlines and spaces

    - by Cosmin
    How can I remove newline between <table> .... </table> and add \n after each ex: <table border="0" cellspacing="0" cellpadding="0" width="450" class="descriptiontable"><tr> <td width="50%" valign="top"> <span class="displayb">Model Procesor:</span> Intel Celeron<br><span class="displayb">Frecventa procesor (MHz):</span> 2660<br><span class="displayb">Placa Video:</span> Intel Extreme Graphics 2<br><span class="displayb">Retea integrata:</span> 10/100Mbps, RJ-45<br><span class="displayb">Chipset:</span> Intel 845G<br> </td> <td width="50%" valign="top"> <span class="displayb">Capacitate RAM (MB):</span> 512<br><span class="displayb">Tip RAM:</span> DDR<br> </td> </tr></table> and become : <table border="0" cellspacing="0" cellpadding="0" width="450" class="descriptiontable"><tr><td width="50%" valign="top"><span class="displayb">Model Procesor:</span> Intel Celeron<br><span class="displayb">Frecventa procesor (MHz):</span> 2660<br><span class="displayb">Placa Video:</span> Intel Extreme Graphics 2<br><span class="displayb">Retea integrata:</span> 10/100Mbps, RJ-45<br><span class="displayb">Chipset:</span> Intel 845G<br></td><td width="50%" valign="top"><span class="displayb">Capacitate RAM (MB):</span> 512<br><span class="displayb">Tip RAM:</span> DDR<br></td></tr></table>\n s.

    Read the article

  • What's Wrong With My VB.NET Code Of Windows Forms Application?

    - by Krishanu Dey
    I've to forms frmPrint & frmEmail and a dataset(MyDataset) with some DataTable and DataTable Adapters. In frmPrint I've the following Sub Public Sub StartPrinting() try adapterLettersInSchedules.Fill(ds.LettersInSchedules) adapterLetters.Fill(ds.Letters) adapterClients.Fill(ds.Clients) adapterPrintJobs.GetPrintJobsDueToday(ds.PrintJobs, False, DateTime.Today) For Each prow As MyDataSet.PrintJobsRow In ds.PrintJobs Dim lisrow As MyDataSet.LettersInSchedulesRow = ds.LettersInSchedules.FindByID(prow.LetterInScheduleID) If lisrow.Isemail = False Then Dim clientrow As MyDataSet.ClientsRow = ds.Clients.FindByClientID(prow.ClientID) Dim letterrow As MyDataSet.LettersRow = ds.Letters.FindByID(lisrow.LetterID) 'prow. 'lisrow.is Label1.SuspendLayout() Label1.Refresh() Label1.Text = "Printing letter" txt.Rtf = letterrow.LetterContents txt.Rtf = txt.Rtf.Replace("<%Firstname%>", clientrow.FirstName) txt.Rtf = txt.Rtf.Replace("<%Lastname%>", clientrow.LastName) txt.Rtf = txt.Rtf.Replace("<%Title%>", clientrow.Title) txt.Rtf = txt.Rtf.Replace("<%Street%>", clientrow.Street) txt.Rtf = txt.Rtf.Replace("<%City%>", clientrow.City) txt.Rtf = txt.Rtf.Replace("<%State%>", clientrow.State) txt.Rtf = txt.Rtf.Replace("<%Zip%>", clientrow.Zip) txt.Rtf = txt.Rtf.Replace("<%PhoneH%>", clientrow.PhoneH) txt.Rtf = txt.Rtf.Replace("<%PhoneW%>", clientrow.PhoneW) txt.Rtf = txt.Rtf.Replace("<%Date%>", DateTime.Today.ToShortDateString) Try PDoc.PrinterSettings = printDlg.PrinterSettings PDoc.Print() prow.Printed = True adapterPrintJobs.Update(prow) Catch ex As Exception End Try End If Next prow ds.PrintJobs.Clear() Catch ex As Exception MessageBox.Show(ex.Message, "Print", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub And in frmEmail i've the Following Sub Public Sub SendEmails() try adapterLettersInSchedules.Fill(ds.LettersInSchedules) adapterLetters.Fill(ds.Letters) adapterClients.Fill(ds.Clients) adapterEmailJobs.GetEmailJobsDueToday(ds.EmailJobs, False, Today) Dim ls_string As String For Each prow As MyDataSet.EmailJobsRow In ds.EmailJobs Dim lisrow As MyDataSet.LettersInSchedulesRow = ds.LettersInSchedules.FindByID(prow.LetterInScheduleID) If lisrow.Isemail = True Then Dim clientrow As MyDataSet.ClientsRow = ds.Clients.FindByClientID(prow.ClientID) Dim letterrow As MyDataSet.LettersRow = ds.Letters.FindByID(lisrow.LetterID) txt.Rtf = letterrow.LetterContents ls_string = RTF2HTML(txt.Rtf) ls_string = Mid(ls_string, 1, Len(ls_string) - 176) If ls_string = "" Then Throw New Exception("Rtf To HTML Conversion Failed") Label1.SuspendLayout() Label1.Refresh() Label1.Text = "Sending Email" If SendEmail(clientrow.Email, ls_string, letterrow.EmailSubject) Then Try prow.Emailed = True adapterEmailJobs.Update(prow) Catch ex As Exception End Try Else prow.Emailed = False adapterEmailJobs.Update(prow) End If End If Next prow Catch ex As Exception MessageBox.Show(ex.Message, "Email", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub I'm running this two subs using two different Threads. Public th As New Thread(New ThreadStart(AddressOf StartFirstPrint)) Public th4 As New Thread(New ThreadStart(AddressOf sendFirstEmail)) Here is the code of StartFirstPrint and sendFirstEmail Public Sub StartFirstPrint() Do While thCont Try Dim frm As New frmPrint() 'frm.MdiParent = Me frm.StartPrinting() Catch ex As Exception End Try Loop End Sub Public Sub sendFirstEmail() Do While thCont Try Dim frmSNDEmail As New frmEmail frmSNDEmail.SendEmails() Catch ex As Exception End Try Loop End Sub the thCont is a public boolean variable that specifies when to shop those threads. Most Of the time this works very well. But some times it gives errors Like the following image I don't know why is this occurring. Please help me.

    Read the article

  • Powershell - Splitting string into seperate components

    - by TheD
    I am writing a script which will basically do the following: Read from a text file some arguements: DriveLetter ThreeLetterCode ServerName VolumeLetter Integer Eg. W MSS SERVER01 C 1 These values happen to form a folder destination W:\MSS\, and a filename which works in the following naming convention: SERVERNAME_VOLUMELETTER_VOL-b00X-iYYY.spi - Where The X is the Integer above The value Y I need to work out later, as this happens to be the value of the incremental image (backups) and I need to work out the latest incremental. So at the moment -- Count lines in file, and loop for this many lines. $lines = Get-Content -Path PostBackupCheck-Textfile.txt | Measure-Object -Line for ($i=0; $i -le $lines.Lines; $i++) Within this loop I need to do a Get-Content to read off the line I am currently looking at i.e. line 0, line 1, line 2, as there will be multiple lines in the format I wrote at the beginning and split the line into an array, whereby each part of the file, as seen above naming convention, is in a[0], a[1], a[2]. etc The reason for this is because, I need to then sort the folder that contains these, find the latest file, by date, and take the _iXXX.spi part and place this into the array value a[X] so I then have a complete filename to mount. This value will replace iYYY.spi It's a little complex because I also have to make sure when I do a Get-ChildItem with -Include before I sort it all by date, I am only including the filename that matches the arguements fed to it from the text file : So, SERVER01_C_VOL-b001-iYYY.spi and not anything else. i.e. not SERVER01_D_VOL-b001-iYYY.spi Then take the iYYY value from the sort on the Get-ChildItem -Include and place that into the appropriate array item. I've literally no idea where to start, so any ideas are appreciated! Hopefully I've explained in enough detail. I have also placed the code on Pastebin: http://pastebin.com/vtFifTW6 Thanks!

    Read the article

  • Eclipse does not recognize the file ID

    - by user1833845
    I'm trying to create a button in the application from one activity to another. The document resource/values/strings.xml created for this ID: <string name="button1name"> CID </ string> But the document GurovPictures.java (this is my main activity) when I insert a line: Button but1 = (Button) findViewById (R.id.button1); This "button1" does not become blue like "editText1". Do you happen to know how to fix it? Just the internet no entries found.

    Read the article

  • Java semaphore to syncronize printing to screen

    - by Travis Griswald
    I'm currently stuck on a bit of homework and was wondering if anyone could help - I have to use semaphores in java to syncronize printing letters from 2 threads - one printing "A" and one printing "B". I cannot print out more than 2 of the same character in a row, so output should look like AABABABABABBABABABABAABBAABBABABA At the moment I have 3 semaphores, a binary mutex set to 1, and a counting semaphore, and my thread classes look something like this - public void run() { while (true) { Time.delay(RandomGenerator.integer(0,20)); Semaphores.mutex.down (); System.out.println (produce()); if (printCount > 1) { printCount = 0; Semaphores.mutex.up (); Semaphores.printB.up(); } } } public String produce() { printCount++; return "A"; } public void run() { while (true) { Time.delay(RandomGenerator.integer(0,20)); Semaphores.mutex.down (); System.out.println (produce()); if (printCount > 1) { printCount = 0; Semaphores.mutex.up (); Semaphores.printA.up(); } } } public String produce() { printCount++; return "B"; } Yet whatever I try it either deadlocks, or it seems to be working only printing 2 in a row at most, but always seems to print 3 in a row every now and again! Any help is much appreciated, not looking code or anything just a few pointers if possible :)

    Read the article

  • I'm getting the following error ''expected an indented block'' Where is the failing code?

    - by user1833814
    import math def area(base, height): '''(number,number) -> number Return the area of a wirh given base and height. >>>area(10,40) 200.0 ''' return base * height / 2 def perimeter(side1, side2, side3): '''(number,number,number) -> number Return the perimeter of the triangle with sides of length side1,side2 and side3. >>>perimeter(3,4,5) 12 >>>perimeter(10.5,6,9.3) 25.8 ''' return (side1 + side2 + side3) def semiperimeter(side1, side2, side3): return perimeter(side1, side2, side3) / 2 def area_hero(side1, side2, side3): semi = semiperimeter(side1, side2, side3) area = math.sqrt((semi * (semi - side1) * (semi - side2) * (semi - side3)) return area

    Read the article

  • Problems reading text file data in Java

    - by user1828401
    I have this code: BufferedReader br =new BufferedReader(new FileReader("userdetails.txt")); String str; ArrayList<String> stringList = new ArrayList<String>(); while ((str=br.readLine())!=null){ String datavalue [] = str.split(","); String category = datavalue[0]; String value = datavalue[1]; stringList.add(category); stringList.add(value); } br.close(); it works when the variables category and value do not have a comma(,),however the values in the variable value does contain commas.Is there a way that I can split the index of the without using comma?

    Read the article

  • When I try to run vim in command line I get Python errors

    - by Eduan
    When I try running vim in the Terminal (so as to follow @romainl's suggestion in my other question) I get lots of Python errors, which all boil down to: IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (No such file or directory) Why is this? I can use Python or Sublime Text even, without any problems. The full list of errors is the following: Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 565, in <module> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 547, in main File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 278, in addusersitepackages File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 253, in getusersitepackages File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 243, in getuserbase File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 523, in get_config_var File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 419, in get_config_vars File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 298, in _init_posix IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (No such file or directory) Extra info: I am on Mac OS X Mountain Lion (OS 10.8) EDIT: I tried @BobDunakey idea with no success, the idea was to use sudo. I still get the same errors. EDIT 2: I was able to solve the problem thanks to Zirak's solution, which is the following: http://clearfix.be/2012/08/05/fix-mountain-lion-10-8-python-ioerror-pyconfig-h-error/

    Read the article

  • Bluetooth to arduino

    - by user1833709
    My current project includes an Arduino Uno attached via USB to a laptop. The laptop is there is receive messages via bluetooth (I realize I could connect a bluetooth modem directly to the arduino but this project has to come in under budget). What I'd ideally like to do is write a program that continually checks whether the laptop has been paired to a bluetooth transmitter (my phone) and sends this to the arduino. Do you think should write a program that checks the bluetooth state and writes a 0 or 1 to a text document, and then use something like Gobetwino to read from the text document? I could probably figure out how to continually read from the file, but I don't know enough about bluetooth to know how to check whether it's paired or not, computer-side. Something that writes directly to the arduino instead of a text document would be my preference, but I don't know where to start. I'm using an Android phone and Windows 7. If you need more info about the setup, just ask. Does anyone have any experience with this?

    Read the article

  • Does a jQuery selector by id always work without quotes and # sign?

    - by anarinsky
    I suddenly found that while using Mozilla / jQuery v1.8.2 I do not need to use the id with quotes and # sign. For example, $(bt2) works the same as $(“#bt2”), see the code below. Will this selector always work and are there any potential drawbacks from using this shorter form of selection? <html> <head> <title>append</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready (function(){ $(bt2).click(function(){ $(i1).append("<li>a4</li>", "<li>a5</li>"); }); }); </script> </head> <body> <button id="Button1">Append List</button> <ul id="i1"> <li>a1</li> </ul> </body> </html>

    Read the article

  • Timeout event in netty 4

    - by user1819425
    Hi I would like receive an event where messageReceived does not get called within an expected time. I tried with ReadTimeoutHandler where it generates exception where I can handle in exceptionCaught() where I would would do some work and return without closing the context. but right after that I got a bunch of exception Nov 18, 2012 8:56:34 AM io.netty.channel.ChannelInitializer WARNING: Failed to initialize a channel. Closing: [id: 0xa81de260, /127.0.0.1:59763 = /127.0.0.1:59724] io.netty.channel.ChannelHandlerLifeCycleException: io.netty.handler.timeout.ReadTimeoutHandler is not a @Sharable handler, so can't be added or removed multiple times. at io.netty.channel.DefaultChannelPipeline.callBeforeAdd(DefaultChannelPipeline.java:629) at io.netty.channel.DefaultChannelPipeline.addLast0(DefaultChannelPipeline.java:173) Am I doing correctly? Thanks

    Read the article

  • Cascading S3 Sink Tap not being deleted with SinkMode.REPLACE

    - by Eric Charles
    We are running Cascading with a Sink Tap being configured to store in Amazon S3 and were facing some FileAlreadyExistsException (see [1]). This was only from time to time (1 time on around 100) and was not reproducable. Digging into the Cascading codem, we discovered the Hfs.deleteResource() is called (among others) by the BaseFlow.deleteSinksIfNotUpdate(). Btw, we were quite intrigued with the silent NPE (with comment "hack to get around npe thrown when fs reaches root directory"). From there, we extended the Hfs tap with our own Tap to add more action in the deleteResource() method (see [2]) with a retry mechanism calling directly the getFileSystem(conf).delete. The retry mechanism seemed to bring improvement, but we are still sometimes facing failures (see example in [3]): it sounds like HDFS returns isDeleted=true, but asking directly after if the folder exists, we receive exists=true, which should not happen. Logs also shows randomly isDeleted true or false when the flow succeeds, which sounds like the returned value is irrelevant or not to be trusted. Can anybody bring his own S3 experience with such a behavior: "folder should be deleted, but it is not"? We suspect a S3 issue, but could it also be in Cascading or HDFS? We run on Hadoop Cloudera-cdh3u5 and Cascading 2.0.1-wip-dev. [1] org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory s3n://... already exists at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:132) at com.twitter.elephantbird.mapred.output.DeprecatedOutputFormatWrapper.checkOutputSpecs(DeprecatedOutputFormatWrapper.java:75) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:923) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:882) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1278) at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:882) at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:856) at cascading.flow.hadoop.planner.HadoopFlowStepJob.internalNonBlockingStart(HadoopFlowStepJob.java:104) at cascading.flow.planner.FlowStepJob.blockOnJob(FlowStepJob.java:174) at cascading.flow.planner.FlowStepJob.start(FlowStepJob.java:137) at cascading.flow.planner.FlowStepJob.call(FlowStepJob.java:122) at cascading.flow.planner.FlowStepJob.call(FlowStepJob.java:42) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.j [2] @Override public boolean deleteResource(JobConf conf) throws IOException { LOGGER.info("Deleting resource {}", getIdentifier()); boolean isDeleted = super.deleteResource(conf); LOGGER.info("Hfs Sink Tap isDeleted is {} for {}", isDeleted, getIdentifier()); Path path = new Path(getIdentifier()); int retryCount = 0; int cumulativeSleepTime = 0; int sleepTime = 1000; while (getFileSystem(conf).exists(path)) { LOGGER .info( "Resource {} still exists, it should not... - I will continue to wait patiently...", getIdentifier()); try { LOGGER.info("Now I will sleep " + sleepTime / 1000 + " seconds while trying to delete {} - attempt: {}", getIdentifier(), retryCount + 1); Thread.sleep(sleepTime); cumulativeSleepTime += sleepTime; sleepTime *= 2; } catch (InterruptedException e) { e.printStackTrace(); LOGGER .error( "Interrupted while sleeping trying to delete {} with message {}...", getIdentifier(), e.getMessage()); throw new RuntimeException(e); } if (retryCount == 0) { getFileSystem(conf).delete(getPath(), true); } retryCount++; if (cumulativeSleepTime > MAXIMUM_TIME_TO_WAIT_TO_DELETE_MS) { break; } } if (getFileSystem(conf).exists(path)) { LOGGER .error( "We didn't succeed to delete the resource {}. Throwing now a runtime exception.", getIdentifier()); throw new RuntimeException( "Although we waited to delete the resource for " + getIdentifier() + ' ' + retryCount + " iterations, it still exists - This must be an issue in the underlying storage system."); } return isDeleted; } [3] INFO [pool-2-thread-15] (BaseFlow.java:1287) - [...] at least one sink is marked for delete INFO [pool-2-thread-15] (BaseFlow.java:1287) - [...] sink oldest modified date: Wed Dec 31 23:59:59 UTC 1969 INFO [pool-2-thread-15] (HiveSinkTap.java:148) - Now I will sleep 1 seconds while trying to delete s3n://... - attempt: 1 INFO [pool-2-thread-15] (HiveSinkTap.java:130) - Deleting resource s3n://... INFO [pool-2-thread-15] (HiveSinkTap.java:133) - Hfs Sink Tap isDeleted is true for s3n://... ERROR [pool-2-thread-15] (HiveSinkTap.java:175) - We didn't succeed to delete the resource s3n://... Throwing now a runtime exception. WARN [pool-2-thread-15] (Cascade.java:706) - [...] flow failed: ... java.lang.RuntimeException: Although we waited to delete the resource for s3n://... 0 iterations, it still exists - This must be an issue in the underlying storage system. at com.qubit.hive.tap.HiveSinkTap.deleteResource(HiveSinkTap.java:179) at com.qubit.hive.tap.HiveSinkTap.deleteResource(HiveSinkTap.java:40) at cascading.flow.BaseFlow.deleteSinksIfNotUpdate(BaseFlow.java:971) at cascading.flow.BaseFlow.prepare(BaseFlow.java:733) at cascading.cascade.Cascade$CascadeJob.call(Cascade.java:761) at cascading.cascade.Cascade$CascadeJob.call(Cascade.java:710) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)

    Read the article

  • PHPExcel reading columns

    - by user1270150
    I am new to using the PHPExcel and am struggling to implement a basic reader that can be used to read only specified columns, with all rows from a spreadsheet into an array, which I would like to present in a webpage. After reading the supplied documentation and examples, I am struggling to wrap my head round the implementation of a number of examples, so any help would be much appreciated. I am using the following code to get the contents of the default worksheet into an array: for ($row = 2; $row <= $highestRow; $row++) { $dataRow = $objWorksheet->rangeToArray('A'.$row.':'.$highestColumn.$row,null, true, true, true); if ((isset($dataRow[$row]['A'])) && ($dataRow[$row]['A'] > '')) { ++$r; foreach($headingsArray as $columnKey => $columnHeading) { $columnHeading = rtrim($columnHeading); $columnHeading = preg_replace('/\s+/', ' ',$columnHeading); $columnHeading = preg_replace('/\ /', '_',$columnHeading); $columnHeading = strtolower($columnHeading); $namedDataArray[$r][$columnHeading] = $dataRow[$row][$columnKey]; } } } Above code reads through all the columns and rows and builds and array, but I would like to be able to add a configuration array that will declare columns that should be read...sure this is possible, so any help would be much appreciated. Thanks

    Read the article

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