Search Results

Search found 4489 results on 180 pages for 'black cobra'.

Page 156/180 | < Previous Page | 152 153 154 155 156 157 158 159 160 161 162 163  | Next Page >

  • Center text inside a circle on a canvas

    - by jax
    I have the coordinates of the center of a circle where I need to draw some text. The circle may be larger or smaller depending on the attributes I have specified. I have set the center horizontally using mTextBrush.setTextAlign(Align.CENTER);. The problem is that I can't figure out a way to center the text vertically. (See "Draw the counter" below) //Text Brush setup mTextBrush = new Paint(Paint.ANTI_ALIAS_FLAG); mTextBrush.setColor(Color.BLACK); mTextBrush.setTextSize(1/10*mMaxSize); mTextBrush.setTextAlign(Align.CENTER); mTextBrush.setStyle(Paint.Style.STROKE); private void drawSmallTimer(Canvas canvas) { //Variable cache int radiusLocalCache = this.mRadius; int cx = radiusLocalCache+(radiusLocalCache/2); int cy = radiusLocalCache-(radiusLocalCache/2); int radius = radiusLocalCache/3; //Draw the background circle canvas.drawCircle(cx, cy, radius, mBackgroundBrush); //Draw the outline stroke canvas.drawCircle(cx, cy, radius, mStrokeBrush); //Draw the counter String text = String.valueOf(mCounter); canvas.drawText(text, cx, cy, mTextBrush); }

    Read the article

  • Determining two lines in MATLAB

    - by Sanyi
    Hi! I am making the game planarity in MATLAB, and i am stuck where the program have to determine that is there any lines that are in inscision with each other. Any ideas how could the program find the inscision points. Heres my source for the game: > clear; clc; a=1; b=10; x=floor(rand(5,1)*(b-a+1)+a); y=floor(rand(5,1)*(b-a+1)+a); fig1=figure; set(fig1,'Color','w','Position',[100 100 500 500]) plot(x,y,'o','MarkerSize',12,'MarkerFaceColor','r'); axis([0 11 0 11]); axis off grid on; hold on; FirstPlayerLines=[]; SecondPlayerLines=[]; for a1=1:+1:2 for a2=5:-1:2 plot([x(a1) x(a2)],[y(a1) y(a2)],'Color','black','LineWidth',3); end end waitforbuttonpress

    Read the article

  • Java Graphics not displaying on successive function calls, why?

    - by primehunter326
    Hi, I'm making a visualization for a BST implementation (I posted another question about it the other day). I've created a GUI which displays the viewing area and buttons. I've added code to the BST implementation to recursively traverse the tree, the function takes in coordinates along with the Graphics object which are initially passed in by the main GUI class. My idea was that I'd just have this function re-draw the tree after every update (add, delete, etc...), drawing a rectangle over everything first to "refresh" the viewing area. This also means I could alter the BST implementation (i.e by adding a balance operation) and it wouldn't affect the visualization. The issue I'm having is that the draw function only works the first time it is called, after that it doesn't display anything. I guess I don't fully understand how the Graphics object works since it doesn't behave the way I'd expect it to when getting passed/called from different functions. I know the getGraphics function has something to do with it. Relevant code: private void draw(){ Graphics g = vPanel.getGraphics(); tree.drawTree(g,ORIGIN,ORIGIN); } vPanel is what I'm drawing on private void drawTree(Graphics g, BinaryNode<AnyType> n, int x, int y){ if( n != null ){ drawTree(g, n.left, x-10,y+10 ); if(n.selected){ g.setColor(Color.blue); } else{ g.setColor(Color.gray); } g.fillOval(x,y,20,20); g.setColor(Color.black); g.drawString(n.element.toString(),x,y); drawTree(g,n.right, x+10,y+10); } } It is passed the root node when it is called by the public function. Do I have to have: Graphics g = vPanel.getGraphics(); ...within the drawTree function? This doesn't make sense!! Thanks for your help.

    Read the article

  • Does anyone know why jquery dialog is showing stale content on ajax update ?

    - by oo
    I have a series of links and when i click on a link i want to show a dialog with detail information. This detail is returned from an jquery ajax request. I am using the following code below to show a partial result through ajax onto a jquery dialog. Here is the jquery code: $(document).ready(function() { $('a.click').live('click', function() { var url = '/Tracker/Info?id=' + $(this).attr("id"); var dialogOpts = { modal: true, bgiframe: true, autoOpen: false, height: 600, width: 450, overlay: { opacity: 0.7, background: "black" }, draggable: true, resizeable: true, open: function() { //display correct dialog content $("#dialogDiv").load(url); } }; $("#dialogDiv").dialog(dialogOpts); //end dialog $("#dialogDiv").dialog("open"); }); }); Here is my controller action code: public ActionResult Info(int id) { return PartialView("LabelPartialView", _Repository.GetItem(id)); } Here is the issue: When i click this the first time (lets say i send id = 1234) it works fine. When i click on another item (lets say i send id = 4567) it shows the content from 1234 still. Which i click this second item again (again its 4567), then it will show the content from 4567. Does anyone know why it might not be refreshed the first time? Is this a timing issue?

    Read the article

  • IE7 (sometimes) not showing website properly

    - by Ra y Mon
    We are a bit desperate... We have launched our website http://www.buscounviaje.com We tested all browsers (IE6-8, Firefox, Safari, Chrome, ...) to make sure everything was OK. However, there are some users (IE7 and IE6) that are complaining that they see everything 'white' with black letters (i.e. CSS styles not being applied). One user said he was getting an "Error 0: Object expected" However, we do not see that error in Firebug, nor on our local installations of IE6&7. Other users with IE6&7 are also visualizing the web correctly. We have no idea where the problem could be, and we cannot test it because our IE6&7 work fine. Anyone sees the web page without styles and give us a hint on where the problem might be? Reasons we can think of... we are compressing js and css and some versions of IE6&7 are not able to decompress them we are trying to use a non-existing object in javascript and some versions of IE6&7 do not like it the cache does not seem to be the problem... we guided a user through emptying his cache and he could still not see the web site correctly.

    Read the article

  • Image rotate opecv error

    - by avd
    When I use this code to rotate the image, the destination image size remains same and hence the image gets clipped. Please provide me a way/code snippet to resize accordingly (like matlab does in imrotate) so that image does not get clipped and outlier pixels gets filled with all white instead of black. void imrotate(std::string imgPath,std::string angleStr,std::string outPath) { size_t found1,found2; found1=imgPath.find_last_of('/'); found2=imgPath.size()-4; IplImage* src=cvLoadImage(imgPath.c_str(), -1);; IplImage* dst; dst = cvCloneImage( src ); int angle = atoi(angleStr.c_str()); CvMat* rot_mat = cvCreateMat(2,3,CV_32FC1); CvPoint2D32f center = cvPoint2D32f( src->width/2, src->height/2 ); double scale = 1; cv2DRotationMatrix( center, angle, scale, rot_mat ); cvWarpAffine( src, dst, rot_mat); char angStr[4]; sprintf(angStr,"%d",angle); cvSaveImage(string(outPath+imgPath.substr(found1+1,found2-found1-1)+"_"+angStr+".jpg").c_str(),dst); cvReleaseImage(&src); cvReleaseImage(&dst); cvReleaseMat( &rot_mat ); } Original Image: Rotated Image:

    Read the article

  • Is there any way to configure what reCAPTCHA is actually displaying?

    - by trejder
    Is there any way to control, what kind of image is displayed to user in reCAPTCHA or what kind of puzzle he/she is required to solve? I noticed at least two significant changes to what reCAPTCHA is serving (and I must admit, that I don't much like these changes): For years reCAPTCHA was serving two words from scanned books and user was required to solve one of them. They were clearly readable (even those "second" ones, that could be ommitted) and with nearly no problem in solving them by a human. For past few month, I noticed a significant change at all of my sites, that are using reCAPTCHA. They started to show combination of computer-generated long numbers string and something, that looks for me as street/house number photographed in Google StreetView. They're even easier to solve, but what is most important -- it started to happen more and more often that user is obligated to solve both of them. Now, I have noticed another change/regression. Now some of my sites remain at so called "level 2" (like above) and some of them started to serve two words again ("level 1"?). And again, there are more and more situations, where solving both words is required. But, what is most important, on this "level" words are nearly impossible to solve (on my old mobile devices with 3.5'' display I need 5-6 attempts to pass on!). They're cluttered, written in some strange font, mostly in italics with a lot of black and white stains or drops on letters etc. Plus: reCAPTCHA stopped to be equal -- some of my pages are still serving "level2" while some of them are "killing" end users with a need to solve "level3". Is there anyway, I can control this -- force it to use only "level2" and on all my pages? (of course, I'm using exactly the same piece of code to serve reCAPTCHA on all my pages) Note, that I'm not asking for something like in this question. I don't want to change what reCAPTCHA shows (to disable words in favor of only numbers for example). I only want to control, which "version" of puzzles (among described above) reCAPTCHA shows and I want to make it equal on all my sites.

    Read the article

  • Best way to limit results in MySQL with user subcategories

    - by JM4
    I am trying to essentially solve for the following: 1) Find all users in the system who ONLY have programID 1. 2) Find all users in the system who have programID 1 AND any other active program. My tables structures (in very simple terms are as follows): users userID | Name ================ 1 | John Smith 2 | Lewis Black 3 | Mickey Mantle 4 | Babe Ruth 5 | Tommy Bahama plans ID | userID | plan | status --------------------------- 1 | 1 | 1 | 1 2 | 1 | 2 | 1 3 | 1 | 3 | 1 4 | 2 | 1 | 1 5 | 2 | 3 | 1 6 | 3 | 1 | 0 7 | 3 | 2 | 1 8 | 3 | 3 | 1 9 | 3 | 4 | 1 10 | 4 | 2 | 1 11 | 4 | 4 | 1 12 | 5 | 1 | 1 I know I can easily find all members with a specific plan with something like the following: SELECT * FROM users a JOIN plans b ON (a.userID = b.userID) WHERE b.plan = 1 AND b.status = 1 but this will only tell me which users have an 'active' plan 1. How can I tell who ONLY has plan 1 (in this case only userID 5) and how to tell who has plan 1 AND any other active plan? Update: This is not to get a count, I will actually need the original member information, including all the plans they have so a COUNT(*) response may not be what I'm trying to achieve.

    Read the article

  • How to make dialog to look like ICS theme

    - by Naruto
    from service i'm creating a dialog via a dummy activity. Here i'm able to see black background, overall the theme of dialog looks like Android V 2.2. My application minimum API level is 8, if i use holo theme it says i need min api level as 14. Here is the code i used to create dialog. How to get ICS theme dialog. public class PreviewDialog extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Show the popup dialog showDialog(0); } @Override protected Dialog onCreateDialog(int id) { super.onCreateDialog(id); // Build the dialog AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("ALARM REMINDER"); alert.setMessage("Its time for the alarm "); alert.setCancelable(false); alert.setPositiveButton("Dismiss", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { GoogleTaskPreviewDialog.this.finish(); } }); // Create and return the dialog AlertDialog dlg = alert.create(); return dlg; } } MY manifest file entry <activity android:name="PreviewDialog" android:theme="@android:style/Theme.Translucent.NoTitleBar"></activity>

    Read the article

  • ASP Chart Control doesn't ahow anything

    - by Esabe
    Hi everyone, I am using the new ASP control "Chart", but I have some problems with it: I can't see anything when I execute the aspx. The data is binded to a ObjectDataSource, like this: <asp:Chart ID="RcrBufferChart" runat="server" Visible="true" DataSourceID="RcrBufferSizeODS" BackColor="WhiteSmoke" BackGradientStyle="TopBottom" BackSecondaryColor="White" Palette="BrightPastel" BorderDashStyle="Solid" BorderColor="26, 59, 105" Height="583px" Width="1159px" > <borderskin skinstyle="Emboss"></borderskin> <series> <asp:series Name="Series1" ChartType="Spline" ShadowColor="Black" BorderColor="180, 26, 59, 105" Color="224, 64, 10" IsValueShownAsLabel="True" XValueMember="CreationDate" XValueType="DateTime" YValueMembers="Size" YValueType="Double"></asp:series> </series> <chartareas> <asp:ChartArea Name="ChartArea1"> <AxisY Title="Tamaño RCR sin enviar"> </AxisY> <AxisX Title="Fecha"> </AxisX> </asp:ChartArea> </chartareas> </asp:Chart> <asp:ObjectDataSource ID="RcrBufferSizeODS" runat="server" SelectMethod="GetByAppliance" TypeName="Esabe.Grazalema.Business.RcrBufferSizes"> <SelectParameters> <asp:QueryStringParameter Name="serialNumber" QueryStringField="SerialNumber" Type="String" /> </SelectParameters> </asp:ObjectDataSource> but the result I get is the following: Does anyone know why it isn't showing anything? Thanks a lot in advance!!

    Read the article

  • comparing value with array value problem Javascript

    - by Java starter
    This code is what I use now, it dos not work when I trie to use an array to compate values. If anybody has any idea of why, please respond. <html> <head> <script type-'text/javascript'> function hovedFunksjon() { //alert("test av funksjon fungerte"); //alert(passordLager); window.open("index10.html","Window1","menubar=no,width=430,height=360,toolbar=no"); } function inArray(array, value) { for (var i = 0; i < array.length; i++) { if (array[i] == value) return true; } return false; } function spørOmPassord() { var passordLager = ["pass0","pass1","pass2"]; window.passordInput = prompt("password");//Ved å bruke "window." skaper man en global variabel //if (passordInput == passordLager[0] || passordLager[1] || passordLager[2]) if (inArray(passordLager,passorInput) ) { hovedFunksjon(); } else { alert("Feil passord"); //href="javascript:self.close()">close window } } function changeBackgroundColor() { //document.bgColor="#CC9900"; //document.bgColor="YELLOW" document.bgColor="BLACK" } </script> </head> <body> <script type-'text/javascript'> changeBackgroundColor(); </script> <div align="center"> <form> <input type = "button" value = "Logg inn" onclick="spørOmPassord()"> </form> </div> </body> </html>

    Read the article

  • Binding lineargradientbrush color with property

    - by user1629894
    I have a problem with color in gradientstop. I want binding offset color with my property that return color (System.Windows.Media), but not working and return defalt color Transparent. If binding same property with Foreground Label is working. This style is in ResourceDictionary. <Style TargetType="{x:Type TabControl}"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush StartPoint="0 0" EndPoint="0 1"> <LinearGradientBrush.GradientStops> <GradientStop Offset="0.1" Color="Black" /> <GradientStop Offset="1" Color="{Binding Path=MyColor}" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Setter.Value> </Setter> </Style> and it's working: <Style TargetType="{x:Type Label}"> <Setter Property="Foreground" Value="{Binding Path=MyColor, Converter={StaticResource ColorToBrush}}" /> </Style> my property is: public Color MyColor { set { myColor = value; NotifyPropertyChanged("MyColor"); } get { return myColor; } } Thank you everybody for answers

    Read the article

  • White-box testing in Javascript - how to deal with privacy?

    - by Max Shawabkeh
    I'm writing unit tests for a module in a small Javascript application. In order to keep the interface clean, some of the implementation details are closed over by an anonymous function (the usual JS pattern for privacy). However, while testing I need to access/mock/verify the private parts. Most of the tests I've written previously have been in Python, where there are no real private variables (members, identifiers, whatever you want to call them). One simply suggests privacy via a leading underscore for the users, and freely ignores it while testing the code. In statically typed OO languages I suppose one could make private members accessible to tests by converting them to be protected and subclassing the object to be tested. In Javascript, the latter doesn't apply, while the former seems like bad practice. I could always wall back to black box testing and simply check the final results. It's the simplest and cleanest approach, but unfortunately not really detailed enough for my needs. So, is there a standard way of keeping variables private while still retaining some backdoors for testing in Javascript?

    Read the article

  • DIV inside TD to make it appear correctly

    - by Daniel Svensson
    Hi, I have a <table> generated from code-behind and now facing a problem. In one of the TD i need to have a DIV that is setup with JQuery so that when i click a link the DIV slideToggles. Now i need the TD belonging to that TR not to expand the TR. To solve this i have used an old trick that is to place the JQuery DIV inside another surrounding DIV with height 1px and make the TR not expanding with the heigth of the DIV that slides out. In IE the sliding DIV is partially under the table and in Firefox the DIV appears over the table but it's trasparent, the text from the data in the table shows thru. I have tried to alter the Z-index in various ways but it's no good. Anyone that has an idea or alternatively solution that has worked for them. HtmlGenericControl containerDiv = new HtmlGenericControl("div"); containerDiv.ID = "containerDiv"; containerDiv.Style.Add(System.Web.UI.HtmlTextWriterStyle.Width, "100%"); containerDiv.Style.Add(System.Web.UI.HtmlTextWriterStyle.Height, "1px"); containerDiv.Style.Add(System.Web.UI.HtmlTextWriterStyle.ZIndex, "999"); HtmlGenericControl innerDiv = new HtmlGenericControl("div"); innerDiv.ID = System.Guid.NewGuid().ToString() + "_annualDiv"; inner.Style.Add(System.Web.UI.HtmlTextWriterStyle.Width, "100%"); innerDiv.Style.Add(System.Web.UI.HtmlTextWriterStyle.Height, "300px"); innerDiv.Style.Add(System.Web.UI.HtmlTextWriterStyle.ZIndex, "1000"); innerDiv.Style.Add(System.Web.UI.HtmlTextWriterStyle.BorderStyle, "solid"); innerDiv.Style.Add(System.Web.UI.HtmlTextWriterStyle.BorderColor, "Black"); innerDiv.Style.Add(System.Web.UI.HtmlTextWriterStyle.BorderWidth, "1px"); innerDiv.Style.Add(System.Web.UI.HtmlTextWriterStyle.BackgroundColor, "white"); innerDiv.InnerHtml = "Here is a list of links coming later"; conDiv.Controls.Add(innerDiv);

    Read the article

  • Starting a process synchronously, and "streaming" the output

    - by Benjol
    I'm looking at trying to start a process from F#, wait till it's finished, but also read it's output progressively. Is this the right/best way to do it? (In my case I'm trying to execute git commands, but that is tangential to the question) let gitexecute (logger:string->unit) cmd = let procStartInfo = new ProcessStartInfo(@"C:\Program Files\Git\bin\git.exe", cmd) // Redirect to the Process.StandardOutput StreamReader. procStartInfo.RedirectStandardOutput <- true procStartInfo.UseShellExecute <- false; // Do not create the black window. procStartInfo.CreateNoWindow <- true; // Create a process, assign its ProcessStartInfo and start it let proc = new Process(); proc.StartInfo <- procStartInfo; proc.Start() |> ignore // Get the output into a string while not proc.StandardOutput.EndOfStream do proc.StandardOutput.ReadLine() |> logger What I don't understand is how the proc.Start() can return a boolean and also be asynchronous enough for me to get the output out of the while progressively. Unfortunately, I don't currently have a large enough repository - or slow enough machine, to be able to tell what order things are happening in...

    Read the article

  • List<T> paging asp.net

    - by user1397978
    Using a three-tier architecture, I have a list of objects List<object> careerList = new List<object>(); ModuleDTO module = new ModuleDTO(); careerList = module.getDegreeCodeByQualification(qualificationCode); which I then add to a gridview like so: gridViewMaster.DataSource = careerList; gridViewMaster.DataBind(); What I'd like to do is then enable paging on the gridview. My gridview so far is: <asp:GridView ID="gridViewMaster" runat="server" AutoGenerateColumns="False" GridLines="None" BorderWidth="1px" CellPadding="2" DataKeyNames="Grouping" ForeColor="Black" onrowdatabound="gridViewMaster_RowDataBound" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="gridView_PageIndexChanging" AllowPaging="True" > Is it possible to do enable paging on a list's without having to change that list to a Datatable or Dataview? If there is a way, this would help a lot. So far my events are as follows: protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { gridViewMaster.PageIndex = e.NewPageIndex; List<object> careerList = new List<object>(); ModuleDTO module = new ModuleDTO(); careerList = module.getDegreeCodeByQualification(qualificationCode); ModalProgress.Show(); System.Threading.Thread.Sleep(1000); JobPanel.Visible = true; gridViewMaster.DataSource = careerList.Distinct(); gridViewMaster.DataBind(); } Someone PLEASE HELP ME!!! Thank you

    Read the article

  • How to strip out 0x0a special char from utf8 file using c# and keep file as utf8?

    - by user1013388
    The following is a line from a UTF-8 file from which I am trying to remove the special char (0X0A), which shows up as a black diamond with a question mark below: 2464577 ????? True s6620178 Unspecified <1?1009-672 This is generated when SSIS reads a SQL table then writes out, using a flat file mgr set to code page 65001. When I open the file up in Notepad++, displays as 0X0A. I'm looking for some C# code to definitely strip that char out and replace it with either nothing or a blank space. Here's what I have tried: string fileLocation = "c:\\MyFile.txt"; var content = string.Empty; using (StreamReader reader = new System.IO.StreamReader(fileLocation)) { content = reader.ReadToEnd(); reader.Close(); } content = content.Replace('\u00A0', ' '); //also tried: content.Replace((char)0X0A, ' '); //also tried: content.Replace((char)0X0A, ''); //also tried: content.Replace((char)0X0A, (char)'\0'); Encoding encoding = Encoding.UTF8; using (FileStream stream = new FileStream(fileLocation, FileMode.Create)) { using (BinaryWriter writer = new BinaryWriter(stream, encoding)) { writer.Write(encoding.GetPreamble()); //This is for writing the BOM writer.Write(content); } } I also tried this code to get the actual string value: byte[] bytes = { 0x0A }; string text = Encoding.UTF8.GetString(bytes); And it comes back as "\n". So in the code above I also tried replacing "\n" with " ", both in double quotes and single quotes, but still no change. At this point I'm out of ideas. Anyone got any advice? Thanks.

    Read the article

  • WebGL pass array shader

    - by user987058
    I'm new to WebGL and I'm facing some problems of the shaders. I wanna do multiple light sources in the scene. I searched online and knew that in WebGL, you can't pass an array into the fragment shader, so the only way is use the texture. Here is the problem I can't figure out. First, I create a 32x32 texture using the following code: var pix = []; for(var i=0;i<32;i++) { for(var j=0;j<32;j++) pix.push(0.8,0.8,0.1); } gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, lightMap); gl.pixelStorei(gl.UNPACK_ALIGNMENT,1); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 32,32,0, gl.RGB, gl.UNSIGNED_BYTE,new Float32Array(pix)); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.uniform1i(g_loader.program.set_uniform["u_texture2"],0); But however, when I tried to access the texture in the shader: [Fragment Shader] varying vec2 v_texcoord; uniform sampler2D u_texture2; void main(void) { vec3 lightLoc = texture2D(u_texture, v_texcoord).rgb; gl_FragData[0] = vec4(lightLoc,1.0); } The result is totally black. Is there anyone knows how to acces or create the texture correctly?

    Read the article

  • Determining presence of prototype with correct return type

    - by R..
    Here's a random problem in C black magic I just came up with: Write a function that returns 1 if malloc has been prototyped to return a pointer type and 0 if malloc has a return type of int (either implicitly or due to wrong prototype), without invoking any implementation-defined or undefined behavior. I believe it's solvable, but I haven't worked out the solution. Note that calling the function cannot be necessary and in fact is not possible since calling a function with the incorrect prototype is undefined behavior. I have some ideas for ingredients but I think it makes for a better puzzle (and possibly more diverse ideas) if I leave them out for now. I don't need the solution for any immediate use, but it could be handy in configure scripts and such. Update: A better example of the usefulness (with strdup instead of malloc): #undef strdup #define strdup(x) (strdup_has_proto ? strdup((x)) : my_strdup((x))) i.e. being able to implement X_has_proto as an expression at the source level could be a portable way to use functions which a system might or might not have, and fall back on a local replacement, without needing any separate configure step.

    Read the article

  • Applied style in WPF ignores properties.

    - by Quenton Jones
    Here's the conundrum. In two different places in my application, I use a border with the exact same appearance. In an never-ending fight against code bloat and unmanageable code, I want to define the border's appearance in a style to use when I create the border. Strangely, several of the properties I set are being ignored. Here's the code I use to create the style. Simple enough. Style borderStyle = new Style(typeof(Border)); borderStyle.Setters.Add(new Setter(Border.BorderBrushProperty, Brushes.Black)); borderStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(4))); borderStyle.Setters.Add(new Setter(Border.OpacityProperty, 1.0)); return borderStyle; But when I set the style, the opacity property is left at its original value of 0.7. I have also tried setting the background of the border to a brush I created. It too is ignored. Thanks for any insights you may have.

    Read the article

  • Strange offset space between <button> as parent container and <div> as child.

    - by Maxja
    I need to decorate a standard html button. The base element I took <button> instead of <input>, cos I decided that the element must be a parent container. And there is child element <div> in it. This <div> element will be been the core element for decoration, and should occupy the entire space of the parent element - button. <button> <div>*decoration goes here*</div> </button> And within Cascading Style Sheets it might be looks like this: css button { margin: 0; border: 0; padding: 0; width: *150*px; height: *50*px; position: relative; } div { margin: 0; border: 0; padding: 0; width: 100%; height: 100%; background: *black*; position: absolute; top: 0; left: 0; } html <button type="button"> <div>*decoration goes here*</div> </button> So, Opera(10) is doing well, webkits Chrome(6) and Safari(4) is doing also well, but Internet Explorer(8) is bad - DOM Inspector shows some strange Offset space in top and left, FireFox(3) is also bad - DOM Inspector shows that <div> get some negative value in css-property right: and bottom:. Even if this property will set to zero(0) DOM-Inspector still shows same negative value. I almost broke my brain. Help me, solve this problem, please!

    Read the article

  • Give Gridview cell font colour according to condition

    - by vim
    How can I give colour to gridview's cell text according to condition. I have a below gridview and I am taking data in gridview by code behind. <asp:GridView ID="GridView3" runat="server" AllowPaging="true" PageSize="5" AutoGenerateColumns="false" Width="100%" OnPageIndexChanging="GridView3_PageIndexChanging" CssClass="Grid"> <RowStyle CssClass="GridRow"/> <Columns> <asp:BoundField HeaderText="No" DataField="id" Visible="false"/> <asp:BoundField HeaderText="Scenario" DataField="Scenario"/> <asp:BoundField HeaderText="Type" DataField="Type"/> <asp:BoundField HeaderText="Station Name" DataField="StationName"/> <asp:BoundField HeaderText="Parameter" DataField="PARAM"/> <asp:BoundField HeaderText="Value" DataField="Value" SortExpression="Value" DataFormatString="{0:F2}"/> </Columns> <PagerStyle BackColor="White" Height="40px" Font-Bold="true" Font- Size="Medium" ForeColor="Green" HorizontalAlign="Center"/> <PagerSettings FirstPageText="First" LastPageText="Last" Mode="NumericFirstLast" PageButtonCount="3" /> <HeaderStyle BackColor="#ABDB78" ForeColor="Black" Height="35px" Font- Size="13px" Font-Names="verdana"/> </asp:GridView> I am binding data with this grid by code behind. protected void ReservGridBind() { string name = Request.QueryString[1].ToString(); string query = "SELECT SD.id,SD.Scenario,SD.Value,PR.Type,PR.StationName,PR.PARAM from sgwebdb.param_reference as PR Inner join sgwebdb.scenario_data as SD ON PR.Param_Id=SD.Param_Id INNER JOIN sgwebdb.qualicision_detail as Q ON SD.SCENARIO=Q.Alternative where PR.Type='Reservoirs' and Q.Alternative='" + name +"'"; this.GridView1.DataSource = PSI.DataAccess.Database.DatabaseManager .GetConnection().GetData(query); GridView1.DataBind(); condition : if text < 0 then blue colour , text > 0 && text < 4 then green colour, text > 4 then red colour. Please help me for this gridview's cell text colour.

    Read the article

  • Greasemonkey script, that creates Kineticjs drag and drop canvas over every website

    - by Michael Moeller
    I'd like to put a drag and drop canvas over every website I visit in Firefox. My Greasemonkey script puts a drag and drop canvas under every page: kinetic.user.js: // ==UserScript== // @name kineticjs_example // @description Canvas Drag and Drop // @include * // @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js // @require http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.7.2.min.js // ==/UserScript== var div = document.createElement( 'div' ); with( div ) { setAttribute( 'id', 'container' ); } // append at end document.getElementsByTagName( 'body' )[ 0 ].appendChild( div ); var stage = new Kinetic.Stage({ container: 'container', width: 1000, height: 1000 }); var layer = new Kinetic.Layer(); var rectX = stage.getWidth() / 2 - 50; var rectY = stage.getHeight() / 2 - 25; var box = new Kinetic.Rect({ x: rectX, y: rectY, width: 100, height: 50, fill: '#00D2FF', stroke: 'black', strokeWidth: 4, draggable: true }); // add cursor styling box.on('mouseover', function() { document.body.style.cursor = 'pointer'; }); box.on('mouseout', function() { document.body.style.cursor = 'default'; }); layer.add(box); stage.add(layer); How can I drag and drop this shape over the entire website?

    Read the article

  • Error loading font file using Imager::Font module in perl

    - by user211808
    use strict; use Imager; use Imager::Font; my $img = Imager->new(); my $file = "D:\\table.png"; $img->open(file=>$file) or die $img->errstr(); # Create smaller version my $thumb = $img->scale(scalefactor=>1.2); my $black = Imager::Color->new( 0, 0, 0 ); my $format; # Autostretch individual channels $thumb->filter(type=>'autolevels'); my $font_filename = "D:\\courbd.ttf"; my $font = Imager::Font->new(file=>$font_filename) or die "Cannot load $font_filename: ", Imager->errstr; for $format ( qw( png gif jpg tiff ppm ) ) { # Check if given format is supported if ($Imager::formats{$format}) { $file.="_low.$format"; print "Storing image as: $file\n"; $thumb->string(x => 50, y => 70, font =>$font, string => "Hello, World!", color => 'red', size => 30, aa => 1); $thumb->write(file=>$file) or die $thumb->errstr; } }

    Read the article

  • iPhone rotation woes

    - by skooter500
    I have been spending many frustrating hours trying to get rotations working on the iPhone version of Tunepal. Firstly, I have a tab bar controller, with a navigation controller controlling each of the views. I actually only want one of my views to be able to rotate and that is the TuneDisplay. I have a subclassed the UITabBarController and overridden theshouldAutorotateToInterfaceOrientation: (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { if (self.selectedViewController != nil) { return [self.selectedViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation]; } else { return (interfaceOrientation == UIInterfaceOrientationPortrait); } } In each of the view controllers for each of the tabs I have overridden the method and returned YES for each orientation I want to support. All well and good and everything works as it should. If I try and do a rotation on a tab that doesn’t support the rotation, nothing happens. The problem occurs if I move from a tab thats rotated to a tab that isnt supposed to support that rotation. The new tab is displayed rotated too! Screenshots for all this are included here: http://tunepal.wordpress.com/2010/04/20/rotation-woes/ Is there any way I can make it rotate back to portrait on tapping the tab? I have tried the unsupported setOrientation trick, but firstly it doesnt work correctly and secondly I received a warning from Apple for including it in my last build. If (as I suspect) there is no way to limit this behavior: How do I make the microphone image scale when I rotate the device? How do I make the buttons and the progress bar expand to fit the witdh of the toolbar? Also, one of the tabs that rotates ok has a table, with a search bar. The first time I rotate to the right or to the left, I get a black bar to the right of the search bar. If I subsequently rotate back and rotate again, the bar disappears! I have enabled the struts and springs things on the search bar in the interface builder and it looks like it should behave correctly. Any ideas about how to fix this? Ideas, feedback much appreciated Bryan

    Read the article

< Previous Page | 152 153 154 155 156 157 158 159 160 161 162 163  | Next Page >