Search Results

Search found 9122 results on 365 pages for 'dynamic scripting'.

Page 115/365 | < Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >

  • jQuery Ajax post with dynamic url

    - by morpheous
    I want to send an AJAX POST, but I want the url that the data is sent to, to be derived from the id of the element that was clicked. This is what I have so far: I have written a javascript function (get_my_url) that returns a url, depending on the element id that was passed to the function. The problem is, it is not clear how to bind the function (get_my_url) to the url param of the .ajax() method. jQuery('.elem1').click(function(){ jQuery.ajax({ async: false, type: 'POST', url: get_my_url(jQuery(this).attr('id')), data: 'id1=1', dataType: 'json', success: function(data){ msg = data.msg }, error: function(xrq, status, et){msg='Oops. An error occured!'} }); Does anyone know how to pass a function to the url param?

    Read the article

  • Dynamic Database connection

    - by gsieranski
    I have multiple client databases that I need to hit on the fly and I am having trouble getting the code I have to work. At first I was just storing a connection string in a clinet object in the db, pulling it out based on logged-in user, and passing it to linq data context constructor. This works fine in my development enviorment but is failing on the Winhost server I am using. It is running SQL 2008. I am getting a "The current configuration system does not support user scoped settings." error. Any help or guidance on this issue is greatly appreciated. Greg

    Read the article

  • Getting the DirectShow VideoRender filter to respond to MediaType changes on its Input Pin?

    - by Jonathan Websdale
    Below is the code extract from my decoder transform filter which takes in data from my source filter which is taking RTP network data from an IP camera. The source filter, decode filter can dynamically respond to changes in the camera image dimensions since I need to handle resolution changes in the decode library. I've used the 'ReceiveConnection' method as described in the DirectShow help, passing the new MediaType data in the next sample. However, I can't get the Video Mixing Renderer to accept the resolution changes dynamically even though the renderer will render the different resolution if the graph is stopped and restarted. Can anyone point out what I need to do to get the renderer to handle dynamic resolution changes? HRESULT CDecoder::Receive(IMediaSample* pIn) { //Input data does not necessarily correspond one-to-one //with output frames, so we must override Receive instead //of Transform. HRESULT hr = S_OK; //Deliver input to library long cBytes = pIn->GetActualDataLength(); BYTE* pSrc; pIn->GetPointer(&pSrc); try { hr = m_codec.Decode(pSrc, cBytes, (hr == S_OK)?&tStart : NULL); } catch (...) { hr = E_UNEXPECTED; } if (FAILED(hr)) { if (theLog.enabled()){theLog.strm() << "Decoder Error " << hex << hr << dec << " - resetting input"; theLog.write();} //Force reset of decoder m_bReset = true; m_codec.ResetInput(); //We have handled the error -- don't pass upstream or the source may stop. return S_OK; } //Extract and deliver any decoded frames hr = DeliverDecodedFrames(); return hr; } HRESULT CDecoder::DeliverDecodedFrames() { HRESULT hr = S_OK; for (;;) { DecodedFrame frame; bool bFrame = m_codec.GetDecodedFrame(frame); if (!bFrame) { break; } CMediaType mtIn; CMediaType mtOut; GetMediaType( PINDIR_INPUT, &mtIn); GetMediaType( PINDIR_OUTPUT, &mtOut); //Get the output pin's current image resolution VIDEOINFOHEADER* pvi = (VIDEOINFOHEADER*)mtOut.Format(); if( pvi->bmiHeader.biWidth != m_cxInput || pvi->bmiHeader.biHeight != m_cyInput) { HRESULT hr = GetPin(PINDIR_OUTPUT)->GetConnected()->ReceiveConnection(GetPin(PINDIR_OUTPUT), &mtIn); if(SUCCEEDED(hr)) { SetMediaType(PINDIR_OUTPUT, &mtIn); } } IMediaSamplePtr pOut; hr = m_pOutput->GetDeliveryBuffer(&pOut, 0, 0, NULL); if (FAILED(hr)) { break; } AM_MEDIA_TYPE* pmt; if (pOut->GetMediaType(&pmt) == S_OK) { CMediaType mt(*pmt); DeleteMediaType(pmt); SetMediaType(PINDIR_OUTPUT, &mt); pOut->SetMediaType(&mt); } // crop, tramslate and deliver BYTE* pDest; pOut->GetPointer(&pDest); m_pConverter->Convert(frame.Width(), frame.Height(), frame.GetY(), frame.GetU(), frame.GetV(), pDest); pOut->SetActualDataLength(m_pOutput->CurrentMediaType().GetSampleSize()); pOut->SetSyncPoint(true); if (frame.HasTimestamp()) { REFERENCE_TIME tStart = frame.Timestamp(); REFERENCE_TIME tStop = tStart+1; pOut->SetTime(&tStart, &tStop); } m_pOutput->Deliver(pOut); } return hr; }

    Read the article

  • Dynamic data validation in ASP.NET MVC

    - by user252160
    I've recently read about the model validation capabilities of ASP.NET MVC which are all very cool until a certain point. What happens if the application doesn't know the data that it works with because it is all stored in DB and built together at runtime. Just like in Drupal, I'd like to be able to define custom types at runtime, and assign runtime validation rules as well. Obviously, the idea of assigning attributes to well established models is now gone. What else could be done ? I am thinking in terms of rules being stored as JSON objects in the DB fields or something like that.

    Read the article

  • C dynamic memory allocation for table of structs

    - by JosiP
    Hi here is my code. I want to dynamincly change no of elemnts in table with structs __state: typedef struct __state{ long int timestamp; int val; int prev_value; }*state_p, state_t; int main(int argc, char **argv){ int zm; int previous_state = 0; int state = 0; int i = 0; int j; state_p st; //here i want to have 20 structs st. st = (state_p) malloc(sizeof(state_t) * 20); while(1){ previous_state = state; scanf("%d", &state); printf("%d, %d\n", state, previous_state); if (previous_state != state){ printf("state changed %d %d\n", previous_state, state); // here i got compile error: main.c: In function ‘main’: main.c:30: error: incompatible type for argument 1 of ‘save_state’ main.c:34: error: invalid type argument of ‘->’ main.c:34: error: invalid type argument of ‘->’ save_state(st[i],previous_state, state); } i++; } return 0; } I suppose i have to change that st[i] to smth like st+ptr ? where pointer is incermeting in each loop iteration ? Or am I wrong ? When i change code: initialization into state_p st[20] and in each loop iteration i put st[i] = (state_p)malloc(sizeof(state_t)) everything works fine, but i want to dynammicly change number of elemets in that table. Thx in advance for any help

    Read the article

  • how to create a dynamic sql statement w/ python and mysqldb

    - by Elias Bachaalany
    I have the following code: def sql_exec(self, sql_stmt, args = tuple()): """ Executes an SQL statement and returns a cursor. An SQL exception might be raised on error @return: SQL cursor object """ cursor = self.conn.cursor() if self.__debug_sql: try: print "sql_exec: " % (sql_stmt % args) except: print "sql_exec: " % sql_stmt cursor.execute(sql_stmt, args) return cursor def test(self, limit = 0): result = sql_exec(""" SELECT * FROM table """ + ("LIMIT %s" if limit else ""), (limit, )) while True: row = result.fetchone() if not row: break print row result.close() How can I nicely write test() so it works with or without 'limit' without having to write two queries?

    Read the article

  • Generate dynamic xmlns

    - by alexbf
    Hello, I would like to dynamically generate xmlns attributes. I want to generate this in XSL : <Common:MainPageBase xmlns:Common="clr-namespace:ThisPartIsDynamic;assembly=ThisPartIsDynamic" </Common:MainPageBase How can I do that in XSL? Thanks, Alex

    Read the article

  • Dynamic margin (or simulation of margin) between left floated divs

    - by BugBusterX
    I have a number of divs floated left. When browser is resized they move down or up based on how many can fit on the line. I was wondering if there is a way to dynamically (with css) have those divs align (or have margin) in a way, that they would always fill the entire screen space by having their marhin resize? In other words margin between them would resize while browser is resized, but as soon as another div can fit it will be added in the line, or if minimum margin is reached and passed another div goes to next line while margins expand again. Here's an example how it is now, resize the wondow to see he leftover space that I want to "fill" <html> <head> <style> .test { float:left; width: 100px; height:100px; background-color: grey; margin: 0 10px 10px 0; } </style> </head> <body> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> </body> </html>

    Read the article

  • Dynamic programming: Find largest diamond (rhombus)

    - by Darksody
    I have a small program to do in Java. I have a 2D array filled with 0 and 1, and I must find the largest rhombus (as in square rotated by 90 degrees) and their numbers. Example: 0 1 0 0 0 1 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 Result: 1 1 1 1 1 1 1 1 1 1 1 1 1 The problem is similar to this SO question. If you have any idea, post it here.

    Read the article

  • Strange behavior: Dynamic expressions with RegExp Object in RegExp.match (Javascript)

    - by NeDark
    I have detect a strange behavior in regexps created with the RegExp object: With this code: var exp1 = /./; var exp2 = new RegExp('.'); ? var test1 = exp1.test('large\n\ntext..etc.'); var test2 = exp2.test('large\n\ntext..etc.'); ? var match1 = 'large\n\ntext..etc.'.match(exp1); var match2 = 'large\n\ntext..etc.'.match(exp2); ...the result is: test1 = true test2 = true ? match1 = 'l' (first match) match2 = null With the regexp maked with the regexp object from a string it finds nothing... Why does this happends? Thanks!!

    Read the article

  • jQuery.post dynamic data callback function

    - by FFish
    I have a script that requires quite e few seconds of processing, up to about minute. The script resizes an array of images, sharpens them and finally zips them up for the user to download. Now I need some sort of progress messages. I was thinking that with jQuery's .post() method the data from the callback function would progressively update, but that doesn't seem to work. In my example I am just using a loop to simulate my script: $(document).ready(function() { $('a.loop').click(function() { $.post('loop.php', {foo:"bar"}, function(data) { $("div").html(data); }); return false; }); }); loop.php: for ($i = 0; $i <= 100; $i++) { echo $i . "<br />"; } echo "done";

    Read the article

  • Dynamic stack allocation in C++

    - by Poni
    I want to allocate memory on the stack. Heard of _alloca / alloca and I understand that these are compiler-specific stuff, which I don't like. So, I came-up with my own solution (which might have it's own flaws) and I want you to review/improve it so for once and for all we'll have this code working: /*#define allocate_on_stack(pointer, size) \ __asm \ { \ mov [pointer], esp; \ sub esp, [size]; \ }*/ /*#define deallocate_from_stack(size) \ __asm \ { \ add esp, [size]; \ }*/ void test() { int buff_size = 4 * 2; char *buff = 0; __asm { // allocate mov [buff], esp; sub esp, [buff_size]; } // playing with the stack-allocated memory for(int i = 0; i < buff_size; i++) buff[i] = 0x11; __asm { // deallocate add esp, [buff_size]; } } void main() { __asm int 3h; test(); } Compiled with VC9. What flaws do you see in it? Me for example, not sure that subtracting from ESP is the solution for "any kind of CPU". Also, I'd like to make the commented-out macros work but for some reason I can't.

    Read the article

  • dynamic row height

    - by Prasanna Venkatesh
    static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@""]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } //cell.backgroundView = [[[CustomCell alloc] init] autorelease]; cell.selectedBackgroundView = [[[CustomCell alloc] init] autorelease]; // At end of function, right before return cell: cell.textLabel.backgroundColor = [UIColor clearColor]; // Configure the cell. UILabel *myLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(-30, 3, 300, 22)]; UILabel *myLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(10, 22, 310, 200)]; UILabel *myLabel3 = [[UILabel alloc] initWithFrame:CGRectMake(0, 170, 300, 20)]; Book *aBook = [appDelegate.books objectAtIndex:indexPath.row]; myLabel1.text=aBook.title; myLabel2.text=aBook.description; myLabel3.text=aBook.pubDate; NSString *desc = aBook.description; if ([desc isEqualToString:nil]) { NSLog(@"nullll lll "); } //myLabel2.textAlignment=UITextAlignmentCenter; myLabel2.numberOfLines=5; myLabel2.textColor=[UIColor blueColor]; myLabel2.lineBreakMode=UILineBreakModeWordWrap; myLabel2.font=[UIFont systemFontOfSize:14]; myLabel3.numberOfLines=1; myLabel1.numberOfLines=1; myLabel1.textColor=[UIColor redColor]; myLabel1.font=[UIFont systemFontOfSize:20]; myLabel1.shadowColor=[UIColor redColor]; myLabel1.backgroundColor=[UIColor grayColor]; [cell.contentView addSubview:myLabel1]; [cell.contentView addSubview:myLabel2]; [cell.contentView addSubview:myLabel3]; hi guys! i have this following code, i want to display this from xml file. now its working but static row height. if the xml file dont have data then it leaves it as blank. so i want to change row height according to the data i provide using the mylabel1,2,3.text

    Read the article

  • Problem Creating dynamic Id for textbox in asp.net mvc

    - by Fraz Sundal
    I have 3 textboxes in three different tab control and i want to generate textbox id like textbox plus concatenate the tab number for(int i=0;i<3;i++) { <%: Html.TextBoxFor(e=>e.vcr_LinkName + i)%> } its not working but when i change it to for(int i=0;i<3;i++) { <%: Html.TextBox("vcr_LinkName" + i)%> } it works fine. but i want to use textboxfor instead of textbox

    Read the article

  • Jquery - Forms Plugin, Dynamic Tabs

    - by user177874
    Hi guys, I am using JQuery UI tabs. When i create a tab using the "$("#" + target).tabs('add', url, title);" method it opens a tab and calls an ajax form correctly.. Now the problem exists when i open an identical tab containing the identical form. When the form is submitted using the forms plugin, things mess up. I am presuming this is due to multiple areas having the same div id and so the form plugin does not know which to update.. Is there a work around for this at all ??

    Read the article

  • dynamic button in jsp

    - by kawtousse
    hi everyone, in my jsp i have a table constructed dynamically like the following: retour.append("<tr>"); try { s= HibernateUtil.currentSession(); tx=s.beginTransaction(); Query query = s.createQuery(HQL_QUERY); for(Iterator it=query.iterate();it.hasNext();) { if(it.hasNext()){ Dailytimesheet object=(Dailytimesheet)it.next(); retour.append("<td>" +object.getActivity() +"</td>"); retour.append("<td>" +object.getProjectCode() + "</td>"); retour.append("<td>" +object.getWAName() + "</td>"); retour.append("<td>" +object.getTaskCode() +"</td>"); retour.append("<td>" +object.getTimeFrom() +"</td>"); retour.append("<td>" +object.getTimeSpent() + "</td>"); retour.append("<td>" +object.getPercentTaskComplete() + "</td>"); if (droitdaccess) { retour.append(""); retour.append(""); retour.append(""); retour.append("<td bordercolor=#FFFFFF>"); retour.append("<input type=\"hidden\" id=\"id_"+nomTab+"_"+compteur+"\" value=\""+object.getIdDailyTimeSheet()+"\"/>"); retour.append("<img src=\"icon_delete.gif\" onClick=\"deletearowById('id_"+nomTab+"_"+compteur+"')\" style=\"cursor:pointer\" name=\"action\" value=\"deleting\" />"); retour.append("</td>"); } } compteur++; retour.append("</tr>"); } //terminer la table. retour.append ("</table>"); next to the table i want to display a button named send in order to send the table content. I do not really want to dispaly this button where the table is empty. So at least if the table is populated by nly one record i want that button being displayed. How should i deal in this case. Thanks.

    Read the article

  • How to select a dynamic datepicker instance in order to extend it with jQuery

    - by JaredC
    I'm trying to control positioning of a jQuery datepicker element. I like the solution offered at http://stackoverflow.com/questions/1818670/how-to-control-positioning-of-jqueryui-datepicker for overriding the _checkOffset fn: $.extend(window.DP_jQuery.datepicker,{_checkOffset:function(inst,offset,isFixed){return offset}}); However, this results in a 'window.DP_jQuery is undefined' error. Upon inspection, I can see that the DP_jQuery object in the DOM gets named with a random string, like so: DP_jQuery_123456. If I use this full name in the above code, it works wonderfully. My question is whether there's a way to exend the _checkOffset fn for a datepicker instance without knowing before-hand what the instance name is? For example, can I use some sort of wildcard to select all datepicker instances that begin with 'DP_jQuery_'? Thanks

    Read the article

  • Python: Dynamic attribute name generation without exec() or eval()

    - by PyNewbie27
    Hi, I'm trying to dynamically create buttons at runtime with PyQT4.7 However, this being my first python program I'm not sure how to get the functionality I want. I would like to be able to substitute a text string for an attribute name: i.e. for each in xrange(4): myname = "tab1_button%s" % each #tab1_button0, tab1_button1, tab1_button2 #self.ui.tab1_button0 = QtGui.QPushButton(self.ui.tab) <--normal code to create a named button setattr(self.ui,myname,QtGui.QPushButton(self.ui.tab)) #rewrite of line above to dynamicly generate a button #here's where I get stuck. this code isn't valid, but it shows what i want to do self.ui.gridLayout.addWidget(self.ui.%s) % myname #I need to have %s be tab1_button1, tab1_button2, etc. I know the % is for string substituion but how can I substitute the dynamically generated attribute name into that statement? I assume there's a basica language construct I'm missing that allows this. Since it's my first program, please take it easy on me ;)

    Read the article

  • Flash AS3 - Scroll dynamic textfield to a specific part just like HTML anchor

    - by Aamir Mahmood
    Hi, We are building a flash website with cms at the back end, and we are allowing admin to put anchors inside a content. Later we created a smaller version of the whole content to display just a small part and then [read more] button. Which add a new layer on top of every thing acting like a popup and it is populated with complete content. Now we would like to scroll that text inside popup to that portion which [read more] button was clicked. The most common example inside HTMl is go to top link in footer on most of the sites which move the whole document to top. Happy codding.

    Read the article

  • Page content bleeding past footer, dynamic resize?

    - by Spider
    Hey all im learning as i go with editing CSS and PHP and ive manage to put together a layout, looks fine on the main page, but I noticed the content is not stretching properly height wise when i goto click on the 3D gallery. Here is the a link to the page that has the issue: http://www.idreamfx.com/wp/?page_id=36&album=1&gallery=2 as you can see its bleeding past the footer, and the content section is not resizing properly. What steps do i take to allow it to be dynamically resized with the content in it? Doing some searching i came across the code: but i'm not sure if how or rather, where to apply such a code or what it really does?

    Read the article

  • How do I create a dynamic data transfer object dynamically from ADO.net model

    - by Richard
    I have a pretty simple database with 5 tables, PK's and relationships setup, etc. I also have an ASP.net MVC3 project I'm using to create simple web services to feed JSON/XML to a mobile app using post/get. To access my data I'm using an ADO.net entity model class to handle generation of the entities, etc. Due to issues with serialization/circular references created by the auto-generated relations from ADO.net entity model, I've been forced to create "Data transfer objects" to strip out the relations and data that doesn't need to be transferred. Question 1: is there an easier way to create DTOs using the entity framework itself? IE, specify only the entity properties I want to convert to Jsonresults? I don't wish to use any 3rd party frameworks if I can help it. Question 2: A side question for Entity Framework, say I create an ADO.net entity model in one project within a solution. Because that model relies on the connection to the database specified in project A, can project B somehow use that model with a similar connection? Both projects are in the same solution. Thanks!

    Read the article

  • "Dynamic" CSS styling in asp .net?

    - by DeeMac
    I have the following inside a content place holder in my asp .net pages: <style type="text/css"> #sortable1 { list-style-type: none; margin: 0; padding: 0; zoom: 1; } #sortable1 li { margin: 3px; padding: 3px; width: 90%; border: 1px solid #000000; background: #000000; color: #FFFFFF; } #sortable1 li.highlightWorkflow { background: #FFFF00; color: #000000; } </style> I would ideally like to swap the #00000's for values held on the page, maybe in hidden fields. Is this possible?

    Read the article

  • Dynamic access of classes of a given namespace

    - by user322383
    Hi! I'm writing an interface that will be implemented by a lot of classes, and I'm writing a class that will hold a collection of instances of these implementations. Every class will have a default constructor. So, is there a simple way (e.g. using some kind of reflection) to put an instance of each of these implementing classes to the collection? Besides doing it manually, which is simple, yes, but a lot of work and error prone (what if I missed an implementation while writing the method? What if a new implementation came and I forgot to update the given method?). So, what I would like is to be able to iterate through all classes of a given namespace or maybe through the list of all available classes. My method then would simply check, through reflection, if the given class implements the given interface, and if it does, puts it into the collection. Thank you.

    Read the article

  • Drop down dynamic

    - by Luke
    I have seen it but dont know how to achieve it. The idea is that I have a drop down menu and when something is selected, something else will appear. Is it AJAX? Any ideas?

    Read the article

< Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >