Search Results

Search found 1787 results on 72 pages for 'inline'.

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

  • Centering An Inline-Block DIV

    - by Aaron Brewer
    Does anybody know how to center align a DIV that has the display set to inline-block? I cannot set the display to block because I have a background image that needs to be repeated, and it needs to expand based on the content. It sits inside of a parent div, in which is larger when it comes to width. So all in all. Does anyone have a fix to center align a div with the display set to inline-block? And no, text-align: center; does not work, nor does margin: 0 auto; jsFiddle: http://jsfiddle.net/HkvzM/ Thank you!

    Read the article

  • Why can't c# use inline anonymous lambdas or delegates?

    - by Samuel Meacham
    I hope I worded the title of my question appropriately. In c# I can use lambdas (as delegates), or the older delegate syntax to do this: Func<string> fnHello = () => "hello"; Console.WriteLine(fnHello()); Func<string> fnHello2 = delegate() { return "hello 2"; }; Console.WriteLine(fnHello2()); So why can't I "inline" the lambda or the delegate body, and avoid capturing it in a named variable (making it anonymous)? // Inline anonymous lambda not allowed Console.WriteLine( (() => "hello inline lambda")() ); // Inline anonymous delegate not allowed Console.WriteLine( (delegate() { return "hello inline delegate"; })() ); An example that works in javascript (just for comparison) is: alert( (function(){ return "hello inline anonymous function from javascript"; })() ); Which produces the expected alert box. UPDATE: It seems you can have an inline anonymous lambda in C#, if you cast appropriately, but the amount of ()'s starts to make it unruly. // Inline anonymous lambda with appropriate cast IS allowed Console.WriteLine( ((Func<string>)(() => "hello inline anonymous lambda"))() ); Perhaps the compiler can't infer the sig of the anonymous delegate to know which Console.WriteLine() you're trying to call? Does anyone know why this specific cast is required?

    Read the article

  • F# Inline Function Specialization

    - by Ben
    Hi, My current project involves lexing and parsing script code, and as such I'm using fslex and fsyacc. Fslex LexBuffers can come in either LexBuffer<char> and LexBuffer<byte> varieties, and I'd like to have the option to use both. In order to user both, I need a lexeme function of type ^buf - string. Thus far, my attempts at specialization have looked like: let inline lexeme (lexbuf: ^buf) : ^buf -> string where ^buf : (member Lexeme: char array) = new System.String(lexbuf.Lexeme) let inline lexeme (lexbuf: ^buf) : ^buf -> string where ^buf : (member Lexeme: byte array) = System.Text.Encoding.UTF8.GetString(lexbuf.Lexeme) I'm getting a type error stating that the function body should be of type ^buf -> string, but the inferred type is just string. Clearly, I'm doing something (majorly?) wrong. Is what I'm attempting even possible in F#? If so, can someone point me to the proper path? Thanks!

    Read the article

  • vertical align of some inline-block divs with different content

    - by Jan Möller
    i want to center some inline-block divs. I want to create a responsive design, so if the screen size is too small, the horizontal elements should be under each other. How can i center them vertical, so they are side by side without a difference in height? (See fiddle). Moveover those elements should be verticaly centered, if the screen size is too small. http://jsfiddle.net/5dpRs/52/ CSS .repeat { display:inline-block; border-style:solid; border-width:2px; height:50px; width:50px; } #content { border-style:solid; border-width:2px; text-align:center; } HTML <div id="content"> <div class="repeat"> <p>hello</p> </div> <div class="repeat"> </div> </div> Thank you :)

    Read the article

  • Fastest inline-assembly spinlock

    - by sigvardsen
    I'm writing a multithreaded application in c++, where performance is critical. I need to use a lot of locking while copying small structures between threads, for this I have chosen to use spinlocks. I have done some research and speed testing on this and I found that most implementations are roughly equally fast: Microsofts CRITICAL_SECTION, with SpinCount set to 1000, scores about 140 time units Implementing this algorithm with Microsofts InterlockedCompareExchange scores about 95 time units Ive also tried to use some inline assembly with __asm {} using something like this code and it scores about 70 time units, but I am not sure that a proper memory barrier has been created. Edit: The times given here are the time it takes for 2 threads to lock and unlock the spinlock 1,000,000 times. I know this isn't a lot of difference but as a spinlock is a heavily used object, one would think that programmers would have agreed on the fastest possible way to make a spinlock. Googling it leads to many different approaches however. I would think this aforementioned method would be the fastest if implemented using inline assembly and using the instruction CMPXCHG8B instead of comparing 32bit registers. Furthermore memory barriers must be taken into account, this could be done by LOCK CMPXHG8B (I think?), which guarantees "exclusive rights" to the shared memory between cores. At last [some suggests] that for busy waits should be accompanied by NOP:REP that would enable Hyper-threading processors to switch to another thread, but I am not sure whether this is true or not? From my performance-test of different spinlocks, it is seen that there is not much difference, but for purely academic purpose I would like to know which one is fastest. However as I have extremely limited experience in the assembly-language and with memory barriers, I would be happy if someone could write the assembly code for the last example I provided with LOCK CMPXCHG8B and proper memory barriers in the following template: __asm { spin_lock: ;locking code. spin_unlock: ;unlocking code. }

    Read the article

  • syscall from within GCC inline assembly

    - by guest
    is it possible to write a single character using a syscall from within an inline assembly block? if so, how? it should look "something" like this: __asm__ __volatile__ ( " movl $1, %%edx \n\t" " movl $80, %%ecx \n\t" " movl $0, %%ebx \n\t" " movl $4, %%eax \n\t" " int $0x80 \n\t" ::: "%eax", "%ebx", "%ecx", "%edx" ); $80 is 'P' in ascii, but that returns nothing. any suggestions much appreciated!

    Read the article

  • CSS- removing horizontal space in list menu using display inline property

    - by Kayote
    Hi All, Im new to CSS and have a set target of learning & publishing my website in CSS by the end of the month. My question: Im trying to build a CSS horizontal menu with hover drop downs, however, when I use the 'display: inline' property with li (list) items, I get horizontal spaces between the li (list) items in the bar. How do I remove this space? Here is the html: <div id="tabas_menu"> <ul> <li id="tabBut0" class="tabBut">Overview</li> <li id="tabBut1" class="tabBut">Collar</li> <li id="tabBut2" class="tabBut">Sleeves</li> <li id="tabBut3" class="tabBut">Body</li> </ul> </div> And here is the CSS: #tabas_menu { position: absolute; background: rgb(123,345,567); top: 110px; left: 200px; } ul#tabas_menu { padding: 0; margin: 0; } .tabBut { display: inline; white-space: list-style: none; background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,142,190,1)),to(rgba(188,22,93,1))); background: -moz-linear-gradient(top, rgba(255,142,190,1), rgba(188,22,93,1)); font-family: helvetica, calibri, sans-serif; font-size: 16px; font-weight: bold; line-height: 20px; text-shadow: 1px 1px 1px rgba(99,99,99,0.5); -moz-border-radius: 0.3em; -moz-box-shadow: 0px 0px 2px rgba(0,0,0,0.5); -webkit-border-radius: 0.3em; -webkit-box-shadow: 0px 0px 2px rgba(0,0,0,0.5); padding: 6px 18px; border: 1px solid rgba(0,0,0,0.4); margin: 0; } I can get the space removed using the 'float: left/right' property but its bugging me as to why I cannot achieve the same effect by just using the display property.

    Read the article

  • recommending gcc to inline the function

    - by thetna
    I don't know how feasible it is and how sensible is this question here. Is there any changes that we can make in makefile to recommend GCC inline all the function although the functions are not inlined during the declaration or nowhere in the source file.

    Read the article

  • Tool to convert inline C# into a code behind file

    - by Jon Jones
    Hi I have a number of legacy web controls (ascx) that contains huge amounts of inline C#. The forms contain a number of repeated and duplicate code. Our first plan is to move the code into code behinds per file, then refactor etc... were doing this to upgrade the client to the latest version of their cms At the moment we are going to have to manually copy and paste from hundreds of files, create a code behind, copy the code, add the namespaces based on the client-side imports and then do any tidying up does anybody PLEASE know of a tool that can do the majority of this work for us ? Thanks

    Read the article

  • Evaluating php generated javascript "inline"?

    - by talkingnews
    If you look at the source of this page http://kingston.talking-newspapers.co.uk/ you will see a large amount of inline javascript near the top. I don't really want all this extra stuff floating around in my page source, I'd much rather get it off into a script tag, and then I can minify it and all sorts. If I call it as a php file, this SHOULD work in theory, I just end the js file extension with php instead, and in the header I put the following: header("Content-type:application/x-javascript"); but... a lot of the php variables used to generate the playlist within the javascript are setup at the beginning of the main index.php file, and in calling this php-generated js playlist file like this, it seems to evaluate it entirely separately, so it's full of errors. The only way round it I can think of is to have the page write a file, then immediately read it in. The other thing is, the playlist is likely to change often and dynamically, so I think I need to get minify to NOT cache it?

    Read the article

  • C2244 when trying to call the pow function from inline assembly

    - by schrödingers cat
    I would like to call the pow function from inline assembly. The problem is i'm getting error C2244: 'pow' : unable to match function definition to an existing declaration. I'm new to assembly so this may be a trivial question but how do i resolve this? I guess it has something to do with the compiler not beeing able to properly resolve the overload of pow. The following code fragment is causing the error: do_POW: // push first argument to the stack sub esp, size value_type fld qword ptr [ecx] fstp qword ptr [esp] // push second argument to the stack sub esp, size value_type fld qword ptr [ecx - size value_type] fstp qword ptr [esp]and pop fpu stack // call the pow function call pow sub ecx, size value_type fstp qword ptr [ecx] add esp, 2 * size value_type jmp loop_start

    Read the article

  • Inline javascript performance.

    - by Geromey
    I know it is better coding practice to avoid inline javascript like: <img id="the_image" onclick="do_this(true);return false;"/> I am thinking about switching this kind of stuff for bound jquery click events like: $("#the_image").bind("click",function(){ do_this(true); return false; }); Will I lose any performance if I bind a ton of click events? I am not worried about the time it takes to initially bind the events, but the response times between clicking and it happening. I bet if there is a difference, it is negligible, but I will have a ton of functions bound. I'm wondering if browsers treat the onclick attribute the same way as a bound event. Thanks

    Read the article

  • C inline assembly of x96 fbstp instruction

    - by David HUnter
    Was wondering how to inline a usage of fbstp on a 32 bit I86 architecture. I tried something like int main( ) { double foo = 100.0; long bar = 0; asm( "pushl %1; fbstp %0" : "=m"(bar) : "r"(foo) ); ... But bar is unchanged. I have tried reading everything I can find on this but most example simply do things like add two integers together. I can’t find any that talk about pushing operands onto the stack and what I should be doing when an instruction like fbstp writes 80 bits of data back to memory ( i.e. what C type to use ) and how to specify it in the asm syntax. Also on x86-64 there seems to be a pushq and no pushl but fbstp still exists whereas fbstq does not. Is there some other magic for 64 bit.

    Read the article

  • Pros and Cons of Different macro function / inline methods in C

    - by Robert S. Barnes
    According to the C FAQ, there are basically 3 practical methods for "inlining" code in C: #define MACRO(arg1, arg2) do { \ /* declarations */ \ stmt1; \ stmt2; \ /* ... */ \ } while(0) /* (no trailing ; ) */ or #define FUNC(arg1, arg2) (expr1, expr2, expr3) To clarify this one, the arguments are used in the expressions, and the comma operator returns the value of the last expression. or using the inline declaration which is supported as an extension to gcc and in the c99 standard. The do { ... } while (0) method is widely used in the Linux kernel, but I haven't encountered the other two methods very often if at all. I'm referring specifically to multi-statement "functions", not single statement ones like MAX or MIN. What are the pros and cons of each method, and why would you choose one over the other in various situations?

    Read the article

  • Tool to convert inline C' into a code behind

    - by Jon Jones
    Hi I have a number of legacy web controls (ascx) that contains huge amounts of inline C#. The forms contain a number of repeated and duplicate code. Our first plan is to move the code into code behinds per file, then refactor etc... were doing this to upgrade the client to the latest version of their cms At the moment we are going to have to manually copy and paste hundreds files, convert the namespace client-side imports into usings, etc... does anybody PLEASE know of a tool that can do the majority of this work for us ? Thanks

    Read the article

  • How to inline string.h function on linux?

    - by tz1
    I want to optimize some code such that all the functions in string.h will be inlined. I'm on x86_64. I've tried -O3, -minline-all-stringops and when I do "nm a.out" it shows it is calling the glibc version. Checking with gcc -S, I see the calls. What am I missing? There are dozens of #ifdef _SOME_SETTING_ in string.h, and bits/string3.h shows the inline version, but I don't know how to get there. for example: $ cat test.c include main() { char *a, b; strcpy(b,a); } / When compiled with: gcc -minline-all-stringops -O6 -I. -S -o test.S test.c .file "test.c" .text .p2align 4,,15 .globl main .type main, @function main: .LFB12: .cfi_startproc subq $8, %rsp .cfi_def_cfa_offset 16 xorl %esi, %esi xorl %edi, %edi call strcpy addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE12: .size main, .-main .ident "GCC: (GNU) 4.5.1 20100924 (Red Hat 4.5.1-4)" .section .note.GNU-stack,"",@progbits */

    Read the article

  • Fancybox2 Inline Content Gallery

    - by beefchimi
    I am trying to create a gallery of inline content with Fancybox 2, and am failing miserably. I checked out some other resources online and they seem to indicate doing this relatively easily, yet, I cannot seem to get it to work. Here is my fiddle: http://jsfiddle.net/beefchimi/jtxHd/2/ Now, I feel like the fiddle is not loading the resources, so thats a problem. But even with the resources this does not work, I get the fancybox error. Resources: http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js?v=2.1.3 http://fancyapps.com/fancybox/source/jquery.fancybox.css?v=2.1.3 Any help would be greatly appreciated. EDIT: So I can't submit my question without including some code, because linking to jsfiddle isn't okay, so, here is my fancybox initialization, which you will also find in the jsfiddle: $(document).ready(function() { $('a.inlinepopup').fancybox({ 'width' : '75%', 'height' : '75%', 'autoScale' : false, 'type' : 'iframe' }); });

    Read the article

  • Django Admin: OneToOne Relation as an Inline?

    - by Jim Robert
    I am putting together the admin for a satchmo application. Satchmo uses OneToOne relations to extend the base Product model, and I'd like to edit it all on one page. It is possible to have a OneToOne relation as an Inline? If not, what is the best way to add a few fields to a given page of my admin that will eventually be saved into the OneToOne relation? for example: class Product(models.Model): name = models.CharField(max_length=100) ... class MyProduct(models.Model): product = models.OneToOne(Product) ... I tried this for my admin but it does not work, and seems to expect a Foreign Key: class ProductInline(admin.StackedInline): model = Product fields = ('name',) class MyProductAdmin(admin.ModelAdmin): inlines = (AlbumProductInline,) admin.site.register(MyProduct, MyProductAdmin) Which throws this error: <class 'satchmo.product.models.Product'> has no ForeignKey to <class 'my_app.models.MyProduct'> Is the only way to do this a Custom Form? edit: Just tried the following code to add the fields directly... also does not work: class AlbumAdmin(admin.ModelAdmin): fields = ('product__name',)

    Read the article

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