Search Results

Search found 5942 results on 238 pages for 'total starnger'.

Page 190/238 | < Previous Page | 186 187 188 189 190 191 192 193 194 195 196 197  | Next Page >

  • Conditional macro expansion

    - by Dave DeLong
    Heads up: This is a weird question. I've got some really useful macros that I like to use to simplify some logging. For example I can do Log(@"My message with arguments: %@, %@, %@", @"arg1", @"arg2", @"arg3"), and that will get expanded into a more complex method invocation that includes things like self, _cmd, __FILE__, __LINE__, etc, so that I can easily track where things are getting logged. This works great. Now I'd like to expand my macros to not only work with Objective-C methods, but general C functions. The problem is the self and _cmd portions that are in the macro expansion. These two parameters don't exist in C functions. Ideally, I'd like to be able to use this same set of macros within C functions, but I'm running into problems. When I use (for example) my Log() macro, I get compiler warnings about self and _cmd being undeclared (which makes total sense). My first thought was to do something like the following (in my macro): if (thisFunctionIsACFunction) { DoLogging(nil, nil, format, ##__VA_ARGS__); } else { DoLogging(self, _cmd, format, ##__VA_ARGS__); } This still produces compiler warnings, since the entire if() statement is substituted in place of the macro, resulting in errors with the self and _cmd keywords (even though they will never be executed during function execution). My next thought was to do something like this (in my macro): if (thisFunctionIsACFunction) { #define SELF nil #define CMD nil } else { #define SELF self #define CMD _cmd } DoLogging(SELF, CMD, format, ##__VA_ARGS__); That doesn't work, unfortunately. I get "error: '#' is not followed by a macro parameter" on my first #define. My other thought was to create a second set of macros, specifically for use in C functions. This reeks of a bad code smell, and I really don't want to do this. Is there some way I can use the same set of macros from within both Objective-C methods and C functions, and only reference self and _cmd if the macro is in an Objective-C method?

    Read the article

  • MySQL where condition but not limited by it

    - by Manny Calavera
    Hello. I would like to run a query on my database like this: SELECT SUM( t1.value ) AS total1, SUM( t2.value ) AS total2, SUM( t3.value ) AS total3, SUM( t4.value ) AS total4 FROM pay1 t1, pay2 t2, pay3 t3, pay4 t4 WHERE t1.date = '2010-04-29' AND t2.date = '2010-04-29' AND t3.date = '2010-04-29' AND t4.date = '2010-04-29' I am generating a report on payments and I would like to see a total of payments from each table based on the matching date. The problem is that some of the tables would not meet the condition of date and I want them to show up with 0 value if not. Currently, if any of the tables does not match the date, I get 0 results. I want to display value of 0 anywhere the date is not met and other fields should appear with the found values. The perfect operand for me would be "ANDOR" so that it won't be limited by any date that doesn't math in any table. Unfortunately, ANDOR does not exist as I am aware of so what should I do ? Can anyone help ? Thanks.

    Read the article

  • Create serial number column in telerik mvc grid

    - by Jayaraj
    I could create a grid with telerik mvc <% Html.Telerik().Grid(Model) .Name("ProductGrid") .Columns(columns => { columns.Bound(h => h.ProductName).Width("34%"); columns.Bound(h => h.Description).Width("60%"); columns.Bound(h => h.ProductID).Format(Html.ImageLink("Edit", "Products", new { Id = "{0}" }, "/Content/images/icon_edit.gif", "", new { Id = "edit{0}" }, null).ToString()).Encoded(false).Title("").Sortable(false).Width("3%"); columns.Bound(h => h.ProductID).Format(Html.ImageLink("Delete", "Products", new { Id = "{0}" }, "/Content/images/icon_delete.gif", "", new { onclick = string.Format("return confirm('Are you sure to delete this add on?');") },null).ToString()).Encoded(false).Title("").Sortable(false).Width("3%"); }) .EnableCustomBinding(true) .DataBinding(databinding => databinding.Ajax().Select("_Index", "ProductGrid")) .Pageable(settings => settings.Total((int)ViewData["TotalPages"]) .PageSize(10)) .Sortable() .Render(); %> but I need to add a serial number column in telerik grid.How can i do this?

    Read the article

  • C# images cropping,splitting,saving

    - by cheesebunz
    Hi, as stated in subject, i have an image: private Image testing; testing = new Bitmap(@"sampleimg.jpg"); I would like to split it into 3 x 3 matrix meaning 9 images in total and save it.Any tips or tricks to do this simple? I'm using visual studios 2008 and working on smart devices. Tried some ways but i can't get it. This is what i tried: int x = 0; int y = 0; int width = 3; int height = 3; int count = testing.Width / width; Bitmap bmp = new Bitmap(width, height); Graphics g = Graphics.FromImage(bmp); for (int i = 0; i < count; i++) { g.Clear(Color.Transparent); g.DrawImage(testing, new Rectangle(0, 0, width, height), new Rectangle(x, y, width, height), GraphicsUnit.Pixel); bmp.Save(Path.ChangeExtension(@"C\AndrewPictures\", String.Format(".{0}.bmp",i))); x += width; }

    Read the article

  • Data mining - parsing a log file in Java

    - by nuvio
    Hello I am carrying on a Java project for the university, where I should analyse poker hands. I found some poker hands in a txt log file. They would typically look like this: PokerStars Zoom Hand #86981279921: Hold'em No Limit ($0.10/$0.25 USD) - 2012/09/30 23:49:51 ET Table 'Whirlpool Zoom 40-100 bb' 9-max Seat #1 is the button Seat 1: lgwong ($30.99 in chips) Seat 2: hastyboots ($28.61 in chips) Seat 3: seula i ($25.31 in chips) Seat 4: fr_kevin01 ($31.81 in chips) Seat 5: limey05 ($27.45 in chips) Seat 6: sanlu ($24.65 in chips) Seat 7: Masterfrank ($25.35 in chips) Seat 8: Refu$e2Lose ($33.23 in chips) Seat 9: 1pepepe0114 ($37.62 in chips) hastyboots: posts small blind $0.10 seula i: posts big blind $0.25 *** HOLE CARDS *** fr_kevin01: folds limey05: folds sanlu: folds Masterfrank: folds Refu$e2Lose: folds 1pepepe0114: folds lgwong: folds hastyboots: folds Uncalled bet ($0.15) returned to seula i seula i collected $0.20 from pot seula i: doesn't show hand *** SUMMARY *** Total pot $0.20 | Rake $0 Seat 1: lgwong (button) folded before Flop (didn't bet) Seat 2: hastyboots (small blind) folded before Flop Seat 3: seula i (big blind) collected ($0.20) Seat 4: fr_kevin01 folded before Flop (didn't bet) Seat 5: limey05 folded before Flop (didn't bet) Seat 6: sanlu folded before Flop (didn't bet) Seat 7: Masterfrank folded before Flop (didn't bet) Seat 8: Refu$e2Lose folded before Flop (didn't bet) Seat 9: 1pepepe0114 folded before Flop (didn't bet) My problem is that I am not sure about how to proceed to parse the log file: the only knowledge I have is "manually" scanning line by line for a particular character or symbol, but I am afraid it would need exhaustive error handling. So I was wandering if there is any other techniques or better way to parse these poker hands? Many thanks for your help

    Read the article

  • GPIB connection to external device using MATLAB

    - by hkf
    Is there a way to establish a GPIB connection using MATLAB without the instrument control Tool box? (I don't have it). Also is there a way for MATLAB to know what the external device's RS232 parameter values are ( Baud rate, stop bit etc..). For the RS232 connection I have the following code: % This function is meant to send commands to Potentiostat Model 263A. % A run includes turning the cell on, reading current for time t1, turning % the cell off, waiting for time t2. % t1 is the duration [secs] for which the Potentiostat must run (cell is on) % t2 is the duration [secs] to on after off % n is the number of runs % port is the serial port name such as COM1 function [s] = Potentiostat_control(t1,t2,n) port = input('type port name such as COM1', 's') s = serial(port); set(s,'BaudRate', 9600, 'DataBits', 8, 'Parity', 'even', 'StopBits', 2 ,'Terminator', 'CR/LF'); fopen(s) %fprintf(s,'RS232?') disp(['Total runs requested = ' num2str(n)]) disp('i denotes number of runs executed so far..'); for i=1:n i %data1 = query(s, '*IDN?') fprintf(s,'%s','CELL 1'); % sends the command 'CELL 1' %fprintf(s,'%s','READI'); pause(t1); fprintf(s,'%s','CELL 0'); %fprintf(s,'%s','CLEAR'); pause(t2); end fclose(s)

    Read the article

  • MS Access 2003 - Is there a way to programmatically define the data for a chart?

    - by Justin
    So I have some VBA for taking charts built with the Form's Chart Wizard, and automatically inserting it into PowerPoint Presentation slides. I use those chart-forms as sub forms within a larger forms that has parameters the user can select to determine what is on the chart. The idea is that the user can determine the parameter, build the chart to his/her liking, and click a button and have it in a ppt slide with the company's background template, blah blah blah..... So it works, though it is very bulky in terms of the amount of objects I have to use to accomplish this. I use expressions such as the following: like forms!frmMain.Month&* to get the input values into the saved queries, which was fine when i first started, but it went over so well and they want so many options, that it is driving the number of saved queries/objects up. I need several saved forms with charts because of the number of different types of charts I need to have this be able to handle. SO FINALLY TO MY QUESTION: I would much rather do all this on the fly with some VBA. I know how to insert list boxes, and text boxes on a form, and I know how to use SQL in VBA to get the values I want from tables/queries using VBA, I just don't know if there is some vba I can use to set the data values of the charts from a resulting recordset: DIM rs AS DAO.Rescordset DIM db AS DAO.Database DIM sql AS String sql = "SELECT TOP 5 Count(tblMain.TransactionID) AS Total, tblMain.Location FROM tblMain WHERE (((tblMain.Month) = """ & me.txtMonth & """ )) ORDER BY Count (tblMain.TransactionID) DESC;" set db = currentDB set rs = db.OpenRecordSet(sql) rs.movefirst some kind of cool code in here to make this recordset the data of chart in frmChart ("Chart01") thanks for your help. apologies for the length of the explanation.

    Read the article

  • javascript pausing consistently. How do I find what is causing it to pause?

    - by pedalpete
    I've got a fairly ajax heavy site and I'm trying to tune the performance. I have a function that runs between 20 & 200 times, depending on the user. I'm outputting the time the function takes to execute via console.time in firefox. The function takes about 4-6ms to complete. The strange thing is that on my larger test with 200 or runs through that function, it runs through the first 31, then seems to pause for almost a second before completing the last 170 or so. However, that 'pause' doesn't show up in the console.time logs, and I'm not running any other functions, and the object that gets passed to the function looks the same as all other objects that get passed in. The function is called like this for (var s in thisGroup.events){ showEvent(thisGroup.events[s]) } so, I don't see how or why it would suddenly pause near the beginning. but only pause once and then continue through. The pause ALWAYS happens on the 31st time through the function. I've taken a close look at the 'thisGroup.events[s]' that it is being run through, and it looks like this for #31 "eventId":"5106", "sid":"68", "gid":"29", "uid":"70","type":"event", "startDate":"2010-03-22","startTime":"6:00 PM","endDate":"2010-03-22","endTime":"11:00 PM","durationLength":"5", "durationTime":"5:00", "note":"", "desc":"event" The event immediately after the pause, #32 looks like this "eventId":"5111", "sid":"68", "gid":"29", "uid":"71","type":"event", "startDate":"2010-03-22","startTime":"6:00 PM","endDate":"2010-03-22","endTime":"11:00 PM","durationLength":"5", "durationTime":"5:00", "note":"", "desc":"event" another event that runs through no problem looks like this "eventId":"5113", "sid":"68", "gid":"29", "uid":"72","type":"event", "startDate":"2010-03-22","startTime":"4:30 PM","endDate":"2010-03-22","endTime":"11:00 PM","durationLength":"6.5", "durationTime":"6:30", "note":"", "desc":"event" From the console outputs, it doesn't appear as there is anything hanging or taking up time in the function itself, as the console.time for each event including #31,32 is 4ms. Another strange thing here is that the total time running the for loop across the entire object is coming out as 1014ms which is right for 200 events at 4-6ms each. Any suggestions on how to find this 'pause'? I find it very interesting that it is consistently happening between #31 & #32 only!

    Read the article

  • C# vs C - Big performance difference

    - by John
    I'm finding massive performance differences between similar code in C anc C#. The C code is: #include <stdio.h> #include <time.h> #include <math.h> main() { int i; double root; clock_t start = clock(); for (i = 0 ; i <= 100000000; i++){ root = sqrt(i); } printf("Time elapsed: %f\n", ((double)clock() - start) / CLOCKS_PER_SEC); } And the C# (console app) is: using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { DateTime startTime = DateTime.Now; double root; for (int i = 0; i <= 100000000; i++) { root = Math.Sqrt(i); } TimeSpan runTime = DateTime.Now - startTime; Console.WriteLine("Time elapsed: " + Convert.ToString(runTime.TotalMilliseconds/1000)); } } } With the above code, the C# completes in 0.328125 seconds (release version) and the C takes 11.14 seconds to run. The c is being compiled to a windows executable using mingw. I've always been under the assumption that C/C++ were faster or at least comparable to C#.net. What exactly is causing the C to run over 30 times slower? EDIT: It does appear that the C# optimizer was removing the root as it wasn't being used. I changed the root assignment to root += and printed out the total at the end. I've also compiled the C using cl.exe with the /O2 flag set for max speed. The results are now: 3.75 seconds for the C 2.61 seconds for the C# The C is still taking longer, but this is acceptable

    Read the article

  • Data Modeling of Entity with Attributes

    - by StackOverflowNewbie
    I'm storing some very basic information "data sources" coming into my application. These data sources can be in the form of a document (e.g. PDF, etc.), audio (e.g. MP3, etc.) or video (e.g. AVI, etc.). Say, for example, I am only interested in the filename of the data source. Thus, I have the following table: DataSource Id (PK) Filename For each data source, I also need to store some of its attributes. Example for a PDF would be "numbe of pages." Example for audio would be "bit rate." Example for video would be "duration." Each DataSource will have different requirements for the attributes that need to be stored. So, I have modeled "data source attribute" this way: DataSourceAttribute Id (PK) DataSourceId (FK) Name Value Thus, I would have records like these: DataSource->Id = 1 DataSource->Filename = 'mydoc.pdf' DataSource->Id = 2 DataSource->Filename = 'mysong.mp3' DataSource->Id = 3 DataSource->Filename = 'myvideo.avi' DataSourceAttribute->Id = 1 DataSourceAttribute->DataSourceId = 1 DataSourceAttribute->Name = 'TotalPages' DataSourceAttribute->Value = '10' DataSourceAttribute->Id = 2 DataSourceAttribute->DataSourceId = 2 DataSourceAttribute->Name = 'BitRate' DataSourceAttribute->Value '16' DataSourceAttribute->Id = 3 DataSourceAttribute->DataSourceId = 3 DataSourceAttribute->Name = 'Duration' DataSourceAttribute->Value = '1:32' My problem is that this doesn't seem to scale. For example, say I need to query for all the PDF documents along with thier total number of pages: Filename, TotalPages 'mydoc.pdf', '10' 'myotherdoc.pdf', '23' ... The JOINs needed to produce the above result is just too costly. How should I address this problem?

    Read the article

  • WebKit and Opera won't load from this server when it's in a frame

    - by crimson_penguin
    This site loads fine in Firefox, but in WebKit browsers (Safari and Google Chrome) it won't load the frame, and in Opera I get this error: "The Web site does not permit its content to be displayed in a frame. It must be displayed in a separate window.". I don't expect to be able to actually fix this, as I don't have control over the frames page (only the content of the frame), but my question is: why? The content of the frame loads fine by itself, and saving the frames page and changing the src of the frame to http://w3.org/ loads fine. I did a bit of searching based on the Opera error, and it seemed to suggest it had to do with redirecting. That URL does indeed redirect, but if I change it to http://mini.milli.no/tonje/main (which doesn't redirect), it still doesn't work. Even Apache directory listings don't work - which to me suggests it's server related. But how can a server do that? To be total clear, I'm using Mac OS X 10.6.3, and I tested with Safari 4.0.5, Chrome 5.0.375.55, Opera 10.53, and Firefox 3.6.3. Basically, the newest of all of those things currently.

    Read the article

  • Truncate portions of a string to limit the whole string's length in Ruby

    - by Horace Loeb
    Suppose you want to generate dynamic page titles that look like this: "It was all a dream, I used to read word up magazine" from "Juicy" by The Notorious B.I.G I.e., "LYRICS" from "SONG_NAME" by ARTIST However, your title can only be 69 characters total and this template will sometimes generate titles that are longer. One strategy for solving this problem is to truncate the entire string to 69 characters. However, a better approach is to truncate the less important parts of the string first. I.e., your algorithm might look something like this: Truncate the lyrics until the entire string is <= 69 characters If you still need to truncate, truncate the artist name until the entire string is <= 69 characters If you still need to truncate, truncate the song name until the entire string is <= 69 characters If all else fails, truncate the entire string to 69 characters Ideally the algorithm would also limit the amount each part of the string could be truncated. E.g., step 1 would really be "Truncate the lyrics to a minimum of 10 characters until the entire string is <= 69 characters" Since this is such a common situation, I was wondering if someone has a library or code snippet that can take care of it.

    Read the article

  • How should I format an HTTPService result in Flex so that it is accessible for a pie chart?

    - by Eric Reynolds
    I feel like this should be simple, however everywhere I look online someone does something different. I am doing a small charting application to track download statistics, and want to put the data into a pie chart. I am new to Flex, so if my code is horrible I apologize. <s:HTTPService id="service" url="admin/stats/totalstats.php" fault="service_faultHandler(event)" result="service_resultHandler(event)" /> What is the best resultFormat for this purpose, and if I am assigning the returned value to an ActionScript variable, should it be an ArrayList? ArrayCollection? Heres a sample of the XML being returned from the HTTPService <DownloadStats> <year count="24522" year="2008"> <month count="20" month="5" year="2008" full="May 2008"> <day count="2" month="5" day="20" year="2008"/> <day count="1" month="5" day="21" year="2008"/> <day count="9" month="5" day="22" year="2008"/> <day count="1" month="5" day="23" year="2008"/> <day count="1" month="5" day="29" year="2008"/> <day count="1" month="5" day="30" year="2008"/> <day count="5" month="5" day="31" year="2008"/> </month> ... </year> <DownloadStats> Any help is appreciated, Thanks, Eric R. EDIT: I decided that it would be helpful to see how I am transferring the data to the chart to make sure I am not doing something wrong there either. <mx:PieChart id="pieChart"> <mx:PieSeries nameField="year" field="count" labelPosition="callout" displayName="Total" dataProvider="{graphData}"/> </mx:PieChart>

    Read the article

  • Grayscale image with colored spotlight in JavaFX

    - by DaUltimateTrooper
    I need a way to have a gray scale image in an ImageView and on mouse moved if the cursor position is in the ImageView bounds to show a colored spotlight on the mouse position. I have created a sample to help you understand what I need. This sample negates the colors of a colored image on the onMouseMoved event. package javafxapplication3; import javafx.scene.effect.BlendMode; import javafx.scene.Group; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.paint.Color; import javafx.scene.paint.RadialGradient; import javafx.scene.paint.Stop; import javafx.scene.Scene; import javafx.scene.shape.Circle; import javafx.stage.Stage; var spotlightX = 0.0; var spotlightY = 0.0; var visible = false; var anImage = Image { url: "{__DIR__}picture1.jpg" } Stage { title: "Spotlighting" scene: Scene { fill: Color.WHITE content: [ Group { blendMode: BlendMode.EXCLUSION content: [ ImageView { image: anImage onMouseMoved: function (me: MouseEvent) { if (me.x > anImage.width - 10 or me.x < 10 or me.y > anImage.height - 10 or me.y < 10) { visible = false; } else { visible = true; } spotlightX = me.x; spotlightY = me.y; } }, Group { id: "spotlight" content: [ Circle { visible: bind visible translateX: bind spotlightX translateY: bind spotlightY radius: 60 fill: RadialGradient { centerX: 0.5 centerY: 0.5 stops: [ Stop { offset: 0.1, color: Color.WHITE }, Stop { offset: 0.5, color: Color.BLACK }, ] } } ] } ] }, ] }, } I am a total newbie what can I say...

    Read the article

  • Read from file hexadecimal number and change their representation style

    - by user576844
    I want to write a program changing the notation of all hexadecimal numbers found in an assembly source file from traditional (h) to C-style (0x). I have started the coding part but am not sure how can I detect the hexadecimal numbers and eventually change the style and save it back in the file... I have started writing the program.. ## Mips program - .data fin: .ascii "" # filename for input msg0: .asciiz "aaaa" msg1: .asciiz "Please enter the input file name:" buffer: .asciiz "" .text #----------------------- li $v0, 4 la $a0, msg1 syscall li $v0, 8 la $a0, fin li $a1, 21 syscall jal fileRead #read from file move $s1, $v0 #$t0 = total number of bytes li $t0, 0 # Loop counter loop: bge $t0, $s1, end #if end of file reached OR if there is an error in the file lb $t5, buffer($t0) #load next byte from file jal checkhexa #check for hexadecimal numbers addi $t0, $t0, 1 #increment loop counter j loop end: jal output jal fileClose li $v0, 10 syscall fileRead: # Open file for reading li $v0, 13 # system call for open file la $a0, fin # input file name li $a1, 0 # flag for reading li $a2, 0 # mode is ignored syscall # open a file move $s0, $v0 # save the file descriptor # reading from file just opened li $v0, 14 # system call for reading from file move $a0, $s0 # file descriptor la $a1, buffer # address of buffer from which to read li $a2, 100000 # hardcoded buffer length syscall # read from file jr $ra Any help would be appreciated.

    Read the article

  • java.lang.IllegalAccessError in Windows xp

    - by Priya.S
    Hi I have installed NetBeens 6.9.1 in my windows xp system. java web application wokring fine. But i have not get web method in my java web application. its error occurring. Error Message : init: deps-module-jar: deps-ear-jar: deps-jar: wsimport-init: Created dir: D:\javaprg\projects\myApp\build\generated-sources\jax-ws wsimport-client-userServiceService: Created dir: D:\javaprg\projects\myApp\build\generated\jax-wsCache\userServiceService D:\javaprg\projects\myApp\nbproject\jaxws-build.xml:31: java.lang.IllegalAccessError: tried to access class com.sun.tools.ws.Invoker from class com.sun.tools.ws.ant.WrapperTask at com.sun.tools.ws.ant.WrapperTask.createClassLoader(WrapperTask.java:85) at com.sun.istack.tools.ProtectedTask.execute(ProtectedTask.java:46) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:589) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397) at org.apache.tools.ant.Project.executeTarget(Project.java:1366) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1249) at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:281) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154) BUILD FAILED (total time: 1 second)

    Read the article

  • How to output KML by GAE

    - by Niklas R
    Hi I use KML for a google map where entities have a geopt.db coordinate and soft memory limit was exceeded with 213.465 MB after servicing 1 requests total. The log says /list.kml 200 13130ms 10211cpu_ms 4238api_cpu_ms The file list.kml which outputs about 455,7 KB is a template as follows <?xml version="1.0" encoding="UTF-8"?><kml xmlns="http:// www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http:// www.w3.org/2005/Atom"> <Document>{% for a in list %} <Placemark> <name> </name> <description> <![CDATA[<a href="http://{{host}}/{{a.key.id}}"> {{ a.title }} </a> <br/>{{a.text}}]]> </description> <Style> <IconStyle> <Icon> <href> http://www.google.com/intl/en_us/mapfiles/ms/icons/green-dot.png </href> </Icon> </IconStyle> </Style> <Point> <coordinates> {{a.geopt.lon|floatformat:2}},{{a.geopt.lat|floatformat:2}} </coordinates> </Point> </Placemark> {% endfor %} </Document> </kml> Is there a memory leak in the template or the python that passes the list variable? Can I improve using other template engine or other framework than default? Is kmz compression a good idea in this case? Thanks in advance for any suggestion where or how to change the code.

    Read the article

  • Fixing a multi-threaded pycurl crash.

    - by Rook
    If I run pycurl in a single thread everything works great. If I run pycurl in 2 threads python will access violate. The first thing I did was report the problem to pycurl, but the project died about 3 years ago so I'm not holding my breath. My (hackish) solution is to build a 2nd version of pycurl called "pycurl_thread" which will only be used by the 2nd thread. I downloaded the pycurl module from sourceforge and I made a total of 4 line changes. But python is still crashing. My guess is that even though this is a module with a different name (import pycurl_thread), its still sharing memory with the original module (import pycurl). How should I solve this problem? Changes in pycurl.c: initpycurl(void) to initpycurl_thread(void) and m = Py_InitModule3("pycurl", curl_methods, module_doc); to m = Py_InitModule3("pycurl_thread", curl_methods, module_doc); Changes in setup.py: PACKAGE = "pycurl" PY_PACKAGE = "curl" to PACKAGE = "pycurl_thread" PY_PACKAGE = "curl_thread" Here is the seg fault i'm getting. This is happening within the C function do_curl_perform(). *** longjmp causes uninitialized stack frame ***: python2.7 terminated ======= Backtrace: ========= /lib/libc.so.6(__fortify_fail+0x37)[0x7f209421b537] /lib/libc.so.6(+0xff4c9)[0x7f209421b4c9] /lib/libc.so.6(__longjmp_chk+0x33)[0x7f209421b433] /usr/lib/libcurl.so.4(+0xe3a5)[0x7f20931da3a5] /lib/libpthread.so.0(+0xfb40)[0x7f209532eb40] /lib/libc.so.6(__poll+0x53)[0x7f20941f6203] /usr/lib/libcurl.so.4(Curl_socket_ready+0x116)[0x7f2093208876] /usr/lib/libcurl.so.4(+0x2faec)[0x7f20931fbaec] /usr/local/lib/python2.7/dist-packages/pycurl.so(+0x892b)[0x7f209342c92b] python2.7(PyEval_EvalFrameEx+0x58a1)[0x4adf81] python2.7(PyEval_EvalCodeEx+0x891)[0x4af7c1] python2.7(PyEval_EvalFrameEx+0x538b)[0x4ada6b] python2.7(PyEval_EvalFrameEx+0x65f9)[0x4aecd9]

    Read the article

  • Trouble compiling C/C++ project in NetBeans 6.8 with MinGW on Windows

    - by dontoo
    I am learning C and because VC++ 2008 doesn't support C99 features I have just installed NetBeans and configure it to work with MinGW. I can compile single file project ( main.c) and use debugger but when I add new file to project I get error "undefined reference to ... function(code) in that file..". Obviously MinGW does't link my files or I don't know how properly add them to my project (c standard library files work fine). /bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf make[1]: Entering directory `/c/Users/don/Documents/NetBeansProjects/CppApplication_7' /bin/make -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/cppapplication_7.exe make[2]: Entering directory `/c/Users/don/Documents/NetBeansProjects/CppApplication_7' mkdir -p dist/Debug/MinGW-Windows gcc.exe -o dist/Debug/MinGW-Windows/cppapplication_7 build/Debug/MinGW-Windows/main.o build/Debug/MinGW-Windows/main.o: In function `main': C:/Users/don/Documents/NetBeansProjects/CppApplication_7/main.c:5: undefined reference to `X' collect2: ld returned 1 exit status make[2]: *** [dist/Debug/MinGW-Windows/cppapplication_7.exe] Error 1 make[2]: Leaving directory `/c/Users/don/Documents/NetBeansProjects/CppApplication_7' make[1]: *** [.build-conf] Error 2 make[1]: Leaving directory `/c/Users/don/Documents/NetBeansProjects/CppApplication_7' make: *** [.build-impl] Error 2 BUILD FAILED (exit value 2, total time: 1s) main.c #include "header.h" int main(int argc, char** argv) { X(); return (EXIT_SUCCESS); } header.h #ifndef _HEADER_H #define _HEADER_H #include <stdio.h> #include <stdlib.h> void X(void); #endif source.c #include "header.h" void X(void) { printf("dsfdas"); }

    Read the article

  • How to search cvs comment history

    - by Chris Noe
    I am aware of this command: cvs log -N -w<userid> -d"1 day ago" Unfortunately this generates a formatted report with lots of newlines in it, such that the file-path, the file-version, and the comment-text are all on separate lines. Therefore it is difficult to scan it for all occurrences of comment text, (eg, grep), and correlate the matches to file/version. (Note that the log output would be perfectly acceptable, if only cvs could perform the filtering natively.) EDIT: Sample output. A block of text like this is reported for each repository file: RCS file: /data/cvs/dps/build.xml,v Working file: build.xml head: 1.49 branch: locks: strict access list: keyword substitution: kv total revisions: 57; selected revisions: 1 description: ---------------------------- revision 1.48 date: 2008/07/09 17:17:32; author: noec; state: Exp; lines: +2 -2 Fixed src.jar references ---------------------------- revision 1.47 date: 2008/07/03 13:13:14; author: noec; state: Exp; lines: +1 -1 Fixed common-src.jar reference. =============================================================================

    Read the article

  • onSubmit returning false is not working

    - by StuckOnSubmit
    I'm completely confused ... I'd swear this was working yesterday ... I woke up this morning and all my forms stopped to work in my project. All the forms have a "onsubmit" to a function that returns false since it's an ajax call, so the form is never sent. After a lot of tests, I simplified the question to this piece of code: <html> <head> <script type="text/javascript"> function sub() { alert ("MIC!"); return false; } </script> </head> <body> <form method = "post" id = "form1" onsubmit = "return sub()"> input: <input type="text" name="input1" > <a href="#" onClick="document.getElementById('form1').submit();">button</a> </form> </body> </html> I would swear that this works perfectly, but today is nor working :D Why if I press the button the form is sent ? I know it's a total newbie question, but I'm stuck Thank you !

    Read the article

  • passing groups of properties from 1 class to another

    - by insanepaul
    I have a group of 13 properties in a class. I created a struct for these properties and passed it to another class. I need to add another 10 groups of these 13 properties. So thats 130 properties in total. What do I do? I could add all 130 properties to the struct. Will this affect performance and readability I could create a list of structs but don't know how to access an item eg. to add to the list: listRowItems.Add(new RowItems(){a=1, b=1, c=1, d=1...}); listRowItems.Add(new RowItems(){a=2, b=2, c=2, d=2...}); How do I access the second group item b? is it Could I use just a dictionary with 130 items Should I use a list of dictionaries (again I don't know how to access a particular item) Should I pass in a class of 130 properties Just for your interest the properties are css parameters used for a composite control. The control displays 13 elements in each row and there are 10 rows and each row is customisable.

    Read the article

  • How VerticalOffset changes when Scrollable height changes while having list inside a list

    - by Prakash
    I am making a WP7 app which has a Listbox of UserControls. Each UserControl has an ItemsControl and Button(for getting more results). On click of the button the ItemsControl items will be increased by 5 or 10. Now on clicking on the GetMore button of any of the usercontrols except the first or last, there will be an increase in Scrollable height(Total height of the listbox) of the ListBox but the VerticalOffset(position of scrollbar from top) of the ListBox remains same. Now the problem I am facing is that the Vertical Offset is not absolute but relative to Scrollable Height. So the content being viewed till then will be changed basing on the new value of ScollableHeight. I want to know the relation between them, so that I can do some math and set the VerticalOffset value. I have added some dependency properties on VerticalOffset and ScrollableHeight through which I can get the events when any of them is changed. Also trying to use them to readjust the VerticalOffset. Any suggestions or corrections are highly appreciated.

    Read the article

  • How does MVC ViewData work?

    - by Matt
    I am toying around with an MVC application just to learn the technology. I am mocking up a check register application that keeps track of a checking account, what has cleared the bank and what has not. I am using EF for my model and everything seems to be working correctly insofar as Edit, Create, etc. However, I have a couple of totals at the top. One to show the bank's balance and another to show the actual balance. It works most of the time but when I do Edit's it does not always accurately reflect the new total and I need it to update everytime a change is made (i.e when something clears the bank): [Authorize(Roles = "admin, checkUser")] public ActionResult Index() { var resultSet = from myChecking in chk.tblCheckings orderby myChecking.id descending select myChecking; ViewData.Model = resultSet.Take(45).ToList(); //for balances var actualBalance = from theChecking in chk.tblCheckings select theChecking.deposit - theChecking.withdrawal; var bankBalance = from theChecking in chk.tblCheckings where theChecking.cleared == true select theChecking.deposit - theChecking.withdrawal; //get bank balance ViewData["bankBalance"] = bankBalance.Sum(); //get actual balance ViewData["actualBalance"] = actualBalance.Sum(); return View(); } I am showing the actual and other balance in the Index view as follows: <td colspan="9" style="text-align: center; font-size: 11pt; color: white;"> <%= string.Format("Bank Balance: {0:c}", ViewData["bankBalance"]) %> ------ <%= string.Format("Actual Balance: {0:c}", ViewData["actualBalance"]) %> </td>

    Read the article

  • How should I generate the partitions / pairs for the Chinese Postman problem?

    - by Simucal
    I'm working on a program for class that involves solving the Chinese Postman problem. Our assignment only requires us to write a program to solve it for a hard-coded graph but I'm attempting to solve it for the general case on my own. The part that is giving me trouble is generating the partitions of pairings for the odd vertices. For example, if I had the following labeled odd verticies in a graph: 1 2 3 4 5 6 I need to find all the possible pairings / partitions I can make with these vertices. I've figured out I'll have i paritions given: n = num of odd verticies k = n / 2 i = ((2k)(2k-1)(2k-2)...(k+1))/2 So, given the 6 odd verticies above, we will know that we need to generate i = 15 partitions. The 15 partions would look like: 1 2 3 4 5 6 1 2 3 5 4 6 1 2 3 6 4 5 ... 1 6 ... Then, for each partition, I take each pair and find the shortest distance between them and sum them for that partition. The partition with the total smallest distance between its pairs is selected, and I then double all the edges between the shortest path between the odd vertices (found in the selected partition). These represent the edges the postman will have to walk twice. At first I thought I had worked out an appropriate algorithm for generating these partitions / pairs but it is flawed. I found it wasn't a simple permutation/combination problem. Does anyone who has studied this problem before have any tips that can help point me in the right direction for generating these partitions?

    Read the article

< Previous Page | 186 187 188 189 190 191 192 193 194 195 196 197  | Next Page >