text
stringlengths
8
267k
meta
dict
Q: Android MediaPlayer Mute and unmute I am playing a video using MediaPlayer. Now there is a mute/unmute button. This toggle button should set first the video play without sound, on second press it should make its volume to its initial state. I tried with AudioManager.setMicrophoneMute method. It did not work. How it can be done? A: You can use AudioManager.setStreamMute(int streamType, boolean on) Setting it to true will change stream's volume to 0, and false restores volume value. More information at http://developer.android.com/reference/android/media/AudioManager.html#setStreamMute(int,boolean) A: The setMicrophoneMute() mutes the microphone (obviously), this is an input device. Microphone does not participate in audio playback and therefore muting it has no effect. You can use MediaPlayer.setVolume() to mute/unmute the output. For an idea how to implement this see this thread.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568140", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Recommendations Bar not posting 'read' items to timeline I have seen various posts about the add-to-timeline social plugin being 'broken', however have any of you managed to get the to work? With the og:type set to article the plugin was marking posts as 'read' but they were not appearing anywhere in the timeline, news-ticker or news feed. I added prefix="og: http://ogp.me/ns# otilogin: http://ogp.me/ns/apps/otilogin#" to the opening tag, as seen in the HTML examples on the Tutorial. This did not fix the problem. Any suggestions or help would be greatly appreciated. (If you wish to check the source or run an article through the debug tool here is an example article's address: http://www2.onthisisland.com/driving-cypriot/2010/11/06/)
{ "language": "en", "url": "https://stackoverflow.com/questions/7568142", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: How to disable the color change of item in ListBox when the mouse on the item ? I have simple ListBox with some objects. When the mouse is on some object the object background color is change. Is it possible to avoid this color change with out disable the object ? ( this object contain button that must to be enable ) Thanks for any help. A: You can remove the visual state animation from the ListBoxItem template. The default template can be found here. The style without mouseover background looks so: <Style x:Key="IgnoreMouseOverItem" TargetType="ListBoxItem"> <Setter Property="Padding" Value="3" /> <Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="VerticalContentAlignment" Value="Top" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderThickness" Value="1"/> <Setter Property="TabNavigation" Value="Local" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem"> <Grid Background="{TemplateBinding Background}"> <vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualState x:Name="Normal" /> <vsm:VisualState x:Name="MouseOver"> <!--<Storyboard> <DoubleAnimation Storyboard.TargetName="fillColor" Storyboard.TargetProperty="Opacity" Duration="0" To=".35"/> </Storyboard>--> </vsm:VisualState> <vsm:VisualState x:Name="Disabled"> <Storyboard> <DoubleAnimation Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="Opacity" Duration="0" To=".55" /> </Storyboard> </vsm:VisualState> </vsm:VisualStateGroup> <vsm:VisualStateGroup x:Name="SelectionStates"> <vsm:VisualState x:Name="Unselected" /> <vsm:VisualState x:Name="Selected"> <Storyboard> <DoubleAnimation Storyboard.TargetName="fillColor2" Storyboard.TargetProperty="Opacity" Duration="0" To=".75"/> </Storyboard> </vsm:VisualState> </vsm:VisualStateGroup> <vsm:VisualStateGroup x:Name="FocusStates"> <vsm:VisualState x:Name="Focused"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility" Duration="0"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Unfocused"/> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups> <Rectangle x:Name="fillColor" Opacity="0" Fill="#FFBADDE9" IsHitTestVisible="False" RadiusX="1" RadiusY="1"/> <Rectangle x:Name="fillColor2" Opacity="0" Fill="#FFBADDE9" IsHitTestVisible="False" RadiusX="1" RadiusY="1"/> <ContentPresenter x:Name="contentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}"/> <Rectangle x:Name="FocusVisualElement" Stroke="#FF6DBDD1" StrokeThickness="1" Visibility="Collapsed" RadiusX="1" RadiusY="1" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> And then apply the new style to the ListBox <ListBox ItemContainerStyle="{StaticResource IgnoreMouseOverItem}" /> A: If you just want to avoid highlighting, you can use ItemsControl.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568143", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Displaying Video from webcam in opencv on GTK+ I'm new to this and was wondering what i need to do to my open cv code to display using gtk. Does it need to be converted or what? A: It's fairly simple to do using Python. Here is a class that I've written to control a webcam using OpenCV and convert the frames to a NumPy array: https://github.com/ptomato/REP-instrumentation/blob/master/rep/generic/opencv_webcam.py After that, you can use gtk.gdk.pixbuf_new_from_array() to create a pixbuf which you can then create a gtk.Image from. Note that PyGTK needs to be compiled with NumPy support for this to work. You can also use Matplotlib to display the frame in a GTK user interface. Here's another class that I've written that does that: https://github.com/ptomato/Beams/blob/4276a1b98d4df2843d3e22b1be99ea0cabb4f6d4/src/CameraImage.py
{ "language": "en", "url": "https://stackoverflow.com/questions/7568144", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Compare version numbers without using split function How do I compare version numbers? For instance: x = 1.23.56.1487.5 y = 1.24.55.487.2 A: In addition to @JohnD 's answer there might be a need to compare only partial version numbers without using Split('.') or other string <-> int conversion bloat. I've just written an extension method CompareTo with 1 additional argument - number of significant parts of version number to compare (between 1 and 4). public static class VersionExtensions { public static int CompareTo(this Version version, Version otherVersion, int significantParts) { if(version == null) { throw new ArgumentNullException("version"); } if(otherVersion == null) { return 1; } if(version.Major != otherVersion.Major && significantParts >= 1) if(version.Major > otherVersion.Major) return 1; else return -1; if(version.Minor != otherVersion.Minor && significantParts >= 2) if(version.Minor > otherVersion.Minor) return 1; else return -1; if(version.Build != otherVersion.Build && significantParts >= 3) if(version.Build > otherVersion.Build) return 1; else return -1; if(version.Revision != otherVersion.Revision && significantParts >= 4) if(version.Revision > otherVersion.Revision) return 1; else return -1; return 0; } } A: public int compareVersion(string Version1,string Version2) { System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"([\d]+)"); System.Text.RegularExpressions.MatchCollection m1 = regex.Matches(Version1); System.Text.RegularExpressions.MatchCollection m2 = regex.Matches(Version2); int min = Math.Min(m1.Count,m2.Count); for(int i=0; i<min;i++) { if(Convert.ToInt32(m1[i].Value)>Convert.ToInt32(m2[i].Value)) { return 1; } if(Convert.ToInt32(m1[i].Value)<Convert.ToInt32(m2[i].Value)) { return -1; } } return 0; } A: Can you use the Version class? https://learn.microsoft.com/en-us/dotnet/api/system.version It has an IComparable interface. Be aware this won't work with a 5-part version string like you've shown (is that really your version string?). Assuming your inputs are strings, here's a working sample with the normal .NET 4-part version string: static class Program { static void Main() { string v1 = "1.23.56.1487"; string v2 = "1.24.55.487"; var version1 = new Version(v1); var version2 = new Version(v2); var result = version1.CompareTo(version2); if (result > 0) Console.WriteLine("version1 is greater"); else if (result < 0) Console.WriteLine("version2 is greater"); else Console.WriteLine("versions are equal"); return; } } A: Here's mine. I needed to compare some wacky version strings like "3.2.1.7650.b40" versus "3.10.1" so I couldn't use the VersionInfo object as suggested above. This is quick and dirty so ding me for style. I did also provide a short function to test it. using System; public class Program { public static void Main() { Test_CompareVersionStrings(); } /// <summary> /// Compare two version strings, e.g. "3.2.1.0.b40" and "3.10.1.a". /// V1 and V2 can have different number of components. /// Components must be delimited by dot. /// </summary> /// <remarks> /// This doesn't do any null/empty checks so please don't pass dumb parameters /// </remarks> /// <param name="v1"></param> /// <param name="v2"></param> /// <returns> /// -1 if v1 is lower version number than v2, /// 0 if v1 == v2, /// 1 if v1 is higher version number than v2, /// -1000 if we couldn't figure it out (something went wrong) /// </returns> private static int CompareVersionStrings(string v1, string v2) { int rc = -1000; v1 = v1.ToLower(); v2 = v2.ToLower(); if (v1 == v2) return 0; string[] v1parts = v1.Split('.'); string[] v2parts = v2.Split('.'); for (int i = 0; i < v1parts.Length; i++) { if (v2parts.Length < i+1) break; // we're done here string v1Token = v1parts[i]; string v2Token = v2parts[i]; int x; bool v1Numeric = int.TryParse(v1Token, out x); bool v2Numeric = int.TryParse(v2Token, out x); // handle scenario {"2" versus "20"} by prepending zeroes, e.g. it would become {"02" versus "20"} if (v1Numeric && v2Numeric) { while (v1Token.Length < v2Token.Length) v1Token = "0" + v1Token; while (v2Token.Length < v1Token.Length) v2Token = "0" + v2Token; } rc = String.Compare(v1Token, v2Token, StringComparison.Ordinal); //Console.WriteLine("v1Token=" + v1Token + " v2Token=" + v2Token + " rc=" + rc); if (rc != 0) break; } if (rc == 0) { // catch this scenario: v1="1.0.1" v2="1.0" if (v1parts.Length > v2parts.Length) rc = 1; // v1 is higher version than v2 // catch this scenario: v1="1.0" v2="1.0.1" else if (v2parts.Length > v1parts.Length) rc = -1; // v1 is lower version than v2 } if (rc == 0 || rc == -1000) return rc; else return rc < 0 ? -1 : 1; } private static int _CompareVersionStrings(string v1, string v2) { int rc = CompareVersionStrings(v1, v2); Console.WriteLine("Compare v1: " + v1 + " v2: " + v2 + " result: " + rc); return rc; } // for debugging private static void Test_CompareVersionStrings() { bool allPass = true; // should be equal allPass &= (0 == _CompareVersionStrings("1", "1")); allPass &= (0 == _CompareVersionStrings("1.1", "1.1")); allPass &= (0 == _CompareVersionStrings("3.3.a20", "3.3.A20")); // v1 should be lower allPass &= (-1 == _CompareVersionStrings("1", "2")); allPass &= (-1 == _CompareVersionStrings("1.0", "1.0.1")); allPass &= (-1 == _CompareVersionStrings("1.0", "1.1")); allPass &= (-1 == _CompareVersionStrings("1.0.0.3", "1.1")); allPass &= (-1 == _CompareVersionStrings("1.2.3.4", "1.2.3.4b")); allPass &= (-1 == _CompareVersionStrings("1.2.3.4", "1.2.3.4.b")); allPass &= (-1 == _CompareVersionStrings("1.8.0", "20.0.0.0")); allPass &= (-1 == _CompareVersionStrings("5.6.0.788.2", "20.0.0.0")); // v1 should be higher allPass &= (1 == _CompareVersionStrings("2", "1")); allPass &= (1 == _CompareVersionStrings("1.0.1", "1.0")); allPass &= (1 == _CompareVersionStrings("1.1", "1.0")); allPass &= (1 == _CompareVersionStrings("1.1", "1.0.0.3")); allPass &= (1 == _CompareVersionStrings("1.2.3.4b", "1.2.3.4")); allPass &= (1 == _CompareVersionStrings("1.2.3.4.b", "1.2.3.4")); allPass &= (1 == _CompareVersionStrings("20.0.0.0", "5.6.0.788.2")); Console.WriteLine("allPass = " + allPass.ToString()); } } A: If you can live with the major.minor.build.revision scheme you could use the .Net Version class. Otherwise you'd have to implement some kind of parsing from left to right and continuing until you have a difference or return that two versions are equal. A: If for some reason you are not allowed to use the compare-method of the Version directly (e.g. in a client-server scenario), another approach is to extract a long number from the version and then compare the numbers with each other. However, the number needs to have the following format: Two digits for Major, Minor and Revision and four for Build. How to extract the version number: var version = Assembly.GetExecutingAssembly().GetName().Version; long newVersion = version.Major * 1000000000L + version.Minor * 1000000L + version.Build * 1000L + version.Revision; And then somewhere else you can just compare: if(newVersion > installedVersion) { //update code } Note: the installedVersion is a previously extracted long number A: I found this algoritm on internet seems to work well. //https://www.geeksforgeeks.org/compare-two-version-numbers/amp/ static int versionCompare(string v1, string v2) { // vnum stores each numeric // part of version int vnum1 = 0, vnum2 = 0; // loop until both string are // processed for (int i = 0, j = 0; (i < v1.Length || j < v2.Length);) { // storing numeric part of // version 1 in vnum1 while (i < v1.Length && v1[i] != '.') { vnum1 = vnum1 * 10 + (v1[i] - '0'); i++; } // storing numeric part of // version 2 in vnum2 while (j < v2.Length && v2[j] != '.') { vnum2 = vnum2 * 10 + (v2[j] - '0'); j++; } if (vnum1 > vnum2) return 1; if (vnum2 > vnum1) return -1; // if equal, reset variables and // go for next numeric part vnum1 = vnum2 = 0; i++; j++; } return 0; }
{ "language": "en", "url": "https://stackoverflow.com/questions/7568147", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "160" }
Q: Paperclip image inside link_to => undefined method `symbolize_keys!' for # I have the following code: <% if design.avatar.file? %> <%= link_to image_tag design.avatar.url(:thumb), design %> <% else %> <%= link_to image, design %> <% end%> And i get this error: undefined method `symbolize_keys!' for #<Design:0x00000002dfa5f0> But then, if I remove the design part from first link, leaving code like this: <% if design.avatar.file? %> <%= link_to image_tag design.avatar.url(:thumb) %> <% else %> <%= link_to image, design %> <% end%> It works! Obviously with an empty link in the first place, but renders the page. The image variable is defined in application_helper.rb as follows: def image image = image_tag("image.jpg", :alt => %(No image available), :class => "round") end I'm obviously missing something here... A: you should at least put parentheses around your inner method call: <%= link_to image_tag(design.avatar.url(:thumb)), design %> because ruby interprets design as second argument to image_tag, and image_tag expects a hash there, which it tries to normalize (with symbolize_keys!)
{ "language": "en", "url": "https://stackoverflow.com/questions/7568148", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: h:commandLink not firing the form.submit event When my page is loaded I execute the following JS script, which I use to display a popup saying (please wait...) when any form is submitted. jQuery(function(){ jQuery("form").submit(function(){jQuery('#wait-link').trigger('click');return true;}); }); This works fine when using h:commandButton tag, however when I use the h:commandLink tag it doesn't work because the form is submitted by java script (from the file jsf.js in the jar jsf-impl.jar) as shown below mojarra.jsfcljs = function jsfcljs(f, pvp, t) { mojarra.apf(f, pvp); var ft = f.target; if (t) { f.target = t; } f.submit(); f.target = ft; mojarra.dpf(f); }; To solve this problem I copied the jsf.js file under WEB-INF/resources/javax.faces/jsf.js and modified it to trigger the form submit method using jQuery. This works fine but: 1) I don't like the fact that I am touching the jsf.js file since it may change in newer releases of JSF. 2) I don't like the fact that I am using jQuery inside the jsf.js file. Is there a better solution to solve this problem? A: You should use jsf.ajax.*, since it is standard as part of the JSF2 spec. In there you have for example jsf.ajax.addOnEvent(callback) that does what you want. After you hook in your listener, you can use as much jQuery as you want. update: If you want to intercept it from your own JS, without touching their stuff you can do: (function() { var oldjsfcljs = mojarra.jsfcljs; mojarra.jsfcljs = function() { console.log('my stuff before'); oldjsfcljs.apply(this, arguments); console.log('my stuff after'); } })(); A: As Bodgan suggested a better solution is to execute the following piece of code when the page is loaded, I don't know what the term is in JS but seems an override for me. jQuery(function(){ var oldjsfcljs = mojarra.jsfcljs; // save a pointer to the old function mojarra.jsfcljs = function jsfcljs(f, pvp, t) { jQuery(jq(f.id)).trigger('submit'); oldjsfcljs.apply(this, arguments); }; }); function jq(myid) { return '#' + myid.replace(/(:|\.)/g, '\\$1'); } Note: the jq() method is only used to escape the special characters in the form ID. update: the above code seemed to work but if you have parameters in the form it wont so I had to rewrite the mojarra.jsfcljs function as follows: jQuery(function(){ mojarra.jsfcljs = function jsfcljs(f, pvp, t) { mojarra.apf(f, pvp); var ft = f.target; if (t) { f.target = t; } // trigger the submit event manually. jQuery(jq(f.id)).trigger('submit'); f.submit(); f.target = ft; mojarra.dpf(f); }; };
{ "language": "en", "url": "https://stackoverflow.com/questions/7568154", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: What are the reasons behind disabling cURL for security? Many hosts use to disable cURL because of "some" security reasons. I'm looking for these reasons. A quick google lookup didn't give me an in-depth information. A: Many infections (especially botnet types and some admin-shell types) that abuse arbitrary code execution vulnerabilities will inject a small payload script that then uses cURL or wget to download further instructions and configuration. It may be for blocked in attempt to limit the impact of these robotic attacks. A: I remember there were some bugs in cURL with PHP version but it was long time ago and all used PHP versions now have no cURL exploits A: I guess, real reason is not security, but rather financial ;) Once you pay them - there is no problem with cURL anymore.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568160", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: tableview image not getting refreshed in my cellForRowAtIndexPath delegate i am trying to load different images into a custom cell depending on which array (detailViewListLoadMore) is being loaded into the table. The array contains annotation objects. however the images dont seem to refresh, they seem to be the same as the last array unless i scroll down and then they are correct, its like they are being pre loaded from the last array. here is my method: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //set up custom table cell static NSString *CustomCellIdentifier = @"CustomCellIdentifier"; //reuse the custom cell UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier]; //setup custom cell if (cell == nil) { //load custom cell from nib NSArray *nibArray = [[NSBundle mainBundle] loadNibNamed:@"CustomDetailViewCell" owner:self options:nil]; if ([nibArray count] > 0) cell = self.detailCell; else NSLog(@"failed to load CustomDetailViewCell nib file"); } //configure the cell row NSUInteger row = [indexPath row]; //create temp cell lable strings NSString *headingString, *detailString, *subDetailString, *imageString; UIImage *cellDistanceImage; //create temp annotation object Annotation *tempAnnotationObj = [detailViewListLoadMore objectAtIndex:row]; if (tempAnnotationObj.type == @"one") cellDistanceImage = [UIImage imageNamed:@"AnnotationOne.png"]; else if (tempAnnotationObj.type == @"two") cellDistanceImage = [UIImage imageNamed:@"AnnotationTwo.png"]; else if (tempAnnotationObj.type == @"three") cellDistanceImage = [UIImage imageNamed:@"AnnotationThree.png"]; } //set table cell strings headingString = tempAnnotationObj.streetName; detailString = [NSString stringWithFormat:@"No of Bays: %@",tempAnnotationObj.bays]; subDetailString = [NSString stringWithFormat:@"%@m",tempAnnotationObj.distance]; //update heading label UILabel *headingLabel = (UILabel *)[cell viewWithTag:1]; headingLabel.text = headingString; //update detail label UILabel *detailLabel = (UILabel *)[cell viewWithTag:2]; detailLabel.text = detailString; //update sub detail label UILabel *subDetailLabel = (UILabel *)[cell viewWithTag:3]; subDetailLabel.text = subDetailString; //set appropriate distance image [self.detailCellImage setImage:cellDistanceImage]; return cell; } Any help would be appreciated. Cheers, Chris A: Have you tried putting [tableView reloadData]; into the method that changes tableView's data source? A: why you have set //set appropriate distance image [self.detailCellImage setImage:cellDistanceImage]; with self if you want to set image on cell? i think it should be cell.detailCellImage A: seemed to work it out using this.... UIImageView *anImageView = (UIImageView *)[cell viewWithTag:4]; [anImageView setImage:cellDistanceImage];
{ "language": "en", "url": "https://stackoverflow.com/questions/7568162", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: MouseWheel handler doesn't handle MouseEvent with my .NET 2 form I'd like to be an early adopter of using the mouse wheel to scroll my document and although the Forms designer doesn't publish the onMouseWheel property I have configured the handler programmatically in my ctor just after InitializeComponent();- 'cos I'm not so bold as to mess with that. Form1() { InitializeComponent(); this->MouseWheel += gcnew MouseEventHandler(this, &Form1::Form1_MouseWheel); //stuff } I'm trapping there okay but I can't trap in the handler itself. Anyone else get this problem? I'm using a Synaptics touchpad and .NET 2.0 on VS2008 (for backwards compatibility). The cursor changes to the rolling wheen but no further action occurs on screen. Answers in C# are equally appreciated. Thanks. A: Would it be bad form to add a belated comment to Mouse Wheel Event (C#) ? There lies my answer, although in this case it was the textbos which had taken the focus from the Form and captured its mousewheel event. I suppose I shouldn't have asked the original question, maybe it will help others not have to.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568166", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: ipad UIImagePickerController videoQuality I am trying to set the video quality for the UIImagePickerController but I see something really werid now. The effect on the video quality only happen after I reset my application. I try to change the video quality based on some user setting, by some code like this: if ([preferences boolForKey:kVideoQuality]) { NSLog(@"High Quality"); self.pickerController.videoQuality = UIImagePickerControllerQualityTypeHigh; } else { NSLog(@"Low Quality"); self.pickerController.videoQuality = UIImagePickerControllerQualityTypeMedium; } NSLog(@"%d", self.pickerController.videoQuality); Everything looks good, when I change the setting to High Quality, the "High Quality" is output and vice versa. I also double check by the last NSLog and it aslo output the correct quality. But if I am in the high quality mode and I set to low quality, nothing happens. If I reset the app by quitting it and going back, the video record now is in low quality mode. Anybody knows what can be possible causes? A: You're setting the picker view's videoQuality property. Its delegate methods are sometimes not called when making a selection programatically. Try calling the delegate methods directly after changing the selection and see if it works. A: It turns out to be a bug of the iOS SDK, it is fixed in the iOS 5 now. A: What if you destroyed the imagePicker, and created a new one again after setting it? Not a fix - but a workaround! A: the same problem here(Testing device: iPhone 4; OS: iOS 5.0.1): Never see any difference between the video returned for UIImagePickerControllerQualityTypeMedium UIImagePickerControllerQualityTypeHigh even if I quit the App. Spent 1 hour, no findings, I am going to give up on this... Sad.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568169", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: Tuning in Teradata (group by) I am trying to tune a query in Teradata. It's pretty huge, so I am giving below the outline: SEL column_1, column_2......column_20, sum(column_21), sum(column_22),.....sum(column_30) from table_a a inner join table_b b on conditions... group by column_1, ...,column_20; I am trying to tune this. It's hitting a performance roadblock in the group by. The tables A and B are huge (more than 2 billion records). I tried the following options, but none of them improved the performance: 1) Collected all necessary stats 2) Created a JI on the columns from table A and B 3) Created an AJI on the columns and the summations from table A and B 4) Created a SI on each of the tables for the columns involved in group by. Can someone suggest how to proceed further? A: It is very hard to say anything , without having any details about: * *query (is it always they same, or there is always different WHERE ) *structure of A and B (primary indexes/partitioning) *execution plan *log of execution (to see where is the bottleneck) But if we assume that this single query is exactly the same every time then AJI is created and used during execution, then then only improvement that I can think of would be trying to adjust primary index of JI, so its distribution among amp would be as uniform as possible (BTW if AJI is used then steps 2 & 4 would be waste of your time and db space)
{ "language": "en", "url": "https://stackoverflow.com/questions/7568172", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: css classes and id's Possible Duplicate: Use HTML tag names, classes or IDs in CSS? In CSS, what are the major differences with classes and ids? Why use classes for xyz and why use ids for abc? I know there are similar questions on here, but none are really answered properly. I know to use classes with multiple elements with the same properties and ids with unique properties or unique elements, but why? Wouldn't it be an acceptable practice to just use classes so that you don't confuse yourself switching between classes and ids? What is the difference in regards to speed and optimization, SEO, etc...? A: Wouldn't it be an acceptable practice to just use classes so that you don't confuse yourself switching between classes and ids? Yes it would be, but let's say you have 1 class for 20 boxes that has like 20 css properties set and you want 1 div to have a different border color it would be better to just give an id to that div instead of creating a whole new class. (if you get what I mean) Just add the #specialdiv{ border-color: #000; } instead of creating a whole new class with the same 19 properties and 1 that is different. Ofcourse you aren't force to use a id for this, you can also assign another extra class to this div. (Such as <div class="box special">) What is the difference in regards to speed and optimization, seo, etc...? This has a simply answer, if you optimize your css, it will result in a lower file size thus resulting in a faster load time which will improve your rankings. (Yes website speed/loading time does matter A LOT) A: first of all, you can use whatever makes sense to you, BUT if your a fan of semantic markup, and good separation of content and presentation, this may help you: use classes to identifier / group similar things, similar to classes in OOP. e.g. if you have list of products, and each list element contains data of exactly 1 product, you could give all this list elements the class .product. in contrast if this list of products is the only product list on this site, you could give the entire list the id #products, or if you need to be more specific #available_products, whatever makes sense semantically A: It's not that id's should apply to unique elements; it's that they must. This means that you can use them to identify particular elements on your page as being distinct from any other similar element. Besides being essential for many different javascript applications, an id allows you to tweak your classes for specific instances. Of course, if you never need to do any of the above, stick with classes. A: In an HTML page you give id to one element to give it its identity that should be unique so you can refer to that element just by calling it from its id. As for classes you can give give classes to multiple elements in an HTML file. It's like you make a group of elements that share the same properties for example in a class of students all students share some common properties but still have some unique properties that we can refer to by their roll no that is unique for all in the class. For example in a class of students all the common properties we specify in class. .class_students { grade:6; instructor:Ms XYZ; } And for properties that are unique for different students in that class we will use their roll no which is unique, like #roll_no6 { name: Micheal; age:10; } Similarly some elements can take more than one class, like <div class="rounded blue">. It means that this elements belong to more than one group in case of our school example a student may that belong to a specific class may also belong to say a sports team in that case it will share properties of both the groups. Now a final example to demonstrate every thing. <student id="rollno6" class="grade6 hockey-team"> </student> CSS .grade6 { instructor:Ms XYZ; no-students:30; major:Math; } .hockey-team { kit-color: blue; trainer: Mr ABC; } #rollno6 { name:Micheal; lives: somewhere; position:center-forward; major:Physics; } To give some property that you think should only be applied on rollno6 you can give it to that and rest of the elements of that class would remain same. The property of major in grade6 tells us that all students in that class majors in Math. But you over-ride that property for a specific student rollno6, now rollno6 majors in physics.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568184", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Zooming in android - keep image in view I know there are tons of threads on actually getting pinch zoom implemented - but I got this far already. I'm using SimpleScaleGestureListener to handle the pinching. I've managed to make sure you can't zoom out farther than to keep the image height the same as the screen size (so you're image height will always be at least the height of the available screen size). However, I'm looking for a way to automatically detect if the image is being panned outside of these boundaries. Just like the standard android way of displaying the image. So if I zoom in, and pan the image up, and then zoom out, I want it to detect when the bottom of the image reaches the bottom of the screen, and then 'pivot' of the zooming adjusts accordingly, thus never allowing "whitespace" above or below the image itself. Can anyone help me? For reference, here's my onScale and onDraw methods: public boolean onScale(ScaleGestureDetector detector){ float minScale = (float) ((float) SCREEN_SIZE.y / (float) DRAWABLE_SIZE.y); mScaleFactor *= detector.getScaleFactor(); mScaleFactor = Math.max(minScale, Math.min(mScaleFactor, 5.0f)); invalidate(); return true; } protected void onDraw(Canvas canvas) { canvas.save(); canvas.drawColor(Color.DKGRAY); canvas.translate(mPosX, mPosY); canvas.scale(mScaleFactor, mScaleFactor, getDrawable().getIntrinsicWidth() / 2, getDrawable().getIntrinsicHeight() / 2); this.getDrawable().draw(canvas); canvas.restore(); } A: You can use android.graphics.Matrix to transform drawn Bitmap. Matrix holds both scale and translation in it. You would simply apply the matrix to canvas: canvas.setMatrix You can easily compute fit-to-screen for desired rectangle: Matrix.setRectToRect where source is your image's (Bitmap's) real resolution rectangle with 0,0 in left/top and width/heght in right bottom. dst is target view's rectangle where Bitmap will be drawn. Then you may also solve your task - to know where borders of your image would be drawn. Matrix.mapRect will compute where your Bitmap's rectangle (as discussed previously) will appear on screen in screen's coordinates. Then you may simply where image's left side is drawn relative to screen's left side, same for top/right/bottom. I'm not going to give you code, just hints which way to go. I've recently coded image viewer with pinch-zoom, fit-to-screen, animated transitions, etc, and all was done using Matrix and manipulations of that. A: A simple solution is to use this widget http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/
{ "language": "en", "url": "https://stackoverflow.com/questions/7568185", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "6" }
Q: WPF Full screen focus issue? I've a bit of an issue with a WPF application I recently wrote, which I'm hoping is something trivial but I can't figure out an appropriate way to debug. My WPF application is a full screen application, that hides the mouse and is intended to be driven via the keyboard and as far as I'm aware is the only application running on the machine (it's placed in the Startup folder on a windows machine). The application itself is a clock/stopwatch style application for talks so recieves input at fairly infrequent intervals. The problem that has been found, is that after a period of inactivity the application stops responding to keyboard input and requires a click of the mouse to start working again, almost as though it has lost focus. I believe all the power settings are turned off on the machine, but I'd be grateful if anyone could think of anything else that might be causing the problem, or if there's a way I can ensure the application never loses focus. Any Ideas? A: You could trying wiring up an event handler in the FocusLost event to set Focus back on the Window
{ "language": "en", "url": "https://stackoverflow.com/questions/7568189", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Rails 3.1.0 server crashes when trying to delete Association model I have the following models: association.rb: class Association < ActiveRecord::Base has_and_belongs_to_many :users has_many :condominia, :dependent => :destroy accepts_nested_attributes_for :condominia, :allow_destroy => true end condominium.rb class Condominium < ActiveRecord::Base belongs_to :association has_many :owners, :dependent => :destroy accepts_nested_attributes_for :owners, :allow_destroy => true end owner.rb class Owner < ActiveRecord::Base belongs_to :condominium belongs_to :user end When I try to delete an Association model my rails server just crashes. Rails version 3.1.0 . And Ruby 1.9.2 p290 Any ideas why is this happening ? Thanks. UPDATE: If I try to remove the :dependent => :destroy it works. But because I need to create a batch of owners when a Condominium object is build I added: def new_owners return 0 end def new_owners=(int_num) int_num = int_num.to_i if int_num > 0 int_num.times do self.owners.create end end end The result is the same. Rails server crashing on save. A: Without seeing the stack trace... beware of using names like Association. In ActiveRecord there's already an Association class https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/association.rb
{ "language": "en", "url": "https://stackoverflow.com/questions/7568191", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: iPhone/ipad convert quartz2d line drawing to opengl This is a completely rookie question but I'm looking for some beginners guidance with opengl. I've got an app that uses quartz 2d to draw static lines on a view. This has been working fine but we are hitting some performance issues on ipad 1 and we don't feel like we can optimize it any more to try and speed it up. We're looking to rewrite the view to use opengl so we can improve the rendering performance, however we don't have any experience in opengl. I've been looking over the web and playing about but with little success. I've been using the example provided here (direct link) to get started, but I wondered if someone could write a smidgin of code to show us how to draw a set of lines into the view. A: My answer might be judged roughly here anyways I'll tell something from our experience. We were building an iPhone/iPad application which dealed with charts(Line/Column/Pie/...). I was asked to make a research on which technology to use. So finally we selected OpenGL ES as it is much more flexible and low level graphics engine. Finally, when we have met a lot of problems with OpenGL, when drawing these charts in UITableViews, created background threads and loots and lots of adjustments in order to get performance and exclude application crashes, which persisted. At the end we have realized that our charts are not drawn so smoothly as lots of other existing applications do. The architecture drawing frame by frame maybe can be effective, when there are not so much calculations, but in our case it was very slow, even if much of the vertices were precalculated. Finally we decided to pass to Quartz2D and actually we have won the war. All the charts where drawn by the iOS framework, which is native, and is kinda optimized to draw fast and smooth. So if you are trying to draw just a line and you think you will get better performance by passing from quartz to opengl es, my opinion is not to do it. Good luck.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568194", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: How to put a hyperlink in the middle of a paragraph using the slim templating language? How do you write the following in the slim templating language? <p>Join the <a href="">Google group</a> and let us know what you think, or what other features you’d like to see.</p> I tried the following: p ' Join the a href="" Google Group ' and let us know what you think, or what other features you’d like to see But that doesn't work because the words 'Group' and 'and' do not have whitespace between them. A: Apparently you can add extra spaces after the quote: p ' Join the a href="" Google Group ' and let us know what you think, or what other features you’d like to see A: You can do p This is a paragraph with a link #{link_to 'embedded', 'http://google.com'}. Rails tag helpers are just methods, so you can apply that logic to other methods inside views.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568198", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "16" }
Q: Visual Studio 2010 - Macro menu disabled? My VS2010 Macros menu has been disabled. Any ideas on how to get it back? A: Tools->Options->Environment->Add-in/Macros Security->Enable Allow macros to run A: Macros are not available in VS 2010 Express - which version are you using?
{ "language": "en", "url": "https://stackoverflow.com/questions/7568199", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Getting number from picture of vehicle number/license plate in android I have a app to develop which scans or take picture of vehicle number plate and get number from it. Has anyone done it before in android. How to approach this app in android. Thanks in advance. Regards, Anuj A: in order to develop such type of the app we need to use image scanner type of library like "IQ engine" which will give us the number when taken a snap from number plate. they have their apis for it. and for free we can have 1000request when registered. http://www.iqengines.com/ you will find the documentation for it also on company web.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568212", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: how to read constants from .h file in C# I want to read the constants in C#, these constants are defined in a .h file for C++. Can anyone tell me how to perform this in C# ? The C++ .h file looks like: #define MYSTRING1 "6.9.24 (32 bit)" #define MYSTRING2 "6.8.24 (32 bit)" I want to read this in C# ? A: You have two options: 1- Create a C++ wrapper code, which wraps these macros, export this code to a lib or dll and use it from C#. 2- read/parse the .h file from your code, and get the values at run-time. A: Here is a really simple answer that you can use on each line of your .h file to extract the string value. string GetConstVal(string line) { string[] lineParts = string.Split(line, ' '); if (lineParts[0] == "#define") { return lineParts[2]; } return null; } So any time it returns null, you don't have a constant. Now keep in mind that it is only getting the value of the constant, not the name, but you can easily modify the code to return that as well via out parameter, etc. If you want to represent other data types, like integers, etc. you will have to think of something clever since macros in C++ don't really count as type safe.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568224", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: PHP Remove url-"not allowed" characters from string I have read through all the questions regarding this, and would like to know if $str = preg_replace('/[^\00-\255]+/u', '', $str); is sufficient for my scenario. My Scenario When a user creates an account on my site, he enters his company's name. This can be anything including text with ' or " or even some other strange characters. When he creates an account, I need to create a folder on my server for him to access his account easier without using uniqids etc. So for example you create an account for "Peter's Pet Shop & Washing" - I would need to remove all spaces and characters that would not be allowed as a url-address. So at the end I need to have "peterspetshopwashing" This is so that you can access your account at "www.mydomain.com/peterspetshopwashing" A: I currently use this function I'm happy with function url($url) { $url = preg_replace('~[^\\pL0-9_]+~u', '-', $url); $url = trim($url, "-"); $url = iconv("utf-8", "us-ascii//TRANSLIT", $url); $url = strtolower($url); $url = preg_replace('~[^-a-z0-9_]+~', '', $url); return $url; } it replaces spaces and other odd characters with - so result will be peter-s-pet-shop-washing
{ "language": "en", "url": "https://stackoverflow.com/questions/7568231", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "4" }
Q: Rename multiple files by using BATCH, VBSCRIPT or BASH SHELL I have a numbers of files in folder A, what I need to do is to rename the filename to different pattern example: TTFILE-201109265757.dat to YTL.MSZSH1.ch1.201109265757_0001.0001.dat Where YTL, MSZSH1, ch1 is prefix then follow by the filename then _ then sequence number The filename pattern should be like this: YTL.MSZSH1.ch1.filename_SequenceNumber.SequenceNumber where SequenceNumber is 4 digit, reset to 0 after 9999. A: This little bash script should do the work :) Just call it with the files in question in the argument list or replace $@ with $(ls). #!/bin/bash counter=1 prefix="YTL.MSZSH1.ch1." for i in "$@" ; do file=$(basename "$i") counter=$(printf "%04d" $counter) mv "$i" "$prefix${file/TTFILE-/}_$counter.$counter.dat" counter=$(( $counter+1 )) done A: In a Windows environment, here is the script I would run: @echo off setlocal EnableDelayedExpansion pushd %1 set c=0 for /r %%i in ( %2-*.dat ) do ( set filename=%%~ni set digits=!filename:%2-=! ren "%%i" %3.%4.%5.!digits!_!c.!c!.dat set /a c+=1 if !c! equ 10000 set c=0 ) popd To run it: script.cmd "D:\Test Area" TTFILE YTL MSZSH1 ch1, where D:\Test Area is the directory containing the .dat files and the following arguments are the prefixes to use. If D:\Test Area contains sub-directories, the .dat files contained in them will also be renamed, but the sequence number will not be reset between two different sub-folders. A: this is the way in vbscript Dim objFSO,myFolder,objFolder,colFiles,objFile,newName,i,n set sh=createobject("wscript.shell") Set objFSO = CreateObject("Scripting.FileSystemObject") myFolder = "C:\users\eng\desktop\Scripts" '' here you can write the path for your folder Set objFolder = objFSO.GetFolder(myFolder) Set colFiles = objFolder.Files i=0:n="0000" For Each objFile in colFiles if Not instr(1,objFile.name,"YTL.MSZSH1.ch1.",1) > 0 then ''check if the file name change.this step to avoid change file name again after we rename newName=replace(objFile.Name,"TTFILE-","YTL.MSZSH1.ch1.") ''replace "TTFILE-" with "YTL.MSZSH1.ch1." in the file name newName=replace(newName,right(newName,4),"_"&n&"."&n&".dat") ''replace in modefiy newName ".dat" to "_0000.0000.dat" in the file name objFSO.getfile(objFile).name=newName ''change the file name with newName sh.popup objfile,1,"In_The_Name_Of_Allah" i=i+1 If i < 10 Then n= CStr("000" & i) ElseIf i < 100 Then n= CStr("00" & i) ElseIf i < 1000 Then n= CStr("0" & i) Else n= i End If End If Next wscript.quit
{ "language": "en", "url": "https://stackoverflow.com/questions/7568232", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: How to implement yearly and monthly repeating alarms? I want to set monthly and yearly alarm in my app.I did this for weekly. AlarmManager.INTERVAL_DAY helped me for that.But i could not find good way to implement monthly and yearly repeat. Searched so far: http://www.satyakomatineni.com/akc/display?url=displaynoteimpurl&ownerUserId=satya&reportId=3503 http://groups.google.com/group/android-developers/browse_thread/thread/9f946e40307073c4?pli=1 Is any other way available to do this? Any help appreciated. A: I solved the issue. In my app,multipal alarms were set with different repeating time intervals.So in my broadcast receiver for alarm,i re-scheduled the alarm based on for what time it was scheduled to be repeated.I used calendar object to add month and year accordinly and again set it for next alarm.i used code like this(for scheduling it for next month)- PendingIntent sender = PendingIntent.getBroadcast(context,Integer.parseInt(Long.toString(id)), intent1, 0); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(calendar.getTimeInMillis()); calendar.add(Calendar.SECOND, 30); AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); calendar.add(Calendar.MONTH, 1); am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender); A: To add to Laurent's response. To abstract from calculating recurrence manually I suggest to take a look at this RFC-2445 implementation. It works fine on Android and can save you a lot of pain. A: I think that, you have two inherent issues with this approach: * *AlarmManager will not accept large time intervals because the number of millis will overflow the argument *I do not think Alarms will survive reboots of your phone that will most certainly happen during such a long period of time. I advice that you store each alarm in a safe place and use a combination of AlarmManager and onBoot receivers to check if one of the alarms from your list must be fired this very day and just reschedule an alarm to wake you up tomorrow if none does. public class AlarmService extends Service { //compat to support older devices @Override public void onStart(Intent intent, int startId) { onStartCommand(intent, 0, startId); } @Override public int onStartCommand (Intent intent, int flags, int startId){ //your method to check if an alarm must be fired today checkForTodayAlarmsAndBehaveAppropriately(); //reschedule me to check again tomorrow Intent serviceIntent = new Intent(AlarmService.this,AlarmService.class); PendingIntent restartServiceIntent = PendingIntent.getService(AlarmService.this, 0, serviceIntent,0); AlarmManager alarms = (AlarmManager)getSystemService(ALARM_SERVICE); // cancel previous alarm alarms.cancel(restartServiceIntent); // schedule alarm for today + 1 day Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 1); // schedule the alarm alarms.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), restartServiceIntent); } } To start your service at boot time use this : import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class serviceAutoLauncher extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Intent serviceIntent = new Intent(context,AlarmService.class); context.startService(serviceIntent); } } Finally add this to your manifest to schedule your serviceAutoLauncher to be launched at each boot: <receiver android:name="serviceAutoLauncher"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"></action> <category android:name="android.intent.category.HOME"></category> </intent-filter> </receiver>
{ "language": "en", "url": "https://stackoverflow.com/questions/7568233", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "8" }
Q: Creating a UINavigationController inside custom class I have a modal view controller which is used in several places throughout my app and, in an attempt to apply to 'DRY' as much as possible, want to encapsulate the oft repeated task of creative a UINavigationController and dropping the view controller inside of it. Essentially I'm trying to replicate what Apple do with MFMailComposeViewController. You can simply init this object and present it modally and it handles the UINavigationController creation for you. I tried to emulate this by creating a sub class of UINavigationController (as MFMailComposeViewController does), then put a custom init method in that creates a view controller, calls [super initWithViewController:] and proposes itself as the VC. This fails because initWithViewController: in turn calls the init method and we enter a recursive loop. Is it possible to write a custom class that behaves the same way MFMailComposeViewController does and create my own init method that still allows UINavigationController to call the init method it expects? A: You should not try to push yourself on your own navigation stack. Your navigation controller subclass should create a separate view controller in its init method that will be the navigation stack's root view controller. The documentation for initWithRootViewController: says: This is a convenience method for initializing the receiver and pushing a root view controller onto the navigation stack. Every navigation stack must have at least one view controller to act as the root. So I suppose you can just call [super init] in your init method and then call [self pushViewController:myRootController] directly afterwards. You must also override initWithRootViewController: and make sure it calls your init method, ignoring its argument.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568243", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Multiplying a double by 100 in C# leads to unexpected answer Possible Duplicate: C# Maths gives wrong results! I have the following code in my C# windows application project: double test = 2.24 * 100; If I add a watch to test, one would expect the value to be 224, however it is actually: 224.00000000000003 can anyone explain where the extra .00000000000003 comes from? A: This is behavior by design, this is how floating point numbers work - the precision is actually limited. See Floating Point Numbers - Accuracy Problems A: It's a rounding error, not all numbers can be represented exactly in a double A: Multiplying a decimal by 100 in C# leads to unexpected answer Firstly, you haven't multiplied a decimal - you've multiplied an IEEE 754 floating-point number by 100. Because 2.24 does not exist as a double. However, if you do: decimal test = 2.24M * 100; it will behave as you expect. A: Your getting the result because 2.24 is not an exact number. There are a more significant figures beyond just the 2 you provided. I would try a multiplication by 100.00 that and then round the number using only 3 significant figures. I should make the clarification that you need to be using a decmial variable not a double. A double cannot represent an exact value. A: Many others have explained this already, far more eloquently than I could. Try these links on for size: Simple explanation Advanced explanation If that still leaves you scratching your head, just <insert favourite search engine> for "What every programmer should know about floating-point arithmetic"
{ "language": "en", "url": "https://stackoverflow.com/questions/7568245", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: How to do row-wise subtraction and replace a specific number with zero? Step 1: I have a simplified dataframe like this: df1 = data.frame (B=c(1,0,1), C=c(1,1,0) , D=c(1,0,1), E=c(1,1,0), F=c(0,0,1) , G=c(0,1,0), H=c(0,0,1), I=c(0,1,0)) B C D E F G H I 1 1 1 1 1 0 0 0 0 2 0 1 0 1 0 1 0 1 3 1 0 1 0 1 0 1 0 Step 2: I want to do row wise subtraction, i.e. (row1 - row2), (row1 - row3) and (row2 - row3) row1-row2 1 0 1 0 0 -1 0 -1 row1-row3 0 1 0 1 -1 0 -1 0 row2-row3 -1 1 -1 1 -1 1 -1 1 step 3: replace all -1 to 0 row1-row2 1 0 1 0 0 0 0 0 row1-row3 0 1 0 1 0 0 0 0 row2-row3 0 1 0 1 0 1 0 1 Could you mind to teach me how to do so? A: I like using the plyr library for things like this using the combn function to generate all possible pairs of rows/columns. require(plyr) combos <- combn(nrow(df1), 2) adply(combos, 2, function(x) { out <- data.frame(df1[x[1] , ] - df1[x[2] , ]) out[out == -1] <- 0 return(out) } ) Results in: X1 B C D E F G H I 1 1 1 0 1 0 0 0 0 0 2 2 0 1 0 1 0 0 0 0 3 3 0 1 0 1 0 1 0 1 If necessary, you can drop the first column, plyr spits that out automagically for you. Similar questions: * *Sum pairwise rows with R? *Chi Square Analysis using for loop in R *Compare one row to all other rows in a file using R A: For the record, I would do this: cmb <- combn(seq_len(nrow(df1)), 2) out <- df1[cmb[1,], ] - df1[cmb[2,], ] out[out < 0] <- 0 rownames(out) <- apply(cmb, 2, function(x) paste("row", x[1], "-row", x[2], sep = "")) This yields (the last line above is a bit of sugar, and may not be needed): > out B C D E F G H I row1-row2 1 0 1 0 0 0 0 0 row1-row3 0 1 0 1 0 0 0 0 row2-row3 0 1 0 1 0 1 0 1 Which is fully vectorised and exploits indices to extend/extract the elements of df1 required for the row-by-row operation. A: > df2 <- rbind(df1[1,]-df1[2,], df1[1,]-df1[3,], df1[2,]-df1[3,]) > df2 B C D E F G H I 1 1 0 1 0 0 -1 0 -1 2 0 1 0 1 -1 0 -1 0 21 -1 1 -1 1 -1 1 -1 1 > df2[df2==-1] <- 0 > df2 B C D E F G H I 1 1 0 1 0 0 0 0 0 2 0 1 0 1 0 0 0 0 21 0 1 0 1 0 1 0 1 If you'd like to change the name of the rows to those in your example: > rownames(df2) <- c('row1-row2', 'row1-row3', 'row2-row3') > df2 B C D E F G H I row1-row2 1 0 1 0 0 0 0 0 row1-row3 0 1 0 1 0 0 0 0 row2-row3 0 1 0 1 0 1 0 1 Finally, if the number of rows is not known ahead of time, the following should do the trick: df1 = data.frame (B=c(1,0,1), C=c(1,1,0), D=c(1,0,1), E=c(1,1,0), F=c(0,0,1), G=c(0,1,0), H=c(0,0,1), I=c(0,1,0)) n <- length(df1[,1]) ret <- data.frame() for (i in 1:(n-1)) { for (j in (i+1):n) { diff <- df1[i,] - df1[j,] rownames(diff) <- paste('row', i, '-row', j, sep='') ret <- rbind(ret, diff) } } ret[ret==-1] <- 0 print(ret)
{ "language": "en", "url": "https://stackoverflow.com/questions/7568246", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Issue while populating array in COBOL I am getting very strange scenario. I have one array defined in my COBOL pgm. 05 A-TABLE. 10 A-TABLE-LIST OCCURS 10 TIMES INDEXED BY A-IDX. 15 FILLER PIC X(7) VALUE '<TEST>'. 15 A-LIST-VALUE PIC X(30). 15 FILLER PIC X(8) VALUE '</TEST>'. I am setting A-IDX=1 and moving 'XYZ' to A-LIST-VALUE(A-IDX). While displaying A-TABLE, it is showing as XYZ------------------------------ and all spaces... :( I am not getting what is the issue here? Can anyone help me to resolve this? Regards, Saisha. A: You cannot set values for a table that way. One way to set values in a table is to use a REDEFINES and a separate data area. 05 A-TABLE-X. 10 FILLER PIC X(45) VALUE '<TEST> </TEST>'. 10 FILLER PIC X(45) VALUE '<TEST> </TEST>'. 10 FILLER PIC X(45) VALUE '<TEST> </TEST>'. 10 FILLER PIC X(45) VALUE '<TEST> </TEST>'. 10 FILLER PIC X(45) VALUE '<TEST> </TEST>'. 10 FILLER PIC X(45) VALUE '<TEST> </TEST>'. 10 FILLER PIC X(45) VALUE '<TEST> </TEST>'. 10 FILLER PIC X(45) VALUE '<TEST> </TEST>'. 10 FILLER PIC X(45) VALUE '<TEST> </TEST>'. 10 FILLER PIC X(45) VALUE '<TEST> </TEST>'. 05 A-TABLE REDEFINES A-TABLE-X. 10 A-TABLE-LIST OCCURS 10 TIMES INDEXED BY A-IDX. 15 FILLER PIC X(7). 15 A-LIST-VALUE PIC X(30). 15 FILLER PIC X(8). That is pretty cumbersome. Another method is to MOVE the data in at runtime in an initialisation paragraph. 05 A-TABLE REDEFINES A-TABLE-X. 10 A-TABLE-LIST OCCURS 10 TIMES INDEXED BY A-IDX. 15 A-LIST-A PIC X(7). 15 A-LIST-VALUE PIC X(30). 15 A-LIST-B PIC X(8). PERFORM VARYING A-IDX FROM 1 BY 1 UNTIL A-IDX > 1 MOVE '<TEST> TO A-LIST-A(A-IDX) MOVE SPACES TO A-LIST-VALUE(A-IDX) MOVE '</TEST> TO A-LIST-B(A-IDX) END-PERFORM I didn't try compiling any of these, this is just freehand. As a side note, if you are using Enterprise COBOL version 3.2 or higher and you are trying to create XML in COBOL, there exists an XML GENERATE statement. A: To my understanding, your question is why "XYZ<27 spaces>" is being displayed when only "XYZ" was moved. If so, you need to initialize before moving and trim the spaces before displaying or moving into another variable. If your problem is not yet solved, describe much otherwise let us know how it was resolved.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568247", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: How to know DB Size when FILEGROWTH applied? MS SQL 2008. I have a DataBase which use FILEGROWTH (this property specifies the growth increment of the DB.). As soon as my DataBase reach the size of 40MB DB it will be expanded +20 MB (FILEGROWTH) till reach the MAXSIZE... Correct? If it is Correct, how can I get the Current Size for all the Rows in any Tables in my DB... I would like to know if is possible have the Size for the Actual Content an not Db SIZE+FILEGROWTH. Hope guys I can have a clear explanation, I'm pretty new with DB. Thanks for your help! Here the code I use. CREATE DataBase MyDB ON PRIMARY ( NAME = 'MyDB', FILENAME = 'C:\Server\Data\DataBase\MyDB.mdf', -- Location DataBase SIZE = 40 MB, MAXSIZE = 960 MB, FILEGROWTH = 20 MB ) LOG ON ( NAME = 'MyDB', FILENAME = 'C:\Server\Data\DataBase\MyDB.ldf', -- Location Log files SIZE = 20 MB, MAXSIZE = 960 MB, FILEGROWTH = 20 MB ) WITH DB_CHAINING OFF GO A: The quick way is to run sp_spaceused with no parameters If you look at the code of this proc, you should see queries based on sys views etc of you want something slightly cleverer Edit: I did this before: How do I find out what tables have data in a file in SQL Server?
{ "language": "en", "url": "https://stackoverflow.com/questions/7568251", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Nib's IBOutlets are not connected (nil) I have a Custom class which is supposed to load a window from a nib file. When I load the nib file everything looks fine except the IBOutlets are not connected i.e. nil. IBActions work fine and when they are called the IBOutlets are not nil anymore. The class is added to the nib in the IB as an object and obviously everything wired up. It's the file's Owner and delegate When it loads the nib, the window appears only if its "visible at launch" is set. It doesn't matter where I load the nib and try to access IBOutlets immediately or seconds later. It must be something very trivial... UPDATE2: I UPLOADED AN EVEN SIMPLER TRIAL PROJECT: Trial Project2 Expected behaviour: Window2 title changes to "Title has Changed x times" when loads. It only starts working once the button is pressed i.e. IBOutlets are not nil anymore. A: The big change was subclassing NSWindowController to create MyClass. This way, you only attempt to manipulate the close button after the window has loaded. Your code was small enough that I thought it best to simply post the changes: trialProjectAppDelegate.m #import "trialProjectAppDelegate.h" @implementation trialProjectAppDelegate @synthesize window; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { myclass = [[MyClass alloc] init]; // Note that I'm forcing the window to load here. (void) [myclass window]; } @end MyClass.h #import <Cocoa/Cocoa.h> @interface MyClass : NSWindowController { IBOutlet NSButton *dismissButton; } - (IBAction)closeNaggingWindow:(id)sender; - (void)disableDismissButton; @end MyClass.m #import "MyClass.h" @implementation MyClass - (id)init { if ((self = [super initWithWindowNibName:@"Window"]) != nil) { } return self; } - (void)disableDismissButton { [dismissButton setEnabled:NO]; [dismissButton setTitle:@"Closing enabled in 5 sec"]; [self performSelector:@selector(enableDismissButton:) withObject:nil afterDelay:5]; } - (IBAction)enableDismissButton:(id)sender { [dismissButton setEnabled:YES]; [dismissButton setTitle:@"Close"]; } - (IBAction)closeNaggingWindow:(id)sender { [[self window] close]; [self autorelease]; } - (void)awakeFromNib { [self disableDismissButton]; } @end Finally, in your Window.xib file, discard the naggingWindow outlet and connect your window to the window outlet that NSWindowController provides. A: I haven't worked with any of the OS X interface classes, so there may be some aspect of this that is not 100% precisely accurate, but basically what is happening is this: You've wired your nib's NSWindow object to a MyClass object, which is also in your nib. So when you load that nib, here's what's happening: * *A MyClass instance is created *An NSWindow instance is created, with several subviews. The NSWindow and the button are attached to the new MyClass instance. *Nothing is wired to the File's Owner pseudo-object (the MyClass instance you created in your app delegate) Then -changeWindowTitle is called on your original MyClass instance, which has none of its outlets wired. The solution is simple: remove the MyClass object from your nib file. Select the "File's Owner", and in the Identity Inspector (third icon from the left in the Utility pane) set "Class" to "MyClass". Now reconnect your outlets to the File's Owner object, which is your original MyClass instance. You should now see the behavior you expected. As an aside, the right place to do things "as soon as the nib is loaded", like setting properties on your fresh IBOutlet objects, is in the method -windowDidLoad.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568255", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: MBProgressHUD naming convention clarification I came across a very nice API MBProgressHUD, however when I was reading the documentation in the header MBProgressHUD.h I got confused since the doc says that - (id)initWithWindow:(UIWindow *)window; is a convenience constructor. According to Apple docs regarding memory management, convenience constructors should not be prefixed with any of the following: init, alloc, copy. Can anyone clarifies whether I'm missing something here? /*** A convenience constructor that initializes the HUD with the window's bounds. * Calls the designated constructor with * window.bounds as the parameter. * @param window The window instance that will provide the bounds for the HUD. * Should probably be the same instance as * the HUD's superview (i.e., the window that the HUD will be added to). */ - (id)initWithWindow:(UIWindow *)window; A: I believe the problem is with the comment. The convenience constructors return autoreleased objects, but this - (id)initWithWindow:(UIWindow *)window; does not. Thus, the name of the constructor is fine, but the comment should be updated. edit: I always found the MBProgressHUD a bit complicated to my taste until i came across this nice replacement on github.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568256", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: file (not in memory) based JDBC driver for CSV files Is there a open source file based (NOT in-memory based) JDBC driver for CSV files? My CSV are dynamically generated from the UI according to the user selections and each user will have a different CSV file. I'm doing this to reduce database hits, since the information is contained in the CSV file. I only need to perform SELECT operations. HSQLDB allows for indexed searches if we specify an index, but I won't be able to provide an unique column that can be used as an index, hence it does SQL operations in memory. Edit: I've tried CSVJDBC but that doesn't support simple operations like order by and group by. It is still unclear whether it reads from file or loads into memory. I've tried xlSQL, but that again relies on HSQLDB and only works with Excel and not CSV. Plus its not in development or support anymore. H2, but that only reads CSV. Doesn't support SQL. A: You can solve this problem using the H2 database. The following groovy script demonstrates: * *Loading data into the database *Running a "GROUP BY" and "ORDER BY" sql query Note: H2 supports in-memory databases, so you have the choice of persisting the data or not. // Create the database def sql = Sql.newInstance("jdbc:h2:db/csv", "user", "pass", "org.h2.Driver") // Load CSV file sql.execute("CREATE TABLE data (id INT PRIMARY KEY, message VARCHAR(255), score INT) AS SELECT * FROM CSVREAD('data.csv')") // Print results def result = sql.firstRow("SELECT message, score, count(*) FROM data GROUP BY message, score ORDER BY score") assert result[0] == "hello world" assert result[1] == 0 assert result[2] == 5 // Cleanup sql.close() Sample CSV data: 0,hello world,0 1,hello world,1 2,hello world,0 3,hello world,1 4,hello world,0 5,hello world,1 6,hello world,0 7,hello world,1 8,hello world,0 9,hello world,1 10,hello world,0 A: If you check the sourceforge project csvjdbc please report your expierences. the documentation says it is useful for importing CSV files. Project page A: This was discussed on Superuser https://superuser.com/questions/7169/querying-a-csv-file. You can use the Text Tables feature of hsqldb: http://hsqldb.org/doc/2.0/guide/texttables-chapt.html csvsql/gcsvsql are also possible solutions (but there is no JDBC driver, you will have to run a command line program for your query). sqlite is another solution but you have to import the CSV file into a database before you can query it. Alternatively, there is commercial software such as http://www.csv-jdbc.com/ which will do what you want. A: To do anything with a file you have to load it into memory at some point. What you could do is just open the file and read it line by line, discarding the previous line as you read in a new one. Only downside to this approach is its linearity. Have you thought about using something like memcache on a server where you use Key-Value stores in memory you can query instead of dumping to a CSV file? A: You can use either specialized JDBC driver, like CsvJdbc (http://csvjdbc.sourceforge.net) or you may chose to configure a database engine such as mySQL to treat your CSV as a table and then manipulate your CSV through standard JDBC driver. The trade-off here - available SQL features vs performance. * *Direct access to CSV via CsvJdbc (or similar) will allow you very quick operations on big data volumes, but without capabilities to sort or group records using SQL commands ; *mySQL CSV engine can provide rich set of SQL features, but with the cost of performance. So if the size of your table is relatively small - go with mySQL. However if you need to process big files (> 100Mb) without need for grouping or sorting - go with CsvJdbc. If you need both - handle very bif files and be able to manipulate them using SQL, then optimal course of action - to load the CSV into normal database table (e.g. mySQL) first and then handle the data as usual SQL table.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568260", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Creating Bucket using LearnBoost/Knox working on project where I have to use Amazon S3 services and thus using LearnBoost/knox...want to know how to create a bucket using the knox client. Thanks in advance. A: I was looking for the answer to this question, and found this unanswered. I ended up with the following solution: https://gist.github.com/1508111
{ "language": "en", "url": "https://stackoverflow.com/questions/7568261", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Proper way to implement move semantics for class with std::vector of std::vector member I have a class that has a member which is a vector of vectors. I would like to write a constructor for this class that takes an r-value reference to a single vector as an argument, and moves it into the member vector as a single element vector of the vector argument. So far I have: class AClass { std::vector<std::vector<int>> member; public: AClass(std::vector<int> &&vec) : member(1) { member[0] = std::vector<int>(std::move(vec)); } } This seems to work correctly, but I am not sure if the std::move around vec is necessary. Or if the std::vector would have taken care of much of this for me had I written it a little differently. A: It should be shorter to write: member[0] = std::move(vec); in order to invoke vector<T,Allocator>& operator=(vector<T,Allocator>&& x); As far as I know, explicit moving is necessary, because vec is not a rvalue (it is a named variable and can be used on the left side of operator=). A: The way of doing this now is to just pass the value into the constructor by value, then moving it to where you want. So AClass(std::vector<int> vec) { member.emplace_back(std::move(vec)); } You don't need to care about whether the value is copy-constructed in, or if it was able to be moved into the constructor because it was an rvalue, or whatever. You just request, in the function definition, that you get your own copy of the item, and the language will give it to you as best it can.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568263", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Storing database in NSCachesDirectory I want to keep my database in NSCachesDirectory. Will it gets deleted without i am doing it programmatically? Is there any possibility to happen this? Please let me know. Thank you. A: Yes. The Caches directory will not be backed up and will probably be empty after a restore of the device. Also, the OS is free to delete items from the Caches directory at any time (e.g. if it needs disk space).
{ "language": "en", "url": "https://stackoverflow.com/questions/7568264", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: How to write tests for javascript with variable responses to different viewport width sizes I have javascript code that displays a different set of UI for different viewport widths - and I'd like to put in some automated tests for them to help in regression, but my question is, how do i do this if I'm using qunit or Jasmine? in fact, any other methods for that matter? more specifically, how do i set the viewport widths (or emulate them) when doing my tests?
{ "language": "en", "url": "https://stackoverflow.com/questions/7568271", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Is there a jquery work that can make css shadow-roundedcorners works on IE6 and Up I need to make a cross browser css, to keep my websites look same in each browser. Is there any Cross Browser CSS sheet, which can be also called as "css hack" to make shadows and rounded corners shown as same in all browsers and is it posible to use these two at the same time in IE6 or higher. Ive found some css sheets that does these seperately but not together. so if there is a way to make these two different css ability work together in IE6 or higher, i would like to know. A: Try using CSS3PIE available here: http://css3pie.com/about/ From the site: PIE stands for Progressive Internet Explorer. It is an IE attached behavior which, when applied to an element, allows IE to recognize and display a number of CSS3 properties. Consider, if you will, the following CSS: #myElement { background: #EEE; padding: 2em; -moz-border-radius: 1em; -webkit-border-radius: 1em; border-radius: 1em; } This results in a box with nicely rounded corners in any of today's modern browsers, except of course for IE 6, 7, or 8, which all display a square box. However, add the following single rule to that CSS: #myElement { ... behavior: url(PIE.htc); } Now the exact same rounded corners appear in IE! That's all there is to it. No, really, I mean it. Slightly slows load time, but works great. Also allows things like drop shadows and gradients. A: CSS3Pie is what you need. Make sure you read the documentation first, though it's very easy to get working. A: You can use filter for shadow in ie filter: progid:DXImageTransform.Microsoft.Shadow(color='#000000', Direction=135, Strength=10); /* IE */ also u can use this JS for curve http://blue-anvil.com/jquerycurvycorners/test.html#fragment-2
{ "language": "en", "url": "https://stackoverflow.com/questions/7568273", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: How to set Time Range in UIDatePickerModeTime Hello friends I am trying to set the Time Range Of the DatePicker in UIDatePickerModeTime,as we have MaxDate and MinDate,whether its possible to set Mintime and Maxtime selected by user,, Suppose I want the user to select the time between 16:00 to 19:00 only for each day then how can I do it,, Thanks&Regards Ranjit Hello friends I tried the below code to set the start time range and its working fine... NSDate *todaysDate =[NSDate date]; NSDateComponents *comps = [gregorian components:NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit |NSSecondCalendarUnit fromDate:todaysDate]; [comps setHour:16]; [comps setMinute:00]; [comps setSecond:00]; NSDate *startDate = [gregorian dateFromComponents:comps]; NSDateComponents *startcomps = [[NSDateComponents alloc] init]; [startcomps setDay:startDay-weekday]; self.minDate = [gregorian dateByAddingComponents:startcomps toDate:startDate options:0]; but when I apply the same code to set the end time range its not working....can any body please help me out in this matter Regards Ranjit A: Ok, I solved your problem (using IB, but I think you could do that programmatically too). Using IB: * *Select your Date picker. *Open Utilities -> Attribute inspector *In block Constraints : *Select Minimum Date and set its value 01/01/1970 16:00:00 *Select Maximum Date and set its value 01/01/1970 19:00:00 *Set value Date to 01/01/1970 16:00:00
{ "language": "en", "url": "https://stackoverflow.com/questions/7568284", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Looking for a PInvoke style way to customise the SaveFileDialog using System.Windows.Forms.CommonDialog I would like to write an implementation of System.Windows.Forms.SaveFileDialog extending from System.Windows.Forms.CommonDialog and using the bool RunDialog(IntPtr hwndOwner) method to register a custimisation hook. I used George Mihaescu's 2007 article on extending the print dialog for a similar use-case where I needed to add controls to the print dialog as a basis for printing but extended the example somewhat, I effectively want to use the same approach to saving. I can't seem to find much information on the structures and extensions available, in particular I can't find the equivelant of the PRINTDLG structure. The closest I've found is the MSDN article on the Common Item Dialog A: Here's an article detailing how to extend the common file dialogs, save in particular, through Win32 API. I've basically followed this example in my extended open and save dialog implementations. I've simply added an additional text box below the file type combo box. My implementation is closed source so I cannot share it. However, I've have no issues running this code on Win2k through Win7 (x86 or x64). http://www.codeproject.com/KB/cs/getsavefilename.aspx
{ "language": "en", "url": "https://stackoverflow.com/questions/7568288", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Windows service blocking TCP traffic I have a strange issue. Have a windows service running on Windows Server 2008 that receives files over TCP and saves to disk. Initially service was running as Local System account. It worked ok for 7 days and stopped receiving. From the sender side connection succeeds but send fails. The service blocks forever on receive and connection times out. I changed the user account to "Network Service" and it started working again for 7 days and stopped. I then changed it to run as administrator. It ran for 4 days and stopped again. Now whatever I try it does not work. Rebuilt the code re-installed the service but same issue. Does anybody ever face such an issue? is it a virus or something? Is windows blocking it? any suggestions will be greatly appreciated. Note: If I run it as a windows form application it just works fine. Also disabled the firewall but it did not help. While debugging the code I never see any issues. Because it works as a forms app and also worked perfectly as a service for 15-20 days now. A: I figured out the problem. When the issue started happening I ran the Filemon utility and figured that the service was failing to access a temp file created using GetTempFileName(). This seems to be a known issue with Windows server 2008R2 and happens randomly. Here is a solution/Hotfix from Microsoft: http://support.microsoft.com/kb/982613
{ "language": "en", "url": "https://stackoverflow.com/questions/7568291", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Unloading COM Objects C# Possible Duplicate: How to properly clean up Excel interop objects in C# I am using EXCEL INTEROP for reading excel files in my .NET application. However I see that after am done with it, I still see the EXCEL.EXE in Windows Task Manager. The code is as follows: ApplicationClass excel = new ApplicationClass(); Workbooks workBooks = excel.Workbooks; Workbook workBook = workBooks.Open(fileName,0,true,5,"","",true,XLPlatform.xlWindows,"\t",false,false,0,true,1,0); foreach (Name name in workBook.Names) { try { // =#REF!#REF! indicates that the named range refers to nothing. Ignore these.. if (name.Value != "=#REF!#REF!") { if (!retNamedRanges.ContainsKey(name.Name)) { string keyName = name.Name; object value = name.RefersToRange.get_Value(missing); retNamedRanges.Add(keyName, value); } } } catch (Exception ex) { } } if(workBook!=null) { workBook.Close(false,missing,missing); } if(workBook!=null) { workBooks.Close(); } System.Runtime.InteropServices.Marshal.ReleaseComObject(workBook); System.Runtime.InteropServices.Marshal.ReleaseComObject(workBooks); workBook = null; workBooks = null; excel.Application.Quit(); excel.Quit(); excel = null; I have tried to do all possible things to clean up, but still it does not go. There are multiple EXCEL files that I need to read. Typically after my application executes I see multiple instances of EXCEL.EXE. Is there anything else am missing with the clean up? Many thanks in advance A: "Some process specific to my application I am doing..." Actually, this is most likely where the problem lies. As in the referenced duplicate, if you reference a property of the ApplicationClass then you'll need to make sure you dereference that property before the garbage collector will tidy up and remove Excel. So, for instance, copy any data you need to string, int, etc. (or your own internal types based on these base types). A: Try using Marshal.*Final*ReleaseComObject instead of ReleaseComObject. Also call it on your "ApplicationClass excel" instance.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568295", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Find free rooms for today using mySQL If in a mysql table RESERVATIONS there are RPOM_NUMBER, DATE_ARRIVAL and DATE_DEPARTED How do I find all the rooms that are available today? A: Select RPOM_NUMBER where current_date() not between DATE_ARRIVAL and DATE_DEPARTED; This might be help you. If you can give details table structure with some data then it will be help full to give proper answer. A: Checking the rooms that are available at particular moment of time: select RPOM_NUMBER from RESERVATIONS r group by RPOM_NUMBER having not exists ( select * from RESERVATIONS where RPOM_NUMBER = r.RPOM_NUMBER and now() between DATE_ARRIVAL and DATE_DEPARTED ) Checking the rooms that are available at a given period of time (from start_time to end_time): select RPOM_NUMBER from RESERVATIONS r group by RPOM_NUMBER having not exists ( select * from RESERVATIONS where RPOM_NUMBER = r.RPOM_NUMBER and {start_time} <= DATE_DEPARTED and {end_time} >= DATE_ARRIVAL ) A: SELECT RPOM_NUMBER FROM RESERVATIONS WHERE (CURRENT_DATE() < DATE_ARRIVAL) OR (CURRENT_DATE() > DATE_DEPARTED) EDIT: Answer to comments regarding insert into table You can put the query above in a subquery and then do INSERT with INNER JOIN on the returned by subquery data set. ! Not tested a query below, just to show an idea: INSERT INTO RESERVATIONS SELECT available.RPOM_NUMBER, CURRENT_DATE(), CURRENT_DATE() FROM RESERVATIONS r INNER JOIN (SELECT RPOM_NUMBER FROM RESERVATIONS WHERE (CURRENT_DATE() < DATE_ARRIVAL) OR (CURRENT_DATE() > DATE_DEPARTED) ) available ON available.RPOM_NUMBER = r.RPOM_NUMBER A: SELECT RPOM_NUMBER FROM RESERVATIONS WHERE (DATE(NOW()) NOT BETWEEN DATE_ARRIVAL AND DATE_DEPARTED) A: You need another table, maybe called rooms, that holds that info. A row in that table might have columns like room_number, is_occupied, is_reserved, reservation_start_time, reserved_for_how_long, reserved_by_whom. Stuff that refers only to the room. As you have your reservations (it could be a good, useful table, btw) it's difficult for you to tell whether or not a room is empty or occupied, partly because there's no column for whether or not the guest actually showed up and took the room. You might also consider a table called guests that holds all the info for, well, each guest. A: You really need a ROOMS table to make this database remotely nice to work with - also with a RPOM_NUMBER (Which I am presuming indentifies a single room). If you have such a table then this query will give RPOM_NUMBERS free now SELECT RPOM_NUMBER FROM ROOMS WHERE RPOM_NUMBER NOT IN (SELECT DISTINCT RPOM_NUMBER FROM RESERVATIONS WHERE DATE_ARRIVAL < NOW() AND DATE_DEPARTED > NOW()) And this will INSERT a row into RESERVATIONS INSERT INTO RESERVATIONS (RPOM_NUMBER,DATE_ARRIVAL,DATE_DEPARTED) VALUES (x, y, z) (where x,y, and z are the RPOM_NUMBER, DATE_ARRIVAL AND DATE_DEPARTED respectively) This makes no allowance for the specific time. You will have to think about when you want a room to show as free. If it's 1 minute since the departure time, is it free? Or is it being cleaned? This also assumes that a reservation will have both an arrival and departure date when inserted. How do you deal with guest that are on an open-ended stay? This SQL isn't tested and not sure if it will work in mySQL - but it will be something very similar.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568296", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Exporting an array to CSV I need a module for Drupal 7 that can export CSV when given an array of values. A: You don't need Drupal for this, you can use the PHP fputcsv function. Have a look at that page, there are clear examples of how to save an array as a CSV file. Hope that helps A: Sorry for the late response but I just ran across this while searching for my own solution. This is what I ended up with: // send response headers to the browser drupal_add_http_header('Content-Type', 'text/csv'); drupal_add_http_header('Content-Disposition', 'attachment;filename=csvfile.csv'); $fp = fopen('php://output', 'w'); foreach($csv_array as $line){ fputcsv($fp, $line); } fclose($fp); drupal_exit(); That should be in a page callback and it will result in a file download of a csv file with the array contents. Hope this helps.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568300", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Error: "can only concatenate tuple (not "list") to tuple" in urls, Django I've got an error in my urls: TypeError at / can only concatenate tuple (not "list") to tuple Can't get what I did wrong. Where is the list in there? from django.conf import settings from django.conf.urls.defaults import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = ('googleapi.apiapp.views', (r'^$', 'first_view'), ) urlpatterns += patterns('', # Uncomment the admin/doc line below to enable admin documentation: (r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: (r'^admin/', include(admin.site.urls)), # Static files url. (r'^site_media/media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), (r'^site_media/static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}), ) Django Config Traceback: File "/home/i159/Env/googleapi/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response 101. request.path_info) File "/home/i159/Env/googleapi/lib/python2.6/site-packages/django/core/urlresolvers.py" in resolve 250. for pattern in self.url_patterns: File "/home/i159/Env/googleapi/lib/python2.6/site-packages/django/core/urlresolvers.py" in _get_url_patterns 279. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/home/i159/Env/googleapi/lib/python2.6/site-packages/django/core/urlresolvers.py" in _get_urlconf_module 274. self._urlconf_module = import_module(self.urlconf_name) File "/home/i159/Env/googleapi/lib/python2.6/site-packages/django/utils/importlib.py" in import_module 35. __import__(name) File "/home/i159/workspace/apiroot/googleapi/../googleapi/urls.py" in <module> 24. {'document_root': settings.STATIC_ROOT}), Exception Type: TypeError at / Exception Value: can only concatenate tuple (not "list") to tuple A: The error pretty much describes your problem. You're missing a call to patterns() in your first definition of urlpatterns. A: TypeError at / can only concatenate tuple (not "list") to tuple It means exactly what it says. It is complaining about urlpatterns += patterns(...). The += attempts to concatenate (chain together) two things. urlpatterns is a tuple. The value returned by patterns(...) is a list. You can't mix these for concatenation. To fix this, you must first decide whether you want a tuple or a list as the result (concatenating two tuples gives a tuple, and concatenating two lists gives a list), and then fix one side or the other accordingly. In your case, you apparently want a list. The value you assign to urlpatterns first looks like a set of arguments for patterns(). The simple explanation, as @patrys points out, is that you meant (and forgot) to call the function here. That would give you a list, to which you could then append (concatenate) the list from the second call. Note that you can also do it all in one go: urlpatterns = patterns(...) + patterns(...). Where is the list in there? The result of the patterns() calls, as explained above (and also by the documentation, presumably - I don't know anything about django, I'm just good at debugging.)
{ "language": "en", "url": "https://stackoverflow.com/questions/7568304", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: how to type in local language in text box? now we are able type in English in a text box in a web based application and than it can be converted to desired language but my problem is i want to type the text in my local language and convert them to another. what should i do now? help me please pleas give me solution for the above problem A: The input language on a web page is set to the browser locale, if I am not mistaken. This is not a java question. A: If you want to convert between languages you need to either: * *hire translators (who understand both languages, and are preferably native speakers of the target language) to do it manually (expensive, slow) *use translation software (cheap, very low quality) such as the Google Translate API.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568306", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "-1" }
Q: iOPhone: AdMob just blue banner with compass I'm trying to ingegrate AdMob in one of my free iPhone Apps. In my last Apps the integration seems to work fine and I got real banners from AdMob. But at the moment I'm getting only a blue banner with a small compass icon. Looks like a test banner. Is that okay? I deactivated the test-mode, but the banner is still the naked blue one. Thank you for your help :-) A: Assuming you didn't create an empty house ad, this sounds like a bad creative being shown, not a problem on your end. Hopefully you will see a different ad if you continue testing.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568307", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Check if Twisted Server launched with twistd was started successfully I need a reliable way to check if a Twisted-based server, started via twistd (and a TAC-file), was started successfully. It may fail because some network options are setup wrong. Since I cannot access the twistd log (as it is logged to /dev/null, because I don't need the log-clutter twistd produces), I need to find out if the Server was started successfully within a launch-script which wraps the twistd-call. The launch-script is a Bash script like this: #!/usr/bin/bash twistd \ --pidfile "myservice.pid" \ --logfile "/dev/null" \ --python \ myservice.tac All I found on the net are some hacks using ps or stuff like that. But I don't like an approach like that, because I think it's not reliable. So I'm thinking about if there is a way to access the internals of Twisted, and get all currently running Twisted applications? That way I could query the currently running apps for the the name of my Twisted application (as I named it in the TAC-file) to start. I'm also thinking about not using the twistd executable but implementing a Python-based launch script which includes the twistd-content, like the answer to this question provides, but I don't know if that helps me in getting the status of the server to run. So my question is just: is there a reliable not-ugly way to tell if a Twisted Server started with twistd was started successfully, when twistd-logging is disabled? A: You're explicitly specifying a PID file. twistd will write its PID into that file. You can check the system to see if there is a process with that PID. You could also re-enable logging with a custom log observer which only logs your startup event and discards all other log messages. Then you can watch the log for the startup event. Another possibility is to add another server to your application which exposes the internals you mentioned. Then try connecting to that server and looking around to see what you wanted to see (just the fact that the server is running seems like a good indication that the process started up properly, though). If you make it a manhole server then you get the ability to evaluate arbitrary Python code, which lets you inspect any state in the process you want. You could also just have your application code write out an extra state file that explicitly indicates successful startup. Make sure you delete it before starting the application and you'll have a fine indicator of success vs failure.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568309", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: Exception while re-deploying my webapp on tomcat 6 All, I am having problems redeploying my java webapp packaged as war using maven 3.0 (mvn package) on tomcat 6.0 However if I restart my server completely i donot get this exception and the whole app runs perfectly fine. Here is the details of catalina log: WARNING: Error while removing context [] java.lang.NoClassDefFoundError: org/apache/struts2/util/ObjectFactoryDestroyable at org.apache.struts2.dispatcher.Dispatcher.cleanup(Dispatcher.java:263) at org.apache.struts2.dispatcher.FilterDispatcher.destroy(FilterDispatcher.java:238) at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:332) at org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:3731) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4493) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:924) at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1035) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(Containe rBase.java:1601) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.ClassNotFoundException: org.apache.struts2.util.ObjectFactoryDestroyable at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 15 more Pls help..!
{ "language": "en", "url": "https://stackoverflow.com/questions/7568313", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: jquery animate help needed I am using animate in jQuery. I am getting problem to execute animate. It executes after test function I want to run this before test function $('.next').live('click',function() { $('.ac_bgimage').animate({ left:"-100em" }, 15000 ); test(); }); but now when i click on next class my test function execute first , i want to execute later after execution of animate. A: try to put it into callback function $('.next').live('click',function() { $('.ac_bgimage').animate({ left:"-100em" }, 15000 , function(){ test(); }); }); A: This should work: $('.next').live('click',function() { $('.ac_bgimage').animate({ left:"-100em" }, 15000, function() { test();} ); });
{ "language": "en", "url": "https://stackoverflow.com/questions/7568314", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: java multi-line string behave strange in rational function test I just wonder why it act this way. In IBM RFT 6.x version integrated with a eclipse IDE . I run the follow lines to get a text output from another program. String Text = ""; String Text_Value = ""; Text = (String) outputText().getProperty(".value"); Text_Value = (String) outputText().getProperty(".value"); the original output captured by outputText().getProperty(".value") is 2011-09-27 19:11:05.996 [Process ID:0x00000000] show cpup sc11 ************************************************************ CPU0 Usage : 3.2% CPU1 Usage : 6.29% Smooth CPU Usage : 4.65% Real CPU Usage : 4.65% ------------------------------------------------------------ CPU Usage Sample Rate : 2(s) CPU OverLoad Level[1] : 10% CPU OverLoad Level[2] : 20% CPU OverLoad Level[3] : 90% CPU OverLoad Level[4] : 95% CPU Peak Usage : 99.88% CPU Peak Usage Time : 2008-10-31 20:12:54 ------------------------------------------------------------ The History Real CPU Usage : No %CPU %CPU %CPU %CPU %CPU %CPU %CPU %CPU 0 3.87 4.76 4.72 4.76 4.76 4.69 4.65 4.65 1 4.69 4.65 ************************************************************ and the strange thing happens here. I got the string variable Text = "\r\n2011-09-27 19:11:05.996 [Process ID:0x00000000] show cpup sc11" and Text_Value = "\r\n2011-09-27 19:11:05.996 [Process ID:0x00000000] show cpup sc11\r\n************************************************************\r\n.....4.69 4.65 \r\n************************************************************" The Text_Value is exactly what I want but the Text is always be cut off here in "show cpup sc11". the twoline is expected to do the same thing. when i try other output of the program.This would not happen.The two variable is same. A: It's probably a synchronization issue. Your Text is cut off because the control is not quite populated. By the time Text_Value line is executed, the outputText() object is populated fully, so Text_Value is not truncated. You could prove this by inserting a sleep(10) command prior to the Text line. Change the value 10 to whatever arbitrary number of seconds is long enough for the outputText() control to have been fully populated.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568320", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Change Tracking with DTO to POCO Entity Framework 4/4.1 I've used Entity Framework 4.0 POCO entities for persistence layer in the current project. I've used DTO's to send the data from Service Layer to UI Layer. Repositories and inside of Service Layer have used POCO. There is a Mapping Layer to map (DTO to Domain(POCO) and (Domain(POCO) to DTO). At the moment, we manually track the changes. For example, If entity id is zero we assume that entity is a new one and if not entity is an update. Is there any way to achieve this other than implementing IsTransient(New), IsDirty(Update) or IsDeleted(Delete) properties manually in Entity Framework 4.0? A: If you use your custom DTO you must always implement your own change tracking. EF 4 offers only self tracking entities but that would require you to use these entities directly instead of DTOs and they have some other disadvantages.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568322", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Android market publish (application language settings): "Fill fields with auto translation from English" Under Android publish > your application > language > add language is option Fill fields with auto translation from English (en) What does it do? Does it translate my application to all possible languages automatically depending on user selected locale? A: It just take the English text (if any) and fill the languages you selected with the translation. It only apply for the market descriptions.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568325", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: How do I return positive responses other than HTTP 200 OK with Luracast Restler? I understand that Restler automatically returns the result of my method with the HTTP Status code 200 (OK) and if I want to return an error response I use throw new RestException(400); // returns HTTP 400 Bad Request But how do I return a response of say, HTTP 201 Created along with the resulting value? A: I hit this too and I'm returning success states manually: return(array('success' => array('code' => 201, 'msg' => 'resulting value'))); If you want RESTler to handle it for you: throw new RestException(201, 'resulting value'); but that will be returned under the "error" state: { "error": { "code": 201, "msg": "resulting value" } } A: As of RESTLER 3, you can set an alternate positive response code in the Doc Comments above your API Method. For example, the below Doc Comment sets a DELETE route with a return status of 204 (as long as you don't throw a RESTException) /** * Delete an Attribute * @status 204 * @url DELETE {eventTicketId}/registration/{eventTicketRegistrationId}/attribute/{attributeId} */ function deleteTicketRegistrationAttribute($eventTicketId,$eventTicketRegistrationId,$attributeId) { } A: header("HTTP/1.1 201 Some response"); should work
{ "language": "en", "url": "https://stackoverflow.com/questions/7568327", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: Sharing contracts between WCF client and service It was my understanding that when a developer (a company) develops both client and service, it’s better to put data and service contracts into a separate assembly to be used by both client and service applications. It is to avoid code duplication while generating a proxy classes using e.g. svcutil. Is this indeed the preferred approach and have you ever had a project that was an exception from this rule? A: We do this all the time in our projects and i don't know what can be said against that approach. A: Sharing contract assembly can lead to unwanted dependencies, since these contract classes such as datacontract\servicecontract can contain methods. These methods then can get called transparently in client\server code hence breaking the encapsulation of these contracts. Data\Service contracts are meant to be used only as an mechanism to share data.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568328", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: How to handle "System.IO.IOException: There is not enough space on the disk." in Windows Azure I have a problem in Windows Azure. I'm storing temporary files in local storage. After a certain time i get a System.IO.IOException: There is not enough space on the disk. So I have read some articles about it and microsoft themself recommends to catch the error and try to clear the files. So my question at this point is how is the best way to accomplish this? At the moment I would try this but I don't know if this is the best approach: public static void ClearTempFolder(string localStorageName) { System.IO.DirectoryInfo downloadedMessageInfo = new DirectoryInfo(RoleEnvironment.GetLocalResource(localStorageName).RootPath); foreach (FileInfo file in downloadedMessageInfo.GetFiles()) file.Delete(); foreach (DirectoryInfo dir in downloadedMessageInfo.GetDirectories()) dir.Delete(true); } Thanks for your help. A: If you're happy for all the files to go - then, yes, that should work fine. You may want to trap for exceptions that will be thrown if a file is still open. However, it may be better to examine your code to see whether you can remove the temporary file immediately when you've finished with it. A: Check out http://msdn.microsoft.com/en-us/library/windowsazure/hh134851.aspx The default TEMP/TMP directory limit is... 100MB! Even if you have 200GB+ local storage. Your solution should be two fold: 1) Clean up temporary files when you're done with them (if you write a file to the temp folder, delete it when you're finished with it) 2) Increase the local storage size (as above) so you can store files larger than 100MB on temporary disk storage
{ "language": "en", "url": "https://stackoverflow.com/questions/7568335", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Dynamically change the HTML source using native JavaScript? I was trying to change my HTML files. Please see this to get a better understanding of what I am up to. Every thing worked fine but as I viewed the source it was not changed. The changes I was trying to make were only reflected on the web-page I had opened on my browser. Is it by any way possible to change the actual source of the HTML page? I am using IE8 and GreaseMonkey4IE to run my JavaScript on the web pages I want to manipulate, just in case you are interested. There is a similar question here. But I have my HTML files at my local storage. No server side - client side technicalities. EDIT 1 Well I do have setup Tomcat but it is all in my local machine. Also if I can modify the DOM can't I save it as a new HTML file, this way I won't have to mess with the original source file. This is how we do it in firefox. There must be some way to do it in IE8. EDIT 2 Now it is working fine for the HTML pages without any frames. But when I am trying this on pages with frames it is not working.It is going to kill me i am sure. Perhaps this is because frame access other HTML pages. For example : <frameset rows="95,*" frameborder="NO" framespacing="0" border="0" marginwidth="0" marginheight="0"> <frame name="title" target="content" src="Strategy%20Details.asp_files/title.htm" scrolling="NO"> <frameset cols="168,*"> <frame name="navigation" noresize="noresize" width="168" target="content" src="Strategy%20Details.asp_files/navigation.htm"> <frame name="content" noresize="noresize" src="Strategy%20Details.asp_files/home.htm"> </frameset> </frameset> See how the frames are accessing the HTML pages in src attribute. Any Idea ??? A: You should be able to see the dynamic changes using IE Developer Tools. When you "View Source" the page shows you the source that was delivered from the server without any changes made afterwards. IE Developer Tools (or Firebug in Firefox, or Dragonfly in Opera) will let you see changes dynamically (and will also highlight changes as they occur!) A: If I understand you correctly you want to change the contents of the HTML file on your harddrive? That's not possible using JS, and regardless of where the HTML file is (local machine or not), there's always a server side and client side. Basically your OS is acting as the server (providing you with HTML) and your browser is still just a client, with no more rights than it would have if you were on a page on the web. It sounds like you should look in to some kind of server technology that allows for dynamic web pages such as PHP, JSP, server side JS, or any of a million others. A: So from looking at what you are doing with Firefox, you don't want javsctipt to do the saving, just be able to modify the DOM using script the Save the HTML representation of the changes in IE. IN IE, use IE developer tools. Press f12. If you've manipulated the DOM, click the refresh icon in developer tools. Then Click the save icon. A: Edit: No there isn't a way, atleast not without inspecting source without firebug. A: It isn't possible. I suppose it depends on the browser, but when you request the source of a page, they usually perform the request again, or use a cached result of the original source (evidently before client manipulation, which only exists and makes sense in your view of the page in your browser), so you get what you have in the source (in this case the HTML files in your local storage).
{ "language": "en", "url": "https://stackoverflow.com/questions/7568343", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: I am trying to refresh the data in form2 if the value from form1 is changed when the form2 is already loaded I have two forms Form1 and Form2and I showed details from Form1 in Form2. I am trying to refresh the data in Form2 if the value from Form1 is changed when the Form2 is already loaded. I have displayed the details in Form2 Form_Load() event. Can any one help me to do this. Thanks in advance. A: Move logic from onload event to public function and call it from onload event and from form1 too. A: * *Handle the "Changed" events of the controls in Form1. *Create custom events in Form1 (for data change) and fire these custom events from the control's "Changed" event handler. *Handle these custom events of Form1 in Form2 and update the Form2 controls accordingly.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568347", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Show JQuery UI Autocomplete suggestions on top of other elements I'm using JQuery UI Autocomplete to suggest different cities on a map control. I usually have other divs showing content that interfere with the suggestions from the autocomplete. The divs appear on top of the suggestions. Changing the z-index of these divs is pointles for the suggestions have the lowest z-index. The chosen strategy is to modify the z-index of the suggestions to appear on top. The idea is to attach a handler to the load event of the suggestions that changes the z-index to the highest value. As suggestions are not available at control creation time, the handler must be attached using .live(). I've done the following: $('ul.ui-autocomplete').live('load',function(){ this.css('z-index',3999); }); The problem seems that I'm not attaching the handler well as it's not getting fired. Any idea? A: I have found a workaround to make it work. I do not really like it as it depends on timing the search of the dropdown list a few seconds to "ensure" it will be available. You need this because when open event is triggered the dropdownlist hasnt been created yet. If you register the following function to the open event function() { $(this).removeClass("ui-corner-all").addClass("ui-corner-top"); setTimeout("$('ul.ui-autocomplete').css('z-index',3999)",500); } though this works, i'm still looking for a deterministic response. A: use this option below line of code: $(".selector").autocomplete("option", "position", {my: "right top", at: "right bottom"});
{ "language": "en", "url": "https://stackoverflow.com/questions/7568350", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Android - ResourceNotFoundException for application label I am wondering if anyone can help me. I am getting a ResourceNotFoundException in my android application. It occurs when the following code is run (the exception occurs on the getString() call) context = getApplicationContext(); PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); String appName = context.getString(pInfo.applicationInfo.labelRes); In my AndroidManifest.xml I have the android:label attribute set for the application and activtiy tags. When I use the debugger I can see that the PackageInfo.ApplicationInfo object contains value 0 for labelRes and that explains the exception. The weird thing is that the value that I set for the android:label attribute in AndroidManifest.xml is contained in the nonLocalizedLabel attribute. Does anyone know how this could happen? I have checked that the package name returned by the context object is the correct one for my application A: I found the answer to this. The solution was to use ApplicationInfo appInfo = context.getApplicationInfo(); String appName = (String) context.getPackageManager().getApplicationLabel(appInfo); instead and it worked
{ "language": "en", "url": "https://stackoverflow.com/questions/7568353", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: 3d plot in R - Patch I have the following data in a data frame: **x** in (0,1) **y** in [0,1] **z** in [0,1] For example: X,Y,Z 0.1, 0.2, 0.56 0.1, 0.3, 0.57 ... I'd like to plot them on this type of chart: I tried on R, but all I could get was a not-so-fancy 3d scatterplot. I also read about the lattice 3d wireframe, but I couldn't get my head around it. What am I supposed to do to get a Matlab like wireframe in R? What data transforms are involved? This is the sample code from the documentation: x <- seq(-pi, pi, len = 20) y <- seq(-pi, pi, len = 20) g <- expand.grid(x = x, y = y) g$z <- sin(sqrt(g$x^2 + g$y^2)) wireframe(z ~ x * y, g, drape = TRUE, aspect = c(3,1), colorkey = TRUE) I don't find it particularly clear. EDIT: the persp3d function works fine, and I was able to generate a 3d plot with one colour. How can I set a colour scale relative to the z value? Thanks for any hints, Mulone A: Use outer to create the z values and then use persp to plot: z <- outer(x,y, function(x,y) sin(sqrt(x^2+y^2))) persp(x,y,z) There are options for colouring and setting the viewing angle, see ?persp. See the fourth example for Matlab style colouring. For an interactive plot, consider using persp3d in the rgl package: require(rgl) persp3d(x,y,z,col="blue") Edit To add colour, there is a slight difference from the method in persp, since the colour relates to the vertex rather than the centre of the facet, but it makes it easier. jet.colors <- colorRampPalette( c("blue", "green") ) pal <- jet.colors(100) col.ind <- cut(z,100) # colour indices of each point persp3d(x,y,z,col=pal[col.ind]) The help file recommends adding the parameter smooth=FALSE, but that's down to personal preference.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568356", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "7" }
Q: How to use Jersey with Eclipse Helios? My base need is to use the Jersey framework to develop very basic REST webservices. I've read several tutorials regarding Jersey (JAX-RS framework) and writing webervices but so for I've not found an easy way to setup a development environment based on Eclipse Helios and Glassfish (Open Source Edition). When creating a Webservice in Eclipse, it seems to use JAX-WS, or when creating a Dynamic Web App, Eclipse reports a credentials error (I use admin/admin) or a wrong user name / password. The tutorials I've found either use myEclipse, or Tomcat, or Maven. The later works pretty well but I wish I could avoid using the command line because creating the web.xml and other files like that one is really scary, and I'm not sure these files are supposed to be human-written. So I suppose (maybe I'm wrong) using a IDE will make things easier. What do guys use ? How do you generate these files ? Do you use Eclipse only for writting code or also use the deploy facilities? Any pointers are appreciated ! Thank you SCO A: You DO need to modify web.xml whenever it's needed. Especially with JAX-RS, you will have to define your servlet in web.xml. I recommand you to use Maven. There are plenty of exemple in the web to do so. Good luck, JAX-RS is really great ! Maven is also nice. A: I also use eclipse for creating and consuming web service based applications. In addition to WTP, I also use Axis plugins to make things easier (through wizards, highlighting as well as for schema verification). The bottomline is to find the plugins that suit you the best
{ "language": "en", "url": "https://stackoverflow.com/questions/7568362", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: jquery- how to get different page elements There is one hyperlink in One.html and when I click on that link then window Two.html page having some images open[window.open('Two.html','mywindow','width=400,height=200')] I want, when I click on image on window then that same image will also appear in One.html Below is my attempt: One.html <a id="id1" href="" onclick="window.open('OnclickPage.html','mywindow','width=400,height=200')">Click here</a> <div id="area"></div> Two.html <img id="id1" class="img" src="image.gif"/><p/> <img id="id2" class="img" src="cart.jpg"/><p/> $.get("One.html").find($'area').append(clicked image from current window);//exactly not getting. please help me to correct Please help me to correct page Two.html code. All selected images from Two.html(reside in window) should instantly appear in One.html, like if we select one image then previous page should instantly updated with that image and if we select two images then previous page One.html should get updated instantly Any kind of startup help will be highly appreciated! A: Use the opener object in two.html. The opener object is a reference to the window that opened the new window. Then, $(opener.document).find('#area')... should work.. A: its have very limited option to able do that for the security levels of the different browsers what u can do inside iframe while its same domain origin access the Dom of the page within iframe and without. run thu Ajax into different page not possible for the reason i told u herE:) hope i help
{ "language": "en", "url": "https://stackoverflow.com/questions/7568366", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Redirection from filter in Java EE How do I track the first HTTP request when a session will get initialized and allow it from a filter? After initializing this session "it" will always pass through the filter. A: You can use a session attribute as a boolean flag: HttpSession sess = request.getSession(); Object o = sess.getAttribute("FIRST_HIT"); if (o == null) { //execute first hit stuff here sess.setAttribute("FIRST_HIT", "FIRST_HIT"); } Where 'request' ISA javax.servlet.ServletRequest This is an 'execute only once per session' style logic since we are storing the boolean flag in the session object (or session scope)
{ "language": "en", "url": "https://stackoverflow.com/questions/7568369", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Limit the number of non decimal digits in an edittext I have an edittext in which I have to enter only digits below 10000. 9999.99 is a valid entry but 10000 is not. Is there any way to limit the number of digits in the mantessa part A: add this line android:numeric="integer" and take a TextWatcher check total value< 10000 <EditText android:numeric="integer"... /> edittext.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub float final =Float.valueOf(s.toString()); if(final<10000) //accept else //reject } }); A: You can use InputFilter in your edittext: http://developer.android.com/reference/android/text/InputFilter.html
{ "language": "en", "url": "https://stackoverflow.com/questions/7568371", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Define an item order in the list I have items in a list. I would like to add a number field that would indicate the order of the items in the list. Is it possible to do it ? I can't find any option like that. In fact, it seems that the "Change Order" option available in all previous SP version is missing in SP 2010. A: The custom order is still available via the list views. You could create your own field for a list and set the list sort order in your view to use that field. Then you can choose descending or ascending order.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568372", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "-1" }
Q: Multiple UI Threads - Winforms I want to create multiple UI threads in my application. I have simulated the scenario as below. I am creating a new window / form on a button click in a background thread namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { var thread = new Thread(() => { Form f = new Form(); Application.Run(f); }); // thread.IsBackground = true; -- Not required. See Solution below thread.SetApartmentState(ApartmentState.STA); thread.Start(); } } } Note that - I am doing IsBackground = true bacause when the user closes on the main form, the child forms/windows should also close down. Is there a more cleaner/graceful way to achieve the same ? EDIT - I want to create dedicated UI threads for each window. I will have 10 such windows displaying real-time data in parallel. Solution - Is this fine ? (as per msdn and Hans' comments below) have set the Apartment state (see code above) protected override void OnClosed(EventArgs e) { Application.Exit(); } A: Messing with threads will only bite you sooner or later. From MSDN: Controls in Windows Forms are bound to a specific thread and are not thread safe. Therefore, if you are calling a control's method from a different thread, you must use one of the control's invoke methods to marshal the call to the proper thread You can of course use as many threads as you like, but don't try to create a workaround to be able to use different threads for updating the UI. Use Invoke/InvokeRequired from your worker/background threads instead. Using an extension method makes it cleaner: Automating the InvokeRequired code pattern A: I think you will need to set the apartment state of your thread to single threaded as indicated here ApartmentState for dummies and here Thread-safe Form.Show: t.SetApartmentState(ApartmentState.STA). I don't know if that's possible on a background thread though. Another thing that I would urge you to look at is MDI (multiple document interface, e.g. here). Do you really need different forms display as an own window or are they rather documents inside a common form? You may have of course a reason to create multiple UI threads. A: You could handle the MainForm.Closing event and call subForm.Close ( marshalled onto the right thread ) for each sub form. I'm not sure why you want the forms on separate threads, though. Can't you just display the sub forms non-modally on the main thread?
{ "language": "en", "url": "https://stackoverflow.com/questions/7568376", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "6" }
Q: jQuery - Rotate an image by a static amount, and then apply a drop shadow? Can anyone give me a jQuery example of how to: * *Rotate an image by a static number of degrees (say 30 degrees) *Apply a drop-shadow effect to the rotated image A: -webkit-transform: rotate(30deg); -moz-transform: rotate(30deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); -moz-box-shadow:2px 2px 4px #999999; -webkit-box-shadow:2px 2px 4px #999999; box-shadow:2px 2px 4px #999999; will do it A: @genesis' answer doesn't seem to support Internet Explorer, as the DXImageTransform.Microsoft.BasicImage(rotation=) parameter only supports 90, 180, and 270 degree increments (docs here: http://msdn.microsoft.com/en-us/library/ms532918(v=vs.85).aspx. A better solution I've found is to use a combination of @genesis' answer, and a jQuery plugin found here: http://code.google.com/p/jqueryrotate/ Use the jQuery code to rotate the image by whatever amount: $('#photo1').rotate(-8); And then use this modification of @genesis' code to apply the drop-shadow: -webkit-transform: rotate(30deg); -moz-transform: rotate(30deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); -moz-box-shadow:2px 2px 4px #999999; -webkit-box-shadow:2px 2px 4px #999999; The modification doesn't include this line: box-shadow:2px 2px 4px #999999; Because including that line gets you an ugly black background in Internet Explorer for some reason. It seems to work fine without it.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568379", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Windows Azure Exception: "Access to the path XYZ.exe is denied." I use local storage on Windows Azure to store temporary files. In there I call an .exe file to make a conversion of several other files in same local storage folder. Problem is I always get the exception "Access to the path XYZ.exe is denied.". I should mention the following: - I am using a worker role - set in the service definition file and tried to add permission to the folder I am accessing: public static void AddPermission(string absoluteFolderPath) { DirectoryInfo myDirectoryInfo = new DirectoryInfo(absoluteFolderPath); DirectorySecurity myDirectorySecurity = myDirectoryInfo.GetAccessControl(); myDirectorySecurity.AddAccessRule(new FileSystemAccessRule( "NETWORK SERVICE", FileSystemRights.FullControl, AccessControlType.Allow)); myDirectoryInfo.SetAccessControl(myDirectorySecurity); } UPDATE: I tried with this code now: public static void FixPermissions() { var tempDirectory = RoleEnvironment.GetLocalResource("localStorage").RootPath; Helper.addPermission(tempDirectory); var dir = new DirectoryInfo(tempDirectory); foreach (var d in dir.GetDirectories()) Helper.addPermission(d.FullName); } private static void addPermission(string path) { FileSystemAccessRule everyoneFileSystemAccessRule = new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow); DirectoryInfo directoryInfo = new DirectoryInfo(path); DirectorySecurity directorySecurity = directoryInfo.GetAccessControl(); directorySecurity.AddAccessRule(everyoneFileSystemAccessRule); directoryInfo.SetAccessControl(directorySecurity); } I get a really strange behaviour of the page. I still get the errors but sometimes some files gets converted by the ffmpeg.exe file. Can someone help me out here?? Thanks a lot. SOLUTION: So seems the problem was that I ran the .exe file within local storage and therefore had the given security issues. Putting the .exe into the application and referring directly solved my issue. Thx for your help. A: By default your worker role will most likely not be running with sufficient privilege to allow changes to the access control lists on Azure folders. There's two possible options: * *Best: run a script at startup to set the permissions. Details are on MSDN here: http://msdn.microsoft.com/en-us/library/gg456327.aspx. You'll want to set executionContext="elevated". The best way to write the script itself is through Powershell. An example is here: http://weblogs.thinktecture.com/cweyer/2011/01/fixing-windows-azure-sdk-13-full-iis-diagnostics-and-tracing-bug-with-a-startup-task-a-grain-of-salt.html. Alternatively, write a console application to do the same thing. *Easiest, but much less secure: set the security in your OnStart method, and run your whole worker role elevated: in your service definition file include <WebRole name="WebApplication2"> <Runtime executionContext="elevated" /> <Sites> However, I'd really not recommend that as it's a terrible security hole for something that's running in the public cloud.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568380", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Why is environ['QUERY_STRING'] returning a zero length string? I found the solution to my (dumb) problem and listed it below. I'm using Python 2.7.1+ on Ubuntu 11.04. The client/server are on the same computer. From the Wing debugger, I know the server code is being called and I can walk through the code one line at a time. In this instance, I know 22 bytes were transferred. In Firebug, I saw this data under the Net Post tab: Parameter application/x-www-form-urlencoded fname first lname last Source Content-Type: application/x-www-form-urlencoded Content-Length: 22 fname=first&lname=last This is the client code that I'm using: <html> <form action="addGraphNotes.wsgi" method="post"> First name: <input type="text" name="fname" /><br /> Last name: <input type="text" name="lname" /><br /> <input type="submit" value="Submit" /> </form> </html> And this is the server code: import urlparse def application(environ, start_response): output = [] # the environment variable CONTENT_LENGTH may be empty or missing try: # NOTE: THIS WORKS. I get a value > 0 and the size appears correct (22 bytes in this case) request_body_size = int(environ.get('CONTENT_LENGTH', 0)) except (ValueError): request_body_size = 0 try: # environ['QUERY_STRING'] returns "" **values = urlparse.parse_qs( environ['QUERY_STRING'] )** except: output = ["parse error"] In the Wing debugger, I've verified that data is being passed from the client to the server: >>> environ['wsgi.input'].read() 'fname=first&lname=last' FOUND MY PROBLEM. I COPIED AND PASTED IN THE WRONG CODE. THIS IS THE CODE I WAS USING FOR FORMS BUT STOP ADDING IT WHEN I STARTED USING AJAX AND STOPPED USING FORMS. Now, everything is working fine. # When the method is POST the query string will be sent # in the HTTP request body which is passed by the WSGI server # in the file like wsgi.input environment variable. request_body = environ['wsgi.input'].read(request_body_size) values = parse_qs(request_body) A: You're doing a POST query so the QUERY_STRING is indeed going to be empty as it represents the query string of a GET request (it can also appear in other request types but it's unrelated to the problem at hand). You are supposed to parse POST data by consuming the wsgi.input stream.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568381", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: ASP.NET sitemap as dropdown menu display problem with non child elements I have a asp.net sitemap with single level dropdown menu. I am using following code in master page to display them as dropdown menu by generating <li> and <ul>. It works fine the issue is, even if some items dont have child items it generates empty which leads to showing the dropdown icon. How Can I stop the empty <ul> generation by checking the child nodes count. <!--- Menu --> <div id="horizontalcssmenu" class="horizontalcssmenu"> <asp:SiteMapDataSource ID="SiteMapDataSource1" ShowStartingNode="false" runat="server" /> <ul id="cssmenu1"> <li><a id="A1" href="index.aspx" runat="server">Home</a></li> <asp:Repeater ID="foo" DataSourceID="SiteMapDataSource1" EnableViewState="false" runat="server" onitemcommand="foo_ItemCommand"> <ItemTemplate> <li> <a href='<%#Eval("url") %>'><%#Eval("Title") %></a> <ul> <asp:Repeater ID="bar" DataSource='<%# ((SiteMapNode) Container.DataItem).ChildNodes %>' runat="server"> <ItemTemplate> <li><a href='<%#Eval("url") %>'><%#Eval("Title") %></a></li> </ItemTemplate> </asp:Repeater> </ul> </li> </ItemTemplate> </asp:Repeater> </ul> </div> <!-- Menu End --> The output code displays something like this <!--- Menu --> <div id="horizontalcssmenu" class="horizontalcssmenu"> <ul id="cssmenu1"> <li><a href="index.aspx" id="ctl00_A1">Home</a></li> <li> <a href='/SVSS/StudentFullDetails.aspx'>Student Details</a> <ul> </ul> </li> <li> <a href='/SVSS/StudentMonthlyAttendance.aspx'>Attendance</a> <ul> </ul> </li> <li> <a href='/SVSS/MyNotice.aspx'>Notice</a> <ul> </ul> </li> </ul> </div> <!-- Menu End --> A: How about something like: <%if(((SiteMapNode) Container.DataItem).ChildNodes.Length > 0) { %> <ul> <asp:Repeater ID="bar" DataSource='<%# ((SiteMapNode) Container.DataItem).ChildNodes %>' runat="server"> <ItemTemplate> <li><a href='<%#Eval("url") %>'><%#Eval("Title") %></a></li> </ItemTemplate> </asp:Repeater> </ul> <%}> A: A bit late, but might help others. Try setting the Visible property of the repeater, like this. Visible="<%# ((SiteMapNode)Container.DataItem).ChildNodes.Count > 0 ? true : false %>" A: the important stuff is -> If(CType(Container.DataItem, SiteMapNode).HasChildNodes its good for bootstrap navbar needs to add active for the active node <nav class="navbar navbar-expand-sm navbar-toggleable-sm bg-white navbar-light border-bottom box-shadow mb-3"> <a id="HlBrand" href="#" class="navbar-brand" title="xx"> logo </a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="navbar-collapse collapse" role="navigation" id="navbarText"> <ul class="navbar-nav ml-auto" role="menu"> <%--<li> <asp:HyperLink runat="server" CssClass="nav-link" ID="lnkHome" NavigateUrl="~/">Home</asp:HyperLink> </li>--%> <asp:Repeater runat="server" ID="menu" DataSourceID="SiteMapDataSource1"> <ItemTemplate> <li class="nav-item dropdown"> <%--<%# If(CType(Container.DataItem, SiteMapNode).HasChildNodes, "nav-link dropdown-toggle", "nav-link")%>--%> <asp:HyperLink ID="lnkMenuItem" CssClass='<%# If(CType(Container.DataItem, SiteMapNode).HasChildNodes, "nav-link dropdown-toggle", "nav-link")%>' data-toggle="dropdown" aria-expanded="false" aria-haspopup="true" runat="server" title='<%# Eval("description") %>' NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink> <asp:Repeater ID="submenu" runat="server" DataSource="<%# CType(Container.DataItem, SiteMapNode).ChildNodes %>"> <HeaderTemplate> <div role="menu" aria-labelledby="" class="dropdown-menu"> </HeaderTemplate> <ItemTemplate> <asp:HyperLink ID="lnkMenuItem" CssClass="dropdown-item" runat="server" NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink> </ItemTemplate> <FooterTemplate> </div> </FooterTemplate> </asp:Repeater> </li> </ItemTemplate> </asp:Repeater> </ul> </div> </nav> <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
{ "language": "en", "url": "https://stackoverflow.com/questions/7568382", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: cartographer - undefined method 'has_key?' i have a problem with Cartographer plugin for rails3: https://github.com/joshuamiller/cartographer I've done everything just like in the docs and all i'm getting is this error: undefined method 'has_key?' for false:FalseClass in this line: <% raw Cartographer::Header.new.to_s %> Has anyone any idea what am i doing wrong? Any help would be appreciated A: Ok problem solved - i was using rails 3.0.3 and after changing it to 3.0.1 everything works fine.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568385", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: GWT problem when setting inner html I'm having big trouble while setting text (as HTML) for gwt HTML component. In my case I'm setting my UiBinder template, let's call it foo.ui.xml ... <g:HTMl ui:field="testfield"/> ... Because it's a dialog window I want to dynamically change content of this field. In my View class class MyWidget extends PopupPanel { @UiField HTML testfield .. } When showing up popup I'm setting it's content testField.setHTML("<span>Some example <b>of html</b></span>"); Resulting in exception Caused by: com.google.gwt.core.client.JavaScriptException: (Error): Nieznany błąd czasu wykonywania. at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.google.gwt.dom.client.Element$.setInnerHTML$(Element.java) at com.google.gwt.user.client.ui.DirectionalTextHelper.setInnerTextOrHtml(DirectionalTextHelper.java:240) at com.google.gwt.user.client.ui.DirectionalTextHelper.setTextOrHtml(DirectionalTextHelper.java:184) at com.google.gwt.user.client.ui.HTML.setHTML(HTML.java:183) at foo.app.client.popup.MyWidgetUI.setMessage(MyWidgetUI.java:133) 'Nieznany błąd czasu wykonywania.' - means something like 'Unknown error during execution time'. This bug seems to occur only on IE6,7 browsers. Any ideas about a cause or solution ?
{ "language": "en", "url": "https://stackoverflow.com/questions/7568391", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Vertically aligning multiple lines of text in IE7 I am trying to vertically align text in IE7 is proving to be a PITA without the css options of display: table; and display: table-cell; It is for a navigation that looks similar to this: <ul> <li><a href="#"><span>Text covers one line</span></a></li> <li><a href="#"><span>Text covers two lines, problem occurs</span></a></li> </ul> CSS: ul li a{ display: table; zoom: 1; width: 240px; height: 30px;} ul li a span{ width: 200px; display: table-cell; zoom: 1; vertical-align: middle; padding: 0 30px 0 20px; } Works on newer browsers. I can get the text to center easily with only one line of text, but when it goes to two I can't seem to get anything working. A: I know there is a lot of table-hate around here (and much is clearly justified). But you must support IE7 as a requirement - clearly we're not going to be using the latest technology here. So, if you can't get it to work with the limited set of CSS, why not just actually use a table? If you must support a browser from 2006 there will be compromises. As much as it hurts me to say this: Sometimes you've got to take a deep-breath, throw a standard out the window, and think to yourself, "If it works, it works." A: There are two solutions I am aware of, but each has its small discomfort. Please look at this demo fiddle showing both. The first solution is based on this answer which has the downside that the clickable area is compressed to only the text, and does not extend to the list item bounds. I suppose this is not be a great problem, since users will likely click the text rather then next to it. The second solution is based on this answer which has the downside that you need one extra element in the markup. I chose for an <ins> tag, but you can use any other inline element. A: If I understand your task correctly, there is absolutely no need in using tables. The main reason for that is that if you have a number of li elements that exceeds the width of your page, you will definitely have problems with making them wrap nicely. So, is that what you are trying to achieve? http://jsfiddle.net/EK357/ The solution is based on: http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/ To cut it short, you have to set these rules for each li element: li { display: inline-block; display: -moz-inline-box; /* Firefox < 3.5 */ *display: inline; /* IE */ zoom: 1; vertical-align: middle; margin-right: -.3em; } Be aware, though, that there is an extra whitespace after each inline-block element (that's what margin-left: -.3em for.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568399", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: jibx 1.2.3 modular schema to code generation - binding compilation causes Internal error - cannot modify class I have a maven multi-module project having hierarchy: parent + ota-module + ota-common + ota-veh-avail-rate OTA2003B ( http://www.opentravel.org/Specifications/SchemaIndex.aspx?FolderName=2003B ) Schemas I am using: Common: OTA_CommonPrefs.xsd OTA_CommonTypes.xsd OTA_SimpleTypes.xsd OTA_VehicleCommonTypes.xsd VehAvailRate OTA_VehAvailRateRQ.xsd OTA_VehAvailRateRS.xsd ota-module - pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>parent</artifactId> <groupId>com.poc.multimodule</groupId> <version>0.0.1-SNAPSHOT</version> <relativePath>..</relativePath> </parent> <artifactId>ota-module</artifactId> <packaging>pom</packaging> <name>MultiModule OTA Parent Project</name> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </pluginManagement> </build> <dependencies> <!-- JiBX dependencies --> <dependency> <groupId>org.jibx</groupId> <artifactId>jibx-run</artifactId> <version>1.2.3</version> </dependency> <dependency> <groupId>org.jibx</groupId> <artifactId>jibx-extras</artifactId> <version>1.2.3</version> </dependency> <dependency> <groupId>org.jibx</groupId> <artifactId>jibx-bind</artifactId> <version>1.2.3</version> </dependency> <!-- JUnit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.9</version> </dependency> </dependencies> <modules> <module>ota-common</module> <module>ota-veh-avail-rate</module> </modules> </project> ota-common - pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>ota-module</artifactId> <groupId>com.poc.multimodule</groupId> <version>0.0.1-SNAPSHOT</version> <relativePath>..</relativePath> </parent> <artifactId>ota-common</artifactId> <name>Multi Module OTA Common Project</name> <packaging>jar</packaging> <properties> <ota_common_base_path>/media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common</ota_common_base_path> </properties> <build> <plugins> <plugin> <groupId>org.jibx</groupId> <artifactId>jibx-maven-plugin</artifactId> <version>1.2.3</version> <configuration> <!-- <multimodule>true</multimodule> --> <customizations> <customization>${ota_common_base_path}/src/main/resources/jibx/customizations/custom_a.xml</customization> </customizations> <schemaLocation>${ota_common_base_path}/src/main/resources/schemas/OTA2003B/Common</schemaLocation> <includeSchemas> <includeSchema>*.xsd</includeSchema> </includeSchemas> <schemaBindingDirectory>${ota_common_base_path}/src/main/java</schemaBindingDirectory> <includeSchemaBindings> <includeSchemaBindings>*binding.xml</includeSchemaBindings> </includeSchemaBindings> <options> <u>http://www.opentravel.org/OTA/2003/05</u> </options> </configuration> <executions> <execution> <id>generate-java-code-from-schema</id> <goals> <goal>schema-codegen</goal> </goals> </execution> <execution> <id>compile-jibx-binding</id> <goals> <goal>bind</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> custom_a.xml <schema-set prefer-inline="true" package="com.poc.multimodule.ota.common" xmlns:xs="http://www.w3.org/2001/XMLSchema" type-substitutions="xs:integer xs:int xs:decimal xs:float" binding-file-name="base-binding.xml"> <schema name="OTA_CommonPrefs.xsd" /> <schema name="OTA_CommonTypes.xsd" /> <schema name="OTA_SimpleTypes.xsd" /> <schema name="OTA_VehicleCommonTypes.xsd"> <complexType name="VehicleProfileRentalPrefType"> <element path="**" name="VendorPref" ignore="true"/> </complexType> </schema> </schema-set> ota-veh-avail-rate - pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>ota-module</artifactId> <groupId>com.poc.multimodule</groupId> <version>0.0.1-SNAPSHOT</version> <relativePath>..</relativePath> </parent> <artifactId>ota-veh-avail-rate</artifactId> <name>OTA Multi Module VehAvailRate Project</name> <properties> <ota_veh_avail_rate_base_path>/media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-veh-avail-rate</ota_veh_avail_rate_base_path> </properties> <dependencies> <dependency> <groupId>com.poc.multimodule</groupId> <artifactId>ota-common</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.jibx</groupId> <artifactId>jibx-maven-plugin</artifactId> <version>1.2.3</version> <configuration> <multimodule>true</multimodule> <modules> <module>com.poc.multimodule:ota-common</module> </modules> <customizations> <customization>${ota_veh_avail_rate_base_path}/src/main/resources/jibx/customizations/custom_b.xml</customization> </customizations> <schemaLocation>${ota_veh_avail_rate_base_path}/src/main/resources/schemas/OTA2003B/VehAvailRate</schemaLocation> <includeSchemas> <includeSchema>OTA_VehAvailRateRQ.xsd</includeSchema> <includeSchema>OTA_VehAvailRateRS.xsd</includeSchema> </includeSchemas> <schemaBindingDirectory>${ota_veh_avail_rate_base_path}/src/main/java</schemaBindingDirectory> <includeSchemaBindings> <includeSchemaBindings>*binding.xml</includeSchemaBindings> </includeSchemaBindings> <options> <i>classpath:base-binding.xml</i> </options> </configuration> <executions> <execution> <id>generate-java-code-from-schema</id> <goals> <goal>schema-codegen</goal> </goals> </execution> <execution> <id>compile-jibx-binding</id> <goals> <goal>bind</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> custom_b.xml <schema-set prefer-inline="true" xmlns:xs="http://www.w3.org/2001/XMLSchema" type-substitutions="xs:integer xs:int xs:decimal xs:float" package="com.poc.multimodule.ota.vehavailrate"> <name-converter strip-prefixes="OTA_" strip-suffixes="Type AttributeGroup Group Attributes"/> <schema name="OTA_VehAvailRateRQ.xsd" includes="OTA_VehAvailRateRQ" /> <schema name="OTA_VehAvailRateRS.xsd" includes="OTA_VehAvailRateRS" /> </schema-set> mvn install output: $ mvn -e -Dskiptests=true install [INFO] Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] MultiModule Parent Project [INFO] MultiModule OTA Parent Project [INFO] Multi Module OTA Common Project [INFO] OTA Multi Module VehAvailRate Project [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building MultiModule Parent Project 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-install-plugin:2.3.1:install (default-install) @ parent --- [INFO] Installing /media/data/Practice/Maven_Multi_Module/parent/pom.xml to /media/data/Env/Local_Maven_Repository/com/poc/multimodule/parent/0.0.1-SNAPSHOT/parent-0.0.1-SNAPSHOT.pom [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building MultiModule OTA Parent Project 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-install-plugin:2.3.1:install (default-install) @ ota-module --- [INFO] Installing /media/data/Practice/Maven_Multi_Module/parent/ota-module/pom.xml to /media/data/Env/Local_Maven_Repository/com/poc/multimodule/ota-module/0.0.1-SNAPSHOT/ota-module-0.0.1-SNAPSHOT.pom [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Multi Module OTA Common Project 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- jibx-maven-plugin:1.2.3:schema-codegen (generate-java-code-from-schema) @ ota-common --- [INFO] Generating Java sources in /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/src/main/java from schemas available in /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/src/main/resources/schemas/OTA2003B/Common... Loaded and validated 4 specified schema(s) Generated 202 top-level classes (plus 46 inner classes) in package com.poc.multimodule.ota.common Total top-level classes in model: 202 Total classes (including inner classes) in model: 248 [INFO] [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ ota-common --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 5 resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ ota-common --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 202 source files to /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes [INFO] [INFO] --- jibx-maven-plugin:1.2.3:bind (compile-jibx-binding) @ ota-common --- [INFO] Running JiBX binding compiler (single-module mode) on 1 binding file(s) [INFO] [INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ ota-common --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ ota-common --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ ota-common --- [INFO] Surefire report directory: /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- There are no tests to run. Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ ota-common --- [INFO] Building jar: /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/ota-common-0.0.1-SNAPSHOT.jar [INFO] META-INF/maven/com.poc.multimodule/ota-common/pom.xml already added, skipping [INFO] META-INF/maven/com.poc.multimodule/ota-common/pom.properties already added, skipping [INFO] [INFO] --- maven-install-plugin:2.3.1:install (default-install) @ ota-common --- [INFO] Installing /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/ota-common-0.0.1-SNAPSHOT.jar to /media/data/Env/Local_Maven_Repository/com/poc/multimodule/ota-common/0.0.1-SNAPSHOT/ota-common-0.0.1-SNAPSHOT.jar [INFO] Installing /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/pom.xml to /media/data/Env/Local_Maven_Repository/com/poc/multimodule/ota-common/0.0.1-SNAPSHOT/ota-common-0.0.1-SNAPSHOT.pom [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building OTA Multi Module VehAvailRate Project 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- jibx-maven-plugin:1.2.3:schema-codegen (generate-java-code-from-schema) @ ota-veh-avail-rate --- [INFO] Generating Java sources in /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-veh-avail-rate/src/main/java from schemas available in /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-veh-avail-rate/src/main/resources/schemas/OTA2003B/VehAvailRate... Loaded and validated 2 specified schema(s) and 4 referenced schema(s) Generated 6 top-level classes (plus 4 inner classes) in package com.poc.multimodule.ota.vehavailrate Total top-level classes in model: 6 Total classes (including inner classes) in model: 10 [INFO] [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ ota-veh-avail-rate --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 3 resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ ota-veh-avail-rate --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 6 source files to /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-veh-avail-rate/target/classes [INFO] [INFO] --- jibx-maven-plugin:1.2.3:bind (compile-jibx-binding) @ ota-veh-avail-rate --- [INFO] Running JiBX binding compiler (restricted multi-module mode) on 1 binding file(s) [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] MultiModule Parent Project ........................ SUCCESS [0.325s] [INFO] MultiModule OTA Parent Project .................... SUCCESS [0.006s] [INFO] Multi Module OTA Common Project ................... SUCCESS [7.079s] [INFO] OTA Multi Module VehAvailRate Project ............. FAILURE [0.964s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 8.489s [INFO] Finished at: Tue Sep 27 16:54:14 IST 2011 [INFO] Final Memory: 28M/195M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.jibx:jibx-maven-plugin:1.2.3:bind (compile-jibx-binding) on project ota-veh-avail-rate: Internal error - cannot modify class com.poc.multimodule.ota.common.ActionType loaded from /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jibx:jibx-maven-plugin:1.2.3:bind (compile-jibx-binding) on project ota-veh-avail-rate: Internal error - cannot modify class com.poc.multimodule.ota.common.ActionType loaded from /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: org.apache.maven.plugin.MojoExecutionException: Internal error - cannot modify class com.poc.multimodule.ota.common.ActionType loaded from /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes at org.jibx.maven.AbstractBaseBindingMojo.compile(AbstractBaseBindingMojo.java:166) at org.jibx.maven.AbstractBaseBindingMojo.execute(AbstractBaseBindingMojo.java:133) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: java.lang.IllegalStateException: Internal error - cannot modify class com.poc.multimodule.ota.common.ActionType loaded from /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes at org.jibx.binding.classes.ClassFile.getClassGen(ClassFile.java:1286) at org.jibx.binding.classes.ClassFile.removeMethod(ClassFile.java:1339) at org.jibx.binding.classes.ExistingMethod.delete(ExistingMethod.java:144) at org.jibx.binding.classes.MungedClass.purgeUnusedMethods(MungedClass.java:151) at org.jibx.binding.classes.MungedClass.fixDispositions(MungedClass.java:381) at org.jibx.binding.Compile.compile(Compile.java:237) at org.jibx.maven.AbstractBaseBindingMojo.compile(AbstractBaseBindingMojo.java:163) ... 22 more [ERROR] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :ota-veh-avail-rate Error Cause: Caused by: java.lang.IllegalStateException: Internal error - cannot modify class com.poc.multimodule.ota.common.ActionType loaded from /media/data/Practice/Maven_Multi_Module/parent/ota-module/ota-common/target/classes at org.jibx.binding.classes.ClassFile.getClassGen(ClassFile.java:1286) at org.jibx.binding.classes.ClassFile.removeMethod(ClassFile.java:1339) at org.jibx.binding.classes.ExistingMethod.delete(ExistingMethod.java:144) at org.jibx.binding.classes.MungedClass.purgeUnusedMethods(MungedClass.java:151) at org.jibx.binding.classes.MungedClass.fixDispositions(MungedClass.java:381) at org.jibx.binding.Compile.compile(Compile.java:237) at org.jibx.maven.AbstractBaseBindingMojo.compile(AbstractBaseBindingMojo.java:163) ... 22 more com.poc.multimodule.ota.common.ActionType is a type generated by ota-common module and is there in generated base-binding.xml I am using.It is part of the schema OTA_SimpleTypes.xsd ActionType definition in schema file <xs:simpleType name="ActionType"> <xs:restriction base="xs:string"> <xs:enumeration value="Add-Update"/> <xs:enumeration value="Cancel"/> <xs:enumeration value="Delete"/> </xs:restriction> </xs:simpleType> What is causing this java.lang.IllegalStateException: Internal error - cannot modify class and how to resolve this? Thanks, Jignesh A: Jignesh, The classpath: option is not supported by the maven plugin. You should use the <includeBaseBindings> param to include a base binding. I would suggest you take a look at the pre-built opentravel.org schema bindings in the JiBX schema library: http://jibx.sourceforge.net/schema-library/site.html#opentravel.org You can find projects that build a complete library for the 2010B and 2011A schema. The maven projects are in our source repo at: http://jibx.svn.sourceforge.net/viewvc/jibx/trunk/schema-library/org.opentravel/ You should be able to adapt these projects for use in the 2003B schema. Good Luck! Don
{ "language": "en", "url": "https://stackoverflow.com/questions/7568403", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: how to set the progress bar before showing result? how to implement code for set the Progress bar before displaying the result in the same activity. .. My issue is want to Show Progress Dialog Before Setting Image And Before Starting Video.... help me to solve the problem. A: ProgressDialog dialog; private class Test extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { dialog = new ProgressDialog(Main.this); dialog.setMessage("Loading...."); dialog.setIndeterminate(true); dialog.setCancelable(true); dialog.show(); } @Override protected Void doInBackground(Void... voids) { try { runOnUiThread(new Runnable() { public void run() { } }); //your code } @Override protected void onPostExecute(Void params) { dialog.dismiss(); //result } } A: I am not sure but I think it works this way : Either preExecute() and postExecute() method of AsyncTask where in preExecute() just show the progressDialog and in postExecute() dismiss the same. or Use Handler to show progress dialog and dismiss the same
{ "language": "en", "url": "https://stackoverflow.com/questions/7568404", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: MS Access select statement, select *, ' ' from sometable shows the following result In MS Access the query SELECT *, ' ' from sometable shows the following result: EXPR001 field1 field2 ------- ------ -------- some some value value (result 1) While in SQL Server or other MSDB the above query result is: field1 field2 EXPR001 ------ ------- ------- some some value value (result 2) Is there some way some configuration some miracle some something (with condition) without changing the SQL query to run the query in MS Access such that it gives the result 2 above? A: Although this question is a duplicate of the one onedaywhen mentioned, it might not be very clear what the solution is. So, you need to use TableName.* to get the right order. Like the following: Select SomeTable.*, "" As EXPR001 From SomeTable Or, list all columns individually: Select SomeTable.Field1, SomeTable.Field2, "" As EXPR001 From SomeTable A: In Access, you can move the columns of a query, in Datasheet view, without affecting the order of the columns in Design view. Both are saved. You can deduct from that, that an Access also stores you display preferences (including hidden columns, column widths etc) in the query.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568408", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: In Objective C does every user class extend NSObject by default? While going through an Objective C programming book just now . I noticed this code @interface Fraction: NSObject { int numerator; int denominator; } -(void) print; -(void) setNumerator: (int) n; -(void) setDenominator: (int) d; @end Author does great job in explaining every thing in this book but there is no mention on whether this is same as just @interface Fraction { int numerator; int denominator; } -(void) print; -(void) setNumerator: (int) n; -(void) setDenominator: (int) d; @end reason I am asking this rather very simple question is that in JAVA every thing by default extends Object and you do not need to say that. Now of course they are two very different languages but it was a natural question that came to my mind. A: No, the two examples are not the same. @interface Fraction creates a new root class that is not associated with the NSObject hierarchy at all. As such, it won't even respond to +alloc; you would have to implement your own allocation method. You almost never want to do that. A: They are not the same. In your second example you define a class that does not derive from another class and is thus a root class (like NSObject or NSProxy). You almost never want to create a root class yourself (except if you're a 1337 h4x0r and know really well what you're doing and why). The reason why you don't want to create your own root class is that you would have to re-implement a lot of stuff that NSObject gives you, like respondsToSelector: or performSelectorInBackground:withObject: or even retain, release and autorelease. A: Create 2 classes, ChildObject which extends NSObject and OrphanObjects with no parent class. @interface ChildObject : NSObject @end @interface OrphanObject @end Now try to override the -(id)init; method. - (id)init { self = [super init]; if (self) { // Initialization code here. } return self; } For the ChildObject class, everything will work fine. For the OrphanObject class, the compiler won't let you call [super init], because there is no "super" class. Which means, you have to actually tell the compiler that you want to extend NSObject. A: It is necessary to explicitly declare the super class including NSObject. Every class does not have to be a subclass of NSObject but not subclassing NSObject is rare.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568415", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: Replacing Open File Dialog in Excel XP with a COM Add-in I am working on a C# add-in for Excel XP for which I need to handle file open and save events with my own dialogs. I managed to do this for save by (basically) handing the WorkbookBeforeSave event on the Excel Application object and cancelling the default behaviour. There is a WorkbookOpen event, but it is fired after a document has been opened, not when the user clicks the Open button or presses Ctrl-O. Here is a similar question, though the solution is for later versions of office and won't work for me: Replacing Word's Open File Dialog in a COM Add-in I cannot simply customise the normal File Open dialog - I need to replace it entirely. Any ideas? A: One somewhat hacky way would be to sink the WindowActivate event from Excel's com interface (dispID 0x614 for excel10). Then keep track of the last hwnd and watch for when it changes & if it is the excel doc window (I think you can use spy++ to find out the excel window names)
{ "language": "en", "url": "https://stackoverflow.com/questions/7568416", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: findAll filter by associated in CakePHP 1.1 I need help to solve a problem with a CakePHP 1.1 project, and a findAll query. Here is the query: $events = $this->EventCategory->findAll(null, null, array("EventCategory.name" => "ASC")); And this is a example of the result array: [1] => Array ( [EventCategory] => Array ( [id] => 1 [name] => Agencias [date] => 2009-12-15 16:07:08 ) [EventSubcategory] => Array ( [0] => Array ( [id] => 2 [event_category_id] => 1 [name] => Agencias de marketing promocional [date] => 2009-12-15 16:09:51 [Event] => Array ( [0] => Array ( [id] => 1 [event_subcategory_id] => 2 The problem, is, I need to filter by Event.id = X, in Cake 1.2+ i use the contain and filter by the associated table, but in 1.1 I dont find documentation for make this. PS: The project is too big for migrate the version. A: Have you tried adding Event.id to your conditions? If you have recursive set correctly (which it looks like you have) this might work. If you want to be sure, then it might be worth adding Event to your EventCategory model too. var $hasMany = array( 'EventSubcategory' => array( 'className' => 'EventSubcategory', 'foreignKey' => 'event_category_id', 'dependent' => false, 'conditions' => '', 'fields' => '', 'order' => '' ), 'Event' => array( 'className' => 'Event', 'foreignKey' => false, 'dependent' => false, 'conditions' => 'Event.event_subcategory_id = EventSubcategory.id', 'fields' => '', 'order' => '' ) ); Make sure Event is added to the $hasMany after EventSubcategory.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568417", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Correct Format for JSON (Json.NET am trying to consume json strings inside asp.net and google told me about this Json.NET library. I have the following json from a php webservice: "[{\"AccountID\":\"demo\",\"UserID\":\"1\",\"Password\":\"*blank*\",\"Active\":\"1\",\"Name\":\"\"}][{\"AccountID\":\"demo\",\"UserID\":\"1\",\"Password\":\"*blank*\",\"Active\":\"1\",\"Name\":\"\"}]" i found that the library cannot load urls so i had to use System.Net.WebClient; ok so far. The problem is that doing var json = webClient.DownloadString(url); //gives the json above object user = JsonConvert.DeserializeObject(json); // or User user =JsonConvert.DeserializeObject<User>(json); wont work wont work the library says "After parsing a value an unexpected character was encountered" So, is my json malformed? i construct it with json_encode($resultset) from php, so i wonder whats going on. my User object only has the properties i have on json. A: First of all, your JSON string has double quotes around the whole result and a backslash before every other double quote. I'll assume that this is an artifact from copying it out of the VisualStudio debugger (which displays it like this). If we remove these backslashes, we get the following JSON: [{"AccountID":"demo","UserID":"1","Password":"*blank*","Active":"1","Name":""}] [{"AccountID":"demo","UserID":"1","Password":"*blank*","Active":"1","Name":""}] These are two identical JSON arrays. But a valid JSON response consists of either a single JSON object or a single JSON array. This response is invalid. It's seems that two JSON response where concatenated, resulting in an invalid construct. A: That's because your json string is in incorrect format If you're going to use brackets [ then json has only one for arrays.Since your declaration is likely an array.Put your string(as I edited) into this site and see the result yourself. [{"AccountID":"demo","UserID":"1","Password":"*blank*","Active":"1","Name":""},{"AccountID":"demo","UserID":"1","Password":"*blank*","Active":"1","Name":""}]
{ "language": "en", "url": "https://stackoverflow.com/questions/7568418", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: How to drop list of table from a schema in Oracle? My Oracle scott schema contains table list like that 'prefix_A' 'prefix_B' 'prefix_C' 'A' 'B' 'C' Now i want to drop list of tables ,containing table prefix like that 'Prefix_',But others table A ,B ,C will be remain same. How it is possible ? Thanks in Advance. A: Use dynamic SQL driving off the data dictionary. begin for trec in ( select table_name from user_tables where table_name like 'PREFIX\_%' escape `\' ) loop dbms_output.put_line('dropping table ' || trec.table_name); execute immediate 'drop table '||trec.table_name; end loop; end; It's a good idea to be precise with the LIKE clause; using the escape keyword to ensure underscores aren't treated as wildcards. Alternatively use substr(table_name, 1, 7) = 'PREFIX_'. Dropping the wrong table isn't a disaster provided you're working on 10g or later and the RECYCLE BIN is enabled, but it's still better not to. Obviously you wouldn't run code like this in Production, but you would use the principle to generate a script of drop statements. The above code doesn't handle dependencies. If you have foreign keys referencing the prefixed tables and you want to force the dropping of the tables use this additional logic: execute immediate 'drop table '|| trec.table_name ||' cascade constraint'; This drops the foreign key constraints but leaves the (formerly) dependent tables. A: I used this to disable constraints, drop constraints and delete the tables. -- disable constraints on tables BEGIN FOR c IN (SELECT c.owner, c.table_name, c.constraint_name FROM user_constraints c, user_tables t WHERE c.table_name = t.table_name AND t.table_name like 'WF_%' AND c.status = 'ENABLED' ORDER BY c.constraint_type DESC) LOOP dbms_utility.exec_ddl_statement('alter table "' || c.owner || '"."' || c.table_name || '" disable constraint ' || c.constraint_name); END LOOP; END; -- drop the constraints begin for r in ( select table_name, constraint_name from user_constraints where table_name like 'WF_%' ) loop execute immediate 'alter table '||r.table_name ||' drop constraint '||r.constraint_name; end loop; end loop; -- drop the tables begin for trec in ( select table_name from user_tables where table_name like 'WF_%' ) loop execute immediate 'drop table '||trec.table_name|| ' purge'; end loop; end;
{ "language": "en", "url": "https://stackoverflow.com/questions/7568419", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: How To Perform iOS App Validation From the Command Line Is it possible to perform the local Validation for iOS applications (which can be see in the Organizer under Archives) function via the command line? UPDATE: Just to clarify - the goal here is to eventually make this validation a part of the continuous integration process for my iOS applications. A: You can validate app with the help of altool command as shown bellow: ./altool --validate-app -f <'ipaFile'> A: You can validate from the command line using the command: xcrun -sdk iphoneos Validation /path/to/App.{app or ipa} It's a bit unclear what checks it performs, but presumably it does as least code-signing and icon dimensions. In addition to local validation, it's possible to perform online validation (but only for IPA packages): xcrun -sdk iphoneos Validation -verbose -online /path/to/App.ipa For this to work you need to have your iTunes Connect credentials stored in a special entry on your keychain. To create this entry: * *Open the Keychain Access application; *Create a new password item (File > New Password item…) *Keychain Item Name: Xcode:itunesconnect.apple.com *Account Name/Password: Your credentials for iTunes Connect Online validation seems to be fairly rough, but does all the checks that would otherwise be performed validating an archive from with the Organiser window in Xcode. Sadly it doesn't seem to set a non-zero exit code on failure, which means output scraping to detect errors. My current heuristic for detecting failure is the presence of any output after the Performing online validation... line. Given the lack of documentation it's almost certainly not supported. A: In the past I've used this command: xcrun -sdk iphoneos Validation /path/to/MyApp.app or /path/to/MyApp.ipa This will check the codesigning, icon dimensions etc. I'm not sure if the Xcode Organizer or Application Loader app do any other validation in addition to this tool, and the tool itself has zero help or command line flags that I can find. UPDATE: This question has prompted me to dig a bit deeper. Running the strings tool reveals the following switches: -verbose -upload -warnings -errors -online The -online option apparently will validate the binary for the first available app in iTunes connect, but I have not figured out how to pass a username/password to the command. However I'm guessing for continuous integration you probably only want the local validation. A: If you want only to validate the signed ipa file, there is tool to do it altool $ /Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool -h Copyright (c) 2009-2015, Apple Inc. Version 1.1 Usage: altool --validate-app -f file -t platform -u username [-p password] altool --upload-app -f file -t platform -u username -p password -f, --file Filename. -t, --type Type/Platform: osx, ios. -u, --username Username. Required to connect for validation and upload. -p, --password Password. Required if username specified. Password is read from stdin if one is not supplied. May use @keychain: or @env: prefixes followed by the keychain or environment variable lookup name. e.g. -p @env:SECRET which would use the value in the SECRET environment variable. -v, --validate-app Validate an app archive. The username, password, and file path to app archive are required. --upload-app Uploads the given app archive. The username, password, and file path to app archive are required. --output-format [xml | normal] 'xml' displays error output in a structured format; 'normal' outputs in an unstructured format (default) -h, --help Display this output. For ex. /Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool -v -f APP.ipa -u itunesconnect@user.com -p password A: There are parameters that allow you to authorise via api key xcrun altool \ --validate-app \ --file "<ipa file>" \ --apiKey "<appstore api key>" \ --apiIssuer "<appstore issuer id>"
{ "language": "en", "url": "https://stackoverflow.com/questions/7568420", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "29" }
Q: cloud and eucalyptus authentication experiment In general we can enter to eucalyptus with some credentials.but i want to have my own authentication policy of implementing.Here i would like to use key distribution center for providing the keys for confidentiality so that user can have security features.. can anybody help me? is it possible? A: You can try out the eucalyptus development branch it is having the latest code. It is available here: http://bazaar.launchpad.net/~eucalyptus-maintainers/eucalyptus/eucalyptus-devel/files In order to set it up on your system Andy's blog post can be a good reference: http://agrimmsreality.blogspot.in/2012/01/building-eucalyptus-3-devel.html http://agrimmsreality.blogspot.in/2012/01/configuring-eucalyptus-3-devel.html Hope this helps! A: The current version of Eucalyptus (2) do not have such a capabilities. With Eucalyptus 3 a feature is introduced to allow integration with LDAP or AD. Is this enough for your purposes?
{ "language": "en", "url": "https://stackoverflow.com/questions/7568422", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Is there an event in Javascript that fires when user changes tabs in browser Let me start with the problem: Chrome behaves strange when using setTimeout() if the user changes browser tabs, the executing of the Javascript is halted/pauzed. After the user changes back, Chrome wants to catch up, so the animation isn't respecting the timneout and is animating out of control. I'm trying to prevent Chrome from rushing the animation if the user comes back after a while. I've found in another question that jQuery offers a .blur & .focus event, but that doens't seem to work either: $(window).blur(function() { clearTimeout(timer) }) Is there any way to stop the animation on the exact moment that the user changes the tabs, or is there no event that gets fired just after the user changes tabs? A: In most modern browsers when a tab isn't in focus, timeout stop firing as often which is why you are seeing the animation being paused/jittering. This is intentional. There is a great mozilla article that explains how to write some logic that will handle the animations when the tab isn't in focus. It even includes a small cross-browser library called animLoop.js to help you. The examples will also work in Chrome. A: There is a Page Visibility API. Its main purpose is to notify page when user show/hide tab or window with the it. The API isn't completed, but works in several browsers including Chrome. You can read more about it in Nicholas Zakas' blog. A: I dont know how to do that with jQuery, but in pure js you can do something like this: <script> function onBlur() { clearTimeout(timer); }; if (/*@cc_on!@*/false) { // check for Internet Explorer document.onfocusout = onBlur; } else { window.onblur = onBlur; } </script> Make sure that variable timer is in visible scope.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568423", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: What winapi C function call can I use to convert unicode to ascii and vice versa? It has to work with a C program so it has to be a winapi c call A: That would be WideCharToMultiByte and MultiByteToWideChar. A: All 128 ASCII characters convert to the unicode code point with the same value (see ASCII in unicode glossary). Conversion, in C (have no idea about the other tags in your question), is as easy as assignment: unicodevalue = asciivalue; or asciivalue = unicodevalue; though you probably want to make sure that unicodevalue in the last staetement represents an ASCII character before converting. A: Here is a simple solution which comes along with CRT ; consider this if you are using Visual studio. mbstowcs and wcstombs the links have sample C++ code too.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568424", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: How can I determine why my process terminates I have a problem where during a call to a 3rd party library routine my process terminates. I am completely unable to catch this in my debugger. This may be related to this question: How can I debug a win32 process that unexpectedly terminates silently?. When I step over a call into this library, the process being debugged simply terminates. If this termination was due to an unhandled exception or memory access violation, the debugger would have caught it. So my best guess is that the process somehow terminates normally. What I have tried: * *Setting breakpoints on ExitThread and ExitProcess *Setting handlers for unhandled exceptions and invalid paramters ( set_terminate and _set_invalid_parameter_handler) *Changing _set_abort_behavior and _set_error_mode. *Instructing the debugger to stop execution on all thrown exceptions. But to no avail, none of the handlers are called and none of the breakpoint are triggered. What I have observed: When the process crashes, I see two things in the debug output window: * *Not related (see update below) I see EEFileLoadException being thrown. A quick google of this exception doesn't give me a clear answer to whar this exception means. First-chance exception at 0x7656b9bc (KernelBase.dll) in Program.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0030b5ac.. First-chance exception at 0x7656b9bc (KernelBase.dll) in Program.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.. First-chance exception at 0x7656b9bc (KernelBase.dll) in Program.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.. First-chance exception at 0x7656b9bc (KernelBase.dll) in Program.exe: 0xE0434352: 0xe0434352. *When terminating, all threads return the same error code (STATUS_INVALID_CRUNTIME_PARAMETER). This error code means, as far as I can tell, that one of the c runtime functions has received an invalid parameter and the application is terminated for security reasons. The thread 'Win32 Thread' (0x12c0) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0xe04) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x53c) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x116c) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x16e0) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x1420) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x13c4) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x40c) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0xc78) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0xd88) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x16c8) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0xcb8) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x584) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x1164) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x1550) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x474) has exited with code -1073740777 (0xc0000417). The program '[5140] Program.exe: Native' has exited with code -1073740777 (0xc0000417). What I really want to know is what causes this, and optionally; how can I catch this in the debugger? Update Regarding the EEFileLoadException, it is in fact thrown before the program makes the call which causes it to terminate, so it is not related to the termination of the process. Update I just read that set_terminate does not work in the debugger so that's out of the question. And as noted in my comment, the handlers are managed on a per-thread basis so I don't have access to the relevant handler. Also, the program most likely crashes in a worker thread which I have no access to so it is difficult to set any breakpoints/handlers at all. Is there a better way to figure out what goes wrong? A: Configure procdump to generate a dump of your process at process termination time. Not sure if VS2010 can open dump files but windbg can. Then dump all the thread stacks and you should see the one causing termination. You will then be able to inspect the stack to find the offending argument. If your app is foo.exe then run procdump from a command prompt like this: procdump -ma -t -w foo.exe -ma indicates full memory dump -t indicates write dump at process termination -w indicates to wait for the process to be launched if not already running Then run you app outside of any debugger. Once it terminates you should see output from procdump indicating that the process has terminates and that it is writing a dump file. Here's the link to procdump: http://technet.microsoft.com/en-us/sysinternals/dd996900 A: Run your application nuder debugger (or attach to a running process), press Ctrl+Alt+E and check the boxes to have debugger stop execution on exception for you. Every time an exception takes place, debugger will break. You will be able to check thread states/call stack to possibly identify the problem. Typical reasons for an app to unexpectedly terminate are: * *something really posts WM_QUIT message and this instructs the app to close *an exception takes place, and it is not handled (esp. on background thread); the exception traverses call stack up to OS and it does not know what to do with all the stuff and just kills the process As EEFileLoadException exception takes place and you don't knnow what it is about, you perhaps would want the first thing understand if it is handled or not, if it is actually a fatal thing for your application. A: I faced with the same problem before. I just deleted obj file in C# project. And rebuild again and it project worked. Hope this will solve your problem.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568425", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "10" }
Q: write the contents of application page to a file in WP7 I want to write the entire contents of my application page (eg Mainpage.xml) to a file (in Isolated Storage ) How do I do it in WP7 ? are there any methods available to parse the page contents and write it to file in windows phone 7 ? A: There is no built in way to do this. However there are a couple of approaches you could try: If the structure is static you could try and extract the resource containing this from the DLL. For future re-use it would be easier to load the page from the DLL again though. If you're generating a page (or part of a page) at runtime (based on user input/preferences) and you want to be able to save/reload this then just save enough information to be able to recreate it. It's unlikely that XAML would be the best format for this though. You could create this as you build the UI. Alternatively you could walk the visual tree to get details of all that is rendered. I'd recommend recording as you go so you can more easily keep track of non-default values in the rendered objects.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568428", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: How to get text between two Elements in DOM object? I'm using JSoup to parse this HTML content: <div class="submitted"> <strong><a title="View user profile." href="/user/1">user1</a></strong> on 27/09/2011 - 15:17 <span class="via"><a href="/goto/002">www.google.com</a></span> </div> Which looks like this in web browser: user1 on 27/09/2011 - 15:17 www.google.com The username and the website can be parsed into variables using this: String user = content.getElementsByClass("submitted").first().getElementsByTag("strong").first().text(); String website = content.getElementsByClass("submitted").first().getElementsByClass("via").first().text(); But I'm unsure of how to get the "on 27/09/2011 -15:17" into a variable, if I use String date = content.getElementsByClass("submitted").first().text(); It also contains username and the website??? A: You can always remove the user and the website elements like this (you can clone your submitted element if you do not want the remove actions to "damage" your document): public static void main(String[] args) throws Exception { Document content = Jsoup.parse( "<div class=\"submitted\">" + " <strong><a title=\"View user profile.\" href=\"/user/1\">user1</a></strong>" + " on 27/09/2011 - 15:17 " + " <span class=\"via\"><a href=\"/goto/002\">www.google.com</a></span>" + "</div> "); // create a clone of the element so we do not destroy the original Element submitted = content.getElementsByClass("submitted").first().clone(); // remove the elements that you do not need submitted.getElementsByTag("strong").remove(); submitted.getElementsByClass("via").remove(); // print the result (demo) System.out.println(submitted.text()); } Outputs: on 27/09/2011 - 15:17 A: You can then parse string that you get. String str[] = contentString.split(" "); Then you can construct the string you want like this: String str = str[1] + " " + str[2] + " - " + str[4]; This will extract you the string you need. A: Select the element before the text you wish to grab, then get its next sibling node (not element), which is a text node: Document doc = Jsoup.parse("<div class=\"submitted\">" + " <strong><a title=\"View user profile.\" href=\"/user/1\">user1</a></strong>" + " on 27/09/2011 - 15:17 " + " <span class=\"via\"><a href=\"/goto/002\">www.google.com</a></span>" + "</div> "); String str = doc.select("strong").first().nextSibling().toString().trim(); System.out.println(str); You can also ask an element for its child text nodes and index directly (though referencing the nodes by sibling is usually more robust than indexing): Document doc = Jsoup.parse( "<div class=\"submitted\">" + " <strong><a title=\"View user profile.\" href=\"/user/1\">user1</a></strong>" + " on 27/09/2011 - 15:17 " + " <span class=\"via\"><a href=\"/goto/002\">www.google.com</a></span>" + "</div> "); String str = doc.select("div").first().textNodes().get(1).text().trim(); System.out.println(str);
{ "language": "en", "url": "https://stackoverflow.com/questions/7568433", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: NodeJS: How to save facebook profile picture I am using express and nodejs and am having problems saving facebook profile pictures to my server. Location of picture: http://profile.ak.fbcdn.net/hprofile-ak-ash2/275619_223605264_963427746_n.jpg Script Being Used: var http = require('http') var fs = require('fs') var options = { host: 'http://profile.ak.fbcdn.net', port: 80, path: '/hprofile-ak-ash2/275619_223605264_963427746_n.jpg' } var request = http.get(options, function(res){ res.setEncoding('binary') var imagedata = '' res.on('data', function (chunk) {imagedata += chunk}) res.on('end', function(){ fs.writeFile('logo.jpg', imagedata, 'binary', function (err) { if(err){throw err} console.log('It\'s saved!'); }) }) }) The image saves but is empty. Console logging the image data is blank too. I followed this example origionally which does work for me. Just changing the location of the image to the facebook pic breaks the script. A: I ended up coming up with a function that worked: var http = require('http'); var fs = require('fs'); var url = require('url'); var getImg = function(o, cb){ var port = o.port || 80, url = url.parse(o.url); var options = { host: url.hostname, port: port, path: url.pathname }; http.get(options, function(res) { console.log("Got response: " + res.statusCode); res.setEncoding('binary') var imagedata = '' res.on('data', function(chunk){ imagedata+= chunk; }); res.on('end', function(){ fs.writeFile(o.dest, imagedata, 'binary', cb); }); }).on('error', function(e) { console.log("Got error: " + e.message); }); } USAGE: getImg({ url: "http://UrlToImage.com", dest: __dirname + '/your/path/to/save/imageName.jpg' },function(err){ console.log('image saved!') }) A: I know my answer is a little late, but I hope it'll help others we get to this question, so here it is: Saving the file to the root directory of your Node server can be done this way: var request = require("request"); var fs = require("fs"); var fbUserId = 4; var imageLink = "https://graph.facebook.com/"+ fbUserId +"/picture?width=500&height=500"; request(imageLink).pipe(fs.createWriteStream("resultIMG.png")) .on('close', function(){ console.log("saving process is done!"); }); Of course, you can add any path you want for the image prior the the file name string. If you still are seeing empty images, set the encoding of the request module to null , like this: var request = require("request").defaults({ encoding: null }); That should do it.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568437", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "5" }
Q: make pause between drawing two draws I want to make a pause between drawing two draws. I've tried Thread.sleep, handlers, asyncTask and got same result - when activity starts up I must wait for a time that I set to see the first draw, only when I call same method (test) again, I see second draw instead of seeing first draw again. There's my code: public void test(){ button.setClickable(false); button.setBackgroundColor(Color.DKGRAY); view.setFromAtoB(true); view.invalidate(); AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { try { Thread.sleep(2000); } catch (InterruptedException e) { } return null; } @Override protected void onPostExecute(Void result) { view.setMoveAB(true); view.postInvalidate(); button.setBackgroundColor(Color.GRAY); button.setClickable(true); } }; task.execute((Void[])null); Where's the problem? Why can't I see some kind of harmony, first draw, pause, second draw? :) Maybe I've blocked UI thread. For drawing I use canvas. In onDraw method I make some calculations and call drawRodsAndDiscs method: private void drawRodsAndDiscs(Canvas canvas){ Paint paint = new Paint(); drawRods(canvas); paint.setColor(Color.GREEN); paint.setStyle(Paint.Style.STROKE); for (Rect disc : discs) { canvas.drawRect(disc, paint); } } A: Try to use a simple CountDownTimer instead of Thread.sleep(int miliseconds); refer this : A: For a simple one-off delay you can use a Handler instead: Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { view.setMoveAB(true); view.invalidate(); button.setBackgroundColor(Color.GRAY); button.setClickable(true); } }, 2000); A: I would use this code for your problem. When the timer is finished it is automagically restarted. Try this: private boolean running = false; private Handler handler; public void onCreate(Bundle savedInstanceState) { handler = new Handler(this.getMainLooper()); //Run it in MainLooper this.handler.postDelayed(this.counterThread, 200); //Start timer in 200ms } private Thread counterThread = new Thread() { public void run() { if (isRunning()) { return; } setRunning(true); // 10minute until finish, 200ms between ticks CountDownTimer ct = new CountDownTimer(10 * 60 * 1000, 200) { public void onFinish() { setRunning(false); } public void onTick(long time) { //Do your shitznaz } }; ct.start(); } }; protected boolean isRunning() { return this.running; } protected void setRunning(boolean b) { this.running = b; if (!b) { // Reset timer this.handler.postDelayed(this.counterThread, 200); //Restarts the timer in 200ms } }
{ "language": "en", "url": "https://stackoverflow.com/questions/7568446", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Rails's link_to return url with dot instead of slash Rails 3.0.9 with haml gem & Ruby 1.9.2-head with rvm I have order resource. Fragment of routes.rb file resources :orders The call link_to helper with instance of the Order model return /order.2 instead of /orders/2. Fragment of order_controller.rb and index.html.haml #index.haml.html %ul - @orders.each do |item| %li= link_to item.id, item #=> <a href="/order.2">2</a> instead of <a href="/orders/2">2</a> #orders_controller.rb def index @orders = Order.all end What I do wrong? I also have another resources but they work fine. Update: Listing of my routes.rb file YetApp::Application.routes.draw do resources :categories, :products, :images, :orders, :small_images match "/order", :to => "orders#new", :as=> 'order' match "/success/:id", :to => "orders#success", :as=> 'order' #namespace :signed do # resources :products, :images, :categories #end root :to => 'pages#home' match '/signed', :to => 'pages#signed', :as => 'signed' match '/cooperation', :to => 'pages#cooperation', :as => 'cooperation' match '/payment', :to => 'pages#payment', :as => 'payment' match '/offer', :to => 'pages#offer', :as => 'offer' match '/order', :to => 'pages#order', :as => 'order' end A: I think you should remove the match '/order', :to => ... from your routes file.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568447", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: Splitting content into 2 columns CSS I am trying to split the content into 2 columns using the below CSS .container2 {width: 320px; height: 100px; display: block;} .image2 {border: 1px solid #F2F3F4; float: left; height: 50px; margin-right: 6px; padding: 1px; width: 50px;} .image2 img { height: 50px; width: 50px;} .text2 {width: 230px; height: 100px; float:left; font-size: 13px;} .clear2 {clear: both;} here is my page http://www.applicationcatalyst.com/columns/ (but the content is in single column) Now I would like to know what extra I need to add in the CSS code to make the content split into 2 columns Thanks A: You should do the following: Put the following div in one div with class 'ColumnDiv' or something. (image2 & text2) so you have this: <div class="ColumnDiv"> <div class="image2"> <img src="http://www.applicationcatalyst.com/storage/other/cakehealth.png"/> </div> <div class="text2">Track and Optimize Your Healthcare.</div> </div> <div class="ColumnDiv"> <div class="image2"> <img src="http://www.applicationcatalyst.com/storage/other/greengoose.png"/> </div> <div class="text2">Farmville for real life, with wireless sensors.</div> </div> <div class="clear2"/> and in css you need to put the following: .ColumnDiv { float:left; } Now your divs will show next to each other. And i guess .clear2 is for evening out the length of both columns. A: If you don't want to make any changes to the HTML, you can do it by doing the following: * *Increasing the width of .container2 to hold both content blocks side by side. *Removing the clear: both from .clear2. This allows the content blocks to float next to each other. The changed rules are below: .container2 { width: 640px; height: 100px; display: block; } .clear2{ clear: none; } What you'll then see is that your 2 columns aren't properly centered in the main content area. To fix this, you'll need to update the following 2 CSS rules to give them space: #sidebar2Wrapper { display: none; } #contentWrapper { width: 800px; }
{ "language": "en", "url": "https://stackoverflow.com/questions/7568448", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: as3 Number type - Logic issues with large numbers I'm curious about an issue spotted in our team with a very large number: var n:Number = 64336512942563914; trace(n < Number.MAX_VALUE); // true trace(n); // 64336512942563910 var a1:Number = n +4; var a2:Number = a1 - n; trace(a2); // 8 Expect to see 4 trace(n + 4 - n); // 8 var a3:Number = parseInt("64336512942563914"); trace(a3); // 64336512942563920 n++; trace(n); //64336512942563910 trace(64336512942563914 == 64336512942563910); // true What's going on here? Although n is large, it's smaller than Number.MAX_VALUE, so why am I seeing such odd behaviour? I thought that perhaps it was an issue with formatting large numbers when being trace'd out, but that doesn't explain n + 4 - n == 8 Is this some weird floating point number issue? A: Yes, it is a floating point issue, but it is not a weird one. It is all expected behavior. Number data type in AS3 is actually a "64-bit double-precision format as specified by the IEEE Standard for Binary Floating-Point Arithmetic (IEEE-754)" (source). Because the number you assigned to n has too many digits to fit into thos 64 bits, it gets rounded off, and that's the reason for all the "weird" results. If you need to do some exact big integer arithmetic, you will have to use a custom big integer class, e.g. this one. A: Numbers in flash are double precision floating point numbers. Meaning they store a number of significant digits and and exponent. It favors a larger range of expressible numbers over the precision of the numbers due to memory constraints. At some point, numbers with a lot of significant digits, rounding will occur. Which is what you are seeing; the least significant digits are being rounded. Google double precision floating point numbers and you'll find a bunch of technical information on why. It is the nature of the datatype. If you need precise numbers you should really stick to uint or int based integers. Other languages have fixed point or bigint number processing libraries (sometimes called BigInt or Decimal) which are wrappers around ints and longs to express much larger numbers at the cost of memory consumption. A: We have an as3 implementation of BigDecimal copied from Java that we use for ALL calculations. In a trading app the floating point errors were not acceptable. A: To be safe with integer math when using Numbers, I checked the AS3 documentation for Number and it states: The Number class can be used to represent integer values well beyond the valid range of the int and uint data types. The Number data type can use up to 53 bits to represent integer values, compared to the 32 bits available to int and uint. A 53 bit integer gets you to 2^53 - 1, if I'm not mistaken which is 9007199254740991, or about 9 quadrillion. The other 11 bits that help make up the 64 bit Number are used in the exponent. The number used in the question is about 64.3 quadrillion. Going past that point (9 quadrillion) requires more bits for the significant number portion (the mantissa) than is allotted and so rounding occurs. A helpful video explaining why this makes sense (by PBS Studio's Infinite Series). So yeah, one must search for outside resources such as the BigInt. Hopefully, the resources I linked to are useful to someone. A: This is, indeed, a floating point number approximation issue. I guess n is to large compared to 4, so it has to stick with children of its age: trace(n - n + 4) is ok since it does n-n = 0; 0 + 4 = 4; Actually, Number is not the type to be used for large integers, but floating point numbers. If you want to compute large integers you have to stay within the limit of uint.MAX_VALUE. Cheers!
{ "language": "en", "url": "https://stackoverflow.com/questions/7568449", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: iPhone : How to create expanadable table view? I want to create expandable table view. I found one link which is same as I want. But I want to create my own table view (Dont want to implements this github code). How do I achieve this type of functionality ? A: See this nice tutorial: Table View Animations and Gestures Demonstrates how you can use animated updates to open and close sections of a table view for viewing, where each section represents a play, and each row contains a quotation from the play. It also uses gesture recognizers to respond to user input: * A UITapGestureRecognizer to allow tapping on the section headers to expand the section; * A UIPinchGestureRecognizer to allow dynamic changes to the height of table view rows; and * A UILongPressGestureRecognizer to allow press-and-hold on table view cells to initiate an email of the quotation. A: I came across similar feature, to build it a rough algorithm will be: * *implement the uitableviewdelgate and uitableviewdatasource protocols *create a global variable expandedSectionIndex = -1; = -1 represents all collapsed. = 0 represents expandedSectionIndex. //the following protocol definitions will take care of which section is to be expanded. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if(expandedSectionIndex == section) return [self.dataArray[section] count]; else return 0; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if(self.dataArray) return [self.dataArray count]; } define custom header views in – tableView:viewForHeaderInSection: * *buttons having frame equivalent to header view frame *set button tag property with value of section number. *associate all buttons with selector - (void)expand:(id) sender; - (void)expand:(id) sender { expandedSectionIndex = [sender tag]; [self.tableView reload]; } for more detail enter link description here
{ "language": "en", "url": "https://stackoverflow.com/questions/7568450", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Getting web content - browser does not support frames I have a snippet of code like this: webUrl = new URL(url); reader = new BufferedReader(new InputStreamReader(webUrl.openStream())); When I try to get html content of some page I get response that my browser doesn't support frames. So I do not get the real html of the page. Is there a workaround? Maybe to tell to the program to register as some browser? For me it is critical only to get the html, then I want to parse it. EDIT: Can not get src of the frame from the html in browser. It is hidden in js. A: The "You don't support frames and we haven't put sensible alternative content here" message will be in the <noframes> element. You need to access the appropriate <frame> element, access its src attribute, resolve the URI in it, and then fetch data from there. A: You must set a user-agent string in your HTTP request, so that the server thinks you are supporting frames. I suggest something like HtmlClient or HttpClient for this.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568457", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Default schema for a user Default schema for a user. Its mean, whenever I execute a select query without pointing any schema, it uses the schema which is set as default (I read somewhere). For Some reason I have change the default schema for a user. Now select statement should be point default schema, But it’s not working. Please have a look below code. CREATE SCHEMA Schema_1 CREATE SCHEMA Schema_2 GO Create table Schema_1.TEST (DATA Varchar(200)) Create table Schema_2.TEST (DATA Varchar(200)) GO insert into Schema_1.TEST values('Schema_1 IS HERE') insert into Schema_2.TEST values('Schema_2 IS HERE') GO CREATE proc Schema_1.TestSP AS SELECT * FROM TEST ---[no schema name given] GO exec Schema_1.Testsp After this code I have created two users USER_1 and USER_2. USER_1 default schema is Schema_1 and USER_2 default schema is Schema_2. I have executed Schema_1.Testsp SP. It gives Schema_1 IS HERE Now I set Schema_2 as default schema for USER_1 Again, I have executed Schema_1.Testsp SP. It gives Schema_1 IS HERE But it need result Schema_2 IS HERE. I think you got my point. A: I think your problem is the proc is running from schema1 and that is what it uses to determine the schema of any underlying objects that are not specified.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568458", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Animation on UIButton Click in iPhone Everybody.. How to set animation on button click ? I have two buttons, both have different frame.. First CGRectMake (10 , 10 , 100 , 80 ); It has Black Image, Second CGRectMake (200, 10 , 210 , 80 ); It has White Image, When I click on First button of those, It should be animate to move from one frame to another frame.. Only seen like first's button Black Image move to second button location.. Like Image changes of Buttons.. After clicked button frame does not change... Should be remain as First and Second.. I have tried but not got the exact buttonFirst.frame = buttonSecond.frame; buttonFirst.center = buttonSecond.center; buttonFirst.transform = CGAffineTransformMakeTranslation( buttonSecond.frame.origin.x - buttonFirst.frame.origin.x , buttonSecond.frame.origin.y - buttonFirst.frame.origin.y); How to animate this ? Editting : I need to move one checkers from one CGRect to Another CGRect.. So, It want to display like moving checkers, But i dont want to change CGRect, Only button images looks like that... Please tell me.. Thanks... A: well.. you can try this link [UIView beginAnimation/endAnimation] bock A: Here is example from working program: [self.buttonFirst setUserInteractionEnabled:NO]; [UIView transitionWithView:self.buttonFirst duration:1.0 options:UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionCurveLinear animations:^{ buttonFirst.frame = buttonSecond.frame; buttonFirst.center = buttonSecond.center; } completion:^(BOOL finished){ [self.buttonFirst setUserInteractionEnabled:YES]; }]; A: CGRect oldRectFirst = buttonFirst.frame; CGRect oldRectSecond = buttonSecond.frame; [UIView animateWithDuration:0.2f animations:^{ buttonFirst.frame = oldRectSecond; buttonSecond.frame = oldRectFirst; }]; A: very simple logic [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.20f]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [UIView setAnimationBeginsFromCurrentState:YES]; [firstButton setFrame:CGRectMake(5, 50, 30, 30)];//moves to second button place [secondButton setFrame:CGRectMake(5, 5, 30, 30)];//moves to first button place [UIView commitAnimations]; use the logic accordingly to your use.. A: Finally i got the answer... I have set two button in two separate view. after set one timer, and move first button image to another button's position.. Here is a sample code for that.. Step 1 : Set view with Timer UIView *oldView = [[UIView alloc] init]; oldView = [viewArray objectAtIndex:selectedIndex]; UIView *newView = [[UIView alloc] init]; newView = [viewArray objectAtIndex:[sender tag]]; oldRect = [oldView frame]; newRect = [newView frame]; movingTimer = [[NSTimer alloc] init]; movingTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(movingCheckers:) userInfo:nil repeats:YES]; imageViewMove = [[UIImageView alloc] init]; [imageViewMove setFrame:oldRect]; [imageViewMove setImage:[UIImage imageNamed:blackManName]]; [self.view bringSubviewToFront:imageViewMove]; [self.view addSubview:imageViewMove]; Step 2 : Moving Image to second position CGPoint aPoint = CGPointMake(newRect.origin.x - oldRect.origin.x, oldRect.origin.y - newRect.origin.y); imageViewMove.frame = CGRectMake(imageViewMove.frame.origin.x + (aPoint.x / 6) , imageViewMove.frame.origin.y - (aPoint.y / 6), imageViewMove.frame.size.width, imageViewMove.frame.size.height); if (imageViewMove.frame.origin.x >= newRect.origin.x) { [selectButton setBackgroundImage:nil forState:UIControlStateNormal]; [moveButton setBackgroundImage:imageViewMove.image forState:UIControlStateNormal]; [imageViewMove removeFromSuperview]; [movingTimer invalidate]; } Now its work.....
{ "language": "en", "url": "https://stackoverflow.com/questions/7568464", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Android - Issue dealing with static method (?) and the last step This is really doing my head in, I have been following these instructions but it won't work. Step three is causing me trouble. I'm note sure exactly what needs to be added where. It says; "In the onCreate() method of your app instance, save your context (e.g. this) to a static >field named app and create a static method that returns this field, e.g. getApp():" But I only have this at the top of my main java file: protected static final String App = null; The error I get is on this line, it says "The method getContext() is undefined for the type String": String[] items = App.getContext().getResources().getStringArray(testholderint); I figure the issues is with not following step three, and was wondering what exactly I need to add. Once I've got this rectified my project is basically finished... A: I think this line protected static final String App = null; shouldn't appear at all. The link you provided tells you to create a subclass of your application, like public class App extends Application { ... } In this subclass you should put the onCreate() and getContext() methods indicated in the code provided at that link. After doing so your last line (String[] items...) should work just fine.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568467", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "-1" }
Q: Pass Nothing from Javascript to VBScript in IE9 I have a framework written in VBScript. Inside some function in this framework, a parameter of the function is checked for Nothing in an If statement and then some actions are executed. Code that uses the framework is written in JavaScript. So I need to pass Nothing to the function to perform some actions. In Internet Explorer 8 and earlier versions, the following approach worked: <script type="text/vbscript"> Function Test(val) If (IsNull(val)) Then Test = "Null" ElseIf (IsObject(val)) Then If (val Is Nothing) Then Test = "Nothing" End If End If End Function Dim jsNothing Set jsNothing = Nothing msgBox(Test(jsNothing)) msgBox(Test(Null)) </script> <script type="text/javascript"> alert(Test(jsNothing)); </script> In Internet Explorer before version 9, the output will: Nothing, Null, Nothing. In Internet Explorer 9: Nothing, Null, Null. How can I pass Nothing from JavaScript to VBScript in Internet Explorer 9? There is an example of a framework function. I can not change it, because it is widely used in application. Function ExampleFunction(val) If (val Is Nothing) Then ExampleFunction = 1 Else ExampleFunction = 0 End If End Function A: I don't have access to Internet Explorer right now, so I can't test this, but try to write a function like this: <script type="text/vbscript"> Function CallWithNulls(fn, arg1, arg2, arg3) If (isNull(arg1)) arg1 = Nothing If (isNull(arg2)) arg2 = Nothing If (isNull(arg3)) arg3 = Nothing fn(arg1, arg2, arg3) End Function Function IsNothing(arg1, arg2, arg3) return arg1 is Nothing End Function </script> <script type="text/javascript"> alert(CallWithNulls(IsNothing, null, 1, 2)); </script> Of course, I don't know if VBScript allows calling functions like that... and you'd have to deal with more/fewer arguments. A: Unfortunately, you are probably stuck here - JavaScript does not have a "Nothing" equivalent. See this article for more information. However, the following may work. In your VBScript code, create a function called "GetNothing" that returns "Nothing". In your JavaScript code, use "var jsNothing = GetNothing()". It comes from this article. A: Use a value such as zero or even a negative number. That would allow for you to simply use falsy evaluations, and then you don't have to worry about different browsers and their quirks in evaluating the NULL object. A: As an example, something like this will work, but if the browser is Internet Explorer 11 or later you will need the 'meta' tag. <html> <head> <meta http-equiv="x-ua-compatible" content="IE=10"> <title>Pass JavaScript to VBScript</title> <script> var val = "null"; window.alert("Test: " + val); </script> <script type="text/vbscript"> PassNothing(val) Sub PassNothing(value) If LCase(value) = "null" Then MsgBox "Java passed 'null' so VBScript = 'Nothing'" Else Msgbox "Nothing received" End If End Sub </script> </head> </html>
{ "language": "en", "url": "https://stackoverflow.com/questions/7568471", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "127" }
Q: How can I solve this MDX Problem? I want to be comparing the previous and current values, but my MDX query is giving the following error "The CURRENTMEMBER function expects a hierarchy expression for the 1 argument." How can I solve this problem? My MDX query is below. please help with member [Measures].[Growth] as ([Date].[Calendar].[Month].CurrentMember,[Measures].[Internet Sales Amount])-([Date].[Calendar].[Month].CurrentMember.PrevMember,[Measures].[Internet Sales Amount]) select {[Measures].[Internet Sales Amount],[Measures].[Growth] } on columns, {([Date].[Calendar].[Month].Members)} on rows FROM [Adventure Works] A: Change your member statement to the following: with member [Measures].[Growth] as ([Date].[Calendar].CurrentMember,[Measures].[Internet Sales Amount])-([Date].[Calendar].CurrentMember.PrevMember,[Measures].[Internet Sales Amount]) The currentmember function works off of a hiearchy.
{ "language": "en", "url": "https://stackoverflow.com/questions/7568472", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }