Search Results

Search found 4250 results on 170 pages for 'mark underwood'.

Page 70/170 | < Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >

  • Optimizing python code performance when importing zipped csv to a mongo collection

    - by mark
    I need to import a zipped csv into a mongo collection, but there is a catch - every record contains a timestamp in Pacific Time, which must be converted to the local time corresponding to the (longitude,latitude) pair found in the same record. The code looks like so: def read_csv_zip(path, timezones): with ZipFile(path) as z, z.open(z.namelist()[0]) as input: csv_rows = csv.reader(input) header = csv_rows.next() check,converters = get_aux_stuff(header) for csv_row in csv_rows: if check(csv_row): row = { converter[0]:converter[1](value) for converter, value in zip(converters, csv_row) if allow_field(converter) } ts = row['ts'] lng, lat = row['loc'] found_tz_entry = timezones.find_one(SON({'loc': {'$within': {'$box': [[lng-tz_lookup_radius, lat-tz_lookup_radius],[lng+tz_lookup_radius, lat+tz_lookup_radius]]}}})) if found_tz_entry: tz_name = found_tz_entry['tz'] local_ts = ts.astimezone(timezone(tz_name)).replace(tzinfo=None) row['tz'] = tz_name else: local_ts = (ts.astimezone(utc) + timedelta(hours = int(lng/15))).replace(tzinfo = None) row['local_ts'] = local_ts yield row def insert_documents(collection, source, batch_size): while True: items = list(itertools.islice(source, batch_size)) if len(items) == 0: break; try: collection.insert(items) except: for item in items: try: collection.insert(item) except Exception as exc: print("Failed to insert record {0} - {1}".format(item['_id'], exc)) def main(zip_path): with Connection() as connection: data = connection.mydb.data timezones = connection.timezones.data insert_documents(data, read_csv_zip(zip_path, timezones), 1000) The code proceeds as follows: Every record read from the csv is checked and converted to a dictionary, where some fields may be skipped, some titles be renamed (from those appearing in the csv header), some values may be converted (to datetime, to integers, to floats. etc ...) For each record read from the csv, a lookup is made into the timezones collection to map the record location to the respective time zone. If the mapping is successful - that timezone is used to convert the record timestamp (pacific time) to the respective local timestamp. If no mapping is found - a rough approximation is calculated. The timezones collection is appropriately indexed, of course - calling explain() confirms it. The process is slow. Naturally, having to query the timezones collection for every record kills the performance. I am looking for advises on how to improve it. Thanks. EDIT The timezones collection contains 8176040 records, each containing four values: > db.data.findOne() { "_id" : 3038814, "loc" : [ 1.48333, 42.5 ], "tz" : "Europe/Andorra" } EDIT2 OK, I have compiled a release build of http://toblerity.github.com/rtree/ and configured the rtree package. Then I have created an rtree dat/idx pair of files corresponding to my timezones collection. So, instead of calling collection.find_one I call index.intersection. Surprisingly, not only there is no improvement, but it works even more slowly now! May be rtree could be fine tuned to load the entire dat/idx pair into RAM (704M), but I do not know how to do it. Until then, it is not an alternative. In general, I think the solution should involve parallelization of the task. EDIT3 Profile output when using collection.find_one: >>> p.sort_stats('cumulative').print_stats(10) Tue Apr 10 14:28:39 2012 ImportDataIntoMongo.profile 64549590 function calls (64549180 primitive calls) in 1231.257 seconds Ordered by: cumulative time List reduced from 730 to 10 due to restriction <10> ncalls tottime percall cumtime percall filename:lineno(function) 1 0.012 0.012 1231.257 1231.257 ImportDataIntoMongo.py:1(<module>) 1 0.001 0.001 1230.959 1230.959 ImportDataIntoMongo.py:187(main) 1 853.558 853.558 853.558 853.558 {raw_input} 1 0.598 0.598 370.510 370.510 ImportDataIntoMongo.py:165(insert_documents) 343407 9.965 0.000 359.034 0.001 ImportDataIntoMongo.py:137(read_csv_zip) 343408 2.927 0.000 287.035 0.001 c:\python27\lib\site-packages\pymongo\collection.py:489(find_one) 343408 1.842 0.000 274.803 0.001 c:\python27\lib\site-packages\pymongo\cursor.py:699(next) 343408 2.542 0.000 271.212 0.001 c:\python27\lib\site-packages\pymongo\cursor.py:644(_refresh) 343408 4.512 0.000 253.673 0.001 c:\python27\lib\site-packages\pymongo\cursor.py:605(__send_message) 343408 0.971 0.000 242.078 0.001 c:\python27\lib\site-packages\pymongo\connection.py:871(_send_message_with_response) Profile output when using index.intersection: >>> p.sort_stats('cumulative').print_stats(10) Wed Apr 11 16:21:31 2012 ImportDataIntoMongo.profile 41542960 function calls (41542536 primitive calls) in 2889.164 seconds Ordered by: cumulative time List reduced from 778 to 10 due to restriction <10> ncalls tottime percall cumtime percall filename:lineno(function) 1 0.028 0.028 2889.164 2889.164 ImportDataIntoMongo.py:1(<module>) 1 0.017 0.017 2888.679 2888.679 ImportDataIntoMongo.py:202(main) 1 2365.526 2365.526 2365.526 2365.526 {raw_input} 1 0.766 0.766 502.817 502.817 ImportDataIntoMongo.py:180(insert_documents) 343407 9.147 0.000 491.433 0.001 ImportDataIntoMongo.py:152(read_csv_zip) 343406 0.571 0.000 391.394 0.001 c:\python27\lib\site-packages\rtree-0.7.0-py2.7.egg\rtree\index.py:384(intersection) 343406 379.957 0.001 390.824 0.001 c:\python27\lib\site-packages\rtree-0.7.0-py2.7.egg\rtree\index.py:435(_intersection_obj) 686513 22.616 0.000 38.705 0.000 c:\python27\lib\site-packages\rtree-0.7.0-py2.7.egg\rtree\index.py:451(_get_objects) 343406 6.134 0.000 33.326 0.000 ImportDataIntoMongo.py:162(<dictcomp>) 346 0.396 0.001 30.665 0.089 c:\python27\lib\site-packages\pymongo\collection.py:240(insert) EDIT4 I have parallelized the code, but the results are still not very encouraging. I am convinced it could be done better. See my own answer to this question for details.

    Read the article

  • WPF data-bound ComboBox only shows first item of ItemsSource list

    - by Mark
    Hi all, I'm sure I'm doing something stupid but for the life of me I can't think of right now. I have a ComboBox that is data-bound to a list of Layout objects. The list is initially empty but things are added over time. When the list is updated by the model the first time, this update reflects properly in the ComboBox. However, subsequent updates never show up in the ComboBox even though I can see that the list itself contains these items. Since the first update works, I know the data-binding is OK - so what am I doing wrong here? Here's the XAML (abridged): <Grid HorizontalAlignment="Stretch"> <ComboBox ItemsSource="{Binding Path=SavedLayouts, diagnostics:PresentationTraceSources.TraceLevel=High}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedItem="{Binding LoadLayout}" Height="25" Grid.Row="1" Grid.Column="0"></ComboBox> </Grid> And the related part of the model: public IList<Layout> SavedLayouts { get { return _layouts; } } public Layout SaveLayout( String data_ ) { Layout theLayout = new Layout( SaveLayoutName ); _layouts.Add( theLayout ); try { return theLayout; } finally { PropertyChangedEventHandler handler = PropertyChanged; if( handler != null ) { handler( this, new PropertyChangedEventArgs( "SavedLayouts" ) ); } } } And finally, the layout class (abridged): public class Layout { public String Name { get; private set; } } In the output window, I can see the update occurring: System.Windows.Data Warning: 91 : BindingExpression (hash=64564967): Got PropertyChanged event from TickerzModel (hash=43624632) System.Windows.Data Warning: 97 : BindingExpression (hash=64564967): GetValue at level 0 from TickerzModel (hash=43624632) using RuntimePropertyInfo(SavedLayouts): List`1 (hash=16951421 Count=11) System.Windows.Data Warning: 76 : BindingExpression (hash=64564967): TransferValue - got raw value List`1 (hash=16951421 Count=11) System.Windows.Data Warning: 85 : BindingExpression (hash=64564967): TransferValue - using final value List`1 (hash=16951421 Count=11) But I get do not get this 11th item in the ComboBox. Any ideas?

    Read the article

  • Change right-click context menu options in VS2008

    - by Mark Ursino
    When I right-click in my class library, I get some quick options to create things, like an Item from the popup list (New Item...), a User Control, etc. E.g. Now in my web app project, I'd like to be able to get the User Control listed in the right-click menu just like Component and Class, so I don't have to click New Item... then choose it from there. Is there a way to do this in the configuration? I can't seem to figure it out in VS.

    Read the article

  • ASP.NET MVC: What is the correct way to redirect to pages/actions in MVC?

    - by Mark Redman
    I am fairly new to MVC but not sure exactly which Redirect... replaces the standard redirect used in WebForms ie the standard Response.Redirect() For instance, I need to redirect to other pages in a couple of scenarios: 1) WHen the user logs out (Forms signout in Action) I want to redirect to a login page 2) In a Controller or base Controller event eg Initialze, I want to redirect to another page (AbsoluteRootUrl + Controller + Action) It seems that multiple redirects get called in some cases which causes errors, something to do with the fact a page is already being redirected? How can cancel the current request and just redirect?

    Read the article

  • fix needed for bug in TextField/Text

    - by Mark
    Sort of a complicated scenario - just curious if anyone else could come up with something: I have a Text control and when I scroll it and stop the scroll with the cursor over some text that has a url, the cursor doesn't revert to a hand, and also flash player starts acting as if a selection is being made from the last cursor position. So IOW a bonafide bug in flash as far as I can determine. The above probably wasn't completely clear so let me elaborate. If you grab a scrollbar thumb and start moving it up and down, you don't actually have to keep the mouse pointer on the thumb while doing so. When you stop the scroll, the mouse pointer could be outside the browser window, inside your flash application, but not currently on the scroll bar thumb, or wherever. The previously mentioned bug occurs when you stop the scroll with the mouse pointer positioned over text with an html anchor (a hyperlink). At that point the cursor enters into some state of limbo, and doesn't show the url hand pointer, and furthermore acts as if some text selection is taking place from the last cursor position prior to the scroll. So the question would be, what sort of event could I simulate in code to jolt flash out of this erroneous state it is in. And furthermore in what event could I perform this simulated event (given that for example there is no AS3 event to signal the end of a scroll.) To be clear, the Text control in question is on a canvas, and that canvas (call it A) is on another canvas which actually owns the scrollbar, and scrolling takes place by changing the scrollRect of canvas A.

    Read the article

  • TCP Socket.Connect is generating false positives

    - by Mark
    I'm experiencing really weird behavior with the Socket.Connect method in C#. I am attempting a TCP Socket.Connect to a valid IP but closed port and the method is continuing as if I have successfully connected. When I packet sniffed what was going on I saw that the app was receiving RST packets from the remote machine. Yet from the tracing that is in place it is clear that the connect method is not throwing an exception. Any ideas what might be causing this? The code that is running is basically this IPEndPoint iep = new IPEndPoint(System.Net.IPAddress.Parse(m_ipAddress), m_port); Socket tcpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); tcpSocket.Connect(iep); To add to the mystery... when running this code in a stand alone console application, the result is as expected – the connect method throws an exception. However, when running it in the Windows Service deployment we have the connect method does not throw an exception. Edit in response to Mystere Man's answer How would the exception be swallowed? I have a Trace.WriteLine right above the .Connect method and a Trace.WriteLine right under it (not shown in the code sample for readability). I know that both traces are running. I also have a try catch around the whole thing which also does a Trace.Writeline and I don't see that in the log files anywhere. I have also enabled the internal socket tracing as you suggested. I don't see any exceptions. I see what appears to be successful connections. I am trying to identify differences between the windows service app and the diagnostic console app I made. I am running out of ideas though End edit Thanks

    Read the article

  • Empty Structures compile in VB 10+

    - by Mark Hurd
    This is at least a documentation error, if not a bug. In VB.NET prior to .NET 4.0 (i.e. VB.NET 7 through 9) an empty Structure declaration fails at compile-time with error BC30281: Structure 'MySimpleEmpty' must contain at least one instance member variable or Event declaration. E.g. The following two structures compile successfully in VB10, and not prior: Structure MySimpleEmpty End Structure Public Structure AnotherEmpty Public Const StillEmpty As Boolean = True End Structure I note the documentation for the Error BC30281 stops at VB9, but the documentation for the Structure statement still has the datamemberdeclarations as required even as of VB11 (.NET 4.5 VS2012). These two Structures compile in VB11 (VS2012) as well. (Thanks John Woo.) Is there some blog entry or documentation confirming this is an intended change or a bug in VB10 and later?

    Read the article

  • Remote stream multiple files in SOLR

    - by Mark
    I want to use SOLR's remote-streaming facility to extract and index the content of files. This works fine if I pass stream.file=xxx as a parameter to the http GET method. However, I have a lot of these, and want to batch them up (i.e. not have to have a GET per file). Is there a way I can do this in SOLR? e.g. I'd like to be able to POST some xml like this: <add> <doc stream_file="filename"> <field name="id">123</field> </doc> <doc>...

    Read the article

  • TargetInvocationException?

    - by Mark
    Why would these lines of code cause that exception private Dispatcher dispatcher = null; public DownloadManager(Dispatcher dispatcher = null) { this.dispatcher = dispatcher ?? Dispatcher.CurrentDispatcher; } When the DownloadManager is instantiated in the XAML like <Window.DataContext> <c:DownloadManager /> </Window.DataContext> ?

    Read the article

  • Default for generic type?

    - by Mark
    Is it possible to do something like public class PriorityQueue<TValue, TPriority=int> where TPriority : IComparable (note the =int) ? Before you suggest it, yes, I know I can just add another line: public class PriorityQueue<TValue> : PriorityQueue<TValue, int> { } But I'm wondering if it's possible to do it as a param.

    Read the article

  • OpenOffice Calc Macro: Run shell command and return output as result of custom function

    - by Mark
    I would like to write a custom OpenOffice function that runs a shell command and puts the result into the cell from which it was invoked. I have a basic macro working, but I can't find a way to capture the command's output. Function MyTest( c1 ) MyTest = Shell("bash -c "" echo hello "" ") End Function The above always returns 0. Looking at the documentation of the Shell command, I don't think it actually returns STDOUT. How would I capture the output so that I can return it in my function? Thanks!

    Read the article

  • Internal loop only runs once, containing loop runs endlessly

    - by Mark
    noob question I'm afraid. I have a loop that runs and rotates the hand of a clock and an internal loop that checks the angle of the hand if it is 90, 180, 270 and 360. On these 4 angles the corresponding div is displayed and its siblings removed. The hand loops and loops eternally, which is what I want, but the angle check only runs the loop once through the whole 360. As the hand passes through the angles it is correctly displaying and removing divs but is doesn't continue after the first revolution of the clock. I've obviously messed up somewhere and there is bound to be a more efficient way of doing all this. I am using jQueryRotate.js for my rotations. Thanks for your time. jQuery(document).ready(function(){ var angle = 0; setInterval(function(){ jQuery("#hand").rotate(angle); function movehand(){ if (angle == 90) { jQuery("#intervention").fadeIn().css("display","block").siblings().css("display","none"); } else if (angle == 180) { jQuery("#management").fadeIn().css("display","block").siblings().css("display","none"); } else if (angle == 270) { jQuery("#prevention").fadeIn().css("display","block").siblings().css("display","none"); } else if (angle == 360) { jQuery("#reaction").fadeIn().css("display","block").siblings().css("display","none"); } else {movehand;} }; movehand(); angle+=1; },10); });

    Read the article

  • Removing Redundant Data from a List<T>

    - by Mark
    I have a List of objects which are ordered. I would like to remove redundant objects where redundant does not necessarily mean duplicate. Here is an example: List<Point> points = new List<Point> { new Point(0, 10), new Point(1, 12), new Point(2, 16), new Point(3, 16), new Point(4, 16), new Point(5, 13), new Point(6, 16), }; I am interested in removing the new Point(3, 16) entry because it doesn't provide useful information; I already know that the element at 2=16 and the element at 4=16. The information that 3=16 doesn't do me any good in my application (because I already have the bounds {2,4}=16), so I would like to remove that entry. I'd also like to not that I want to keep the 5th and 6th entry because there are not consecutive entries where Y=16. Is there a slick way to do this with linq?

    Read the article

  • Powershell equivilent of python's if __name__ == '__main__':

    - by Mark Mascolino
    I am really fond of python's capability to do things like this: if __name__ == '__main__': #setup testing code here #or setup a call a function with parameters and human format the output #etc... This is nice because I can treat a Python script file as something that can be called from the command line but it remains available for me to import its functions and classes into a separate python script file easily without triggering the default "run from the command line behavior". Does Powershell have a similar facility that I could exploit? And if it doesn't how should I be organizing my library of function files so that i can easily execute some of them while I am developing them?

    Read the article

  • Using Maven to Deploy to Weblogic Clusters

    - by Mark Sailes
    org.codehaus.mojo weblogic-maven-plugin 2.9.1 We're currently using the weblogic maven plugin successfully to deploy to our local WebLogic 9.2 instances. When we try to deploy to a remote environment we have a problem. We use a two machine cluster, with the admin server and managed server on one machine, and another managed server on a seperate machine. When your plugin uploads the application to the admin server, it doesn't copy it to the second managed server on the seperate machine. This then causes the second managed server a problem, as it cannot find the application in the location where the admin server saved it on its own machine. Config below <configuration> <adminServerHostName>${weblogic.adminServerHostName}</adminServerHostName> <adminServerPort>${weblogic.adminServerPort}</adminServerPort> <adminServerProtocol>${weblogic.adminServerProtocol}</adminServerProtocol> <userId>${weblogic.userId}</userId> <password>${weblogic.password}</password> <upload>${weblogic.upload}</upload> <remote>${weblogic.remote}</remote> <verbose>${weblogic.verbose}</verbose> <debug>${weblogic.debug}</debug> <stage>${weblogic.stage}</stage> <targetNames>${weblogic.targetNames}</targetNames> <exploded>${weblogic.exploded}</exploded> </configuration> <profile> <id>localhost</id> <properties> <weblogic.adminServerHostName>localhost</weblogic.adminServerHostName> <weblogic.adminServerPort>7001</weblogic.adminServerPort> <weblogic.adminServerProtocol>t3</weblogic.adminServerProtocol> <weblogic.userId>weblogic</weblogic.userId> <weblogic.password>weblogic</weblogic.password> <weblogic.upload>false</weblogic.upload> <weblogic.remote>false</weblogic.remote> <weblogic.verbose>true</weblogic.verbose> <weblogic.debug>true</weblogic.debug> <weblogic.stage>false</weblogic.stage> <weblogic.targetNames>AdminServer</weblogic.targetNames> <weblogic.exploded>false</weblogic.exploded> </properties> </profile> <profile> <id>dev</id> <properties> <weblogic.adminServerHostName>******</weblogic.adminServerHostName> <weblogic.adminServerPort>9141</weblogic.adminServerPort> <weblogic.adminServerProtocol>t3</weblogic.adminServerProtocol> <weblogic.userId>******</weblogic.userId> <weblogic.password>******</weblogic.password> <weblogic.upload>true</weblogic.upload> <weblogic.remote>true</weblogic.remote> <weblogic.verbose>true</weblogic.verbose> <weblogic.debug>true</weblogic.debug> <weblogic.stage>true</weblogic.stage> <weblogic.targetNames>dev_cluster01</weblogic.targetNames> <weblogic.exploded>false</weblogic.exploded> </properties> </profile>

    Read the article

  • Php mail pulling form data from previous page

    - by Mark
    So I have a form being filled out on one php like so: <p> <label for="first_name">First Name: </label> <input type="text" size="30" name="first_name" id="first_name"/> </p> <p> <label for="last_name"> Last Name:</label> <input type="text" size="30" name="last_name" id="last_name"/> </p> <p> <label for="address_street">Street:</label> <input type="text" size="30" name="address_street" id="address_street"/> </p> <p> <label for="address_city">City:</label> <input type="text" size="30" name="address_city" id="address_city"/> </p> <p> <label for="address_state">State/Province:</label> <input type="text" size="30" name="address_state" id="address_state"/> </p> <p> <label for="email">Your e-mail: </label> <input type="text" size="30" name="email" id="email"/> </p> <p> <label for="phone">Your phone number: </label> <input type="text" size="30" name="phone" id="phone"/> </p> This is on one php page. From here, it goes to another php which part of it contains script to send a html email to recipient. Problem is, I cannot seem to get it to pull the variables even though I thought I declared them correctly and mixed them into the html correctly. <?php $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $to = "[email protected], [email protected]"; $subject = "HTML email for ALPS"; $message .= ' <html> <body> <div style="display: inline-block; width: 28%; float: left;"> <img src="http://englishintheusa.com/images/alps-logo.jpg" alt="ALPS Language School" /> </div> <div style="display: inline-block; width: 68%; float: right;"> <p style="color: #4F81BD; font-size: 20px; text-decoration: underline;">Thanks You For Your Inquiry!</p> </div> <div style="padding-left: 20px; color: #666666; font-size: 16.8px; clear: both;"> <p>Dear $first_name $last_name ,</p> </br > <p>Thank you for the following inquiry:</p> </br > </br > </br > </br > <p>****Comment goes here****</p> </br > </br > <p>We will contact you within 2 business days. Our office is open Monday-Friday, 8:30 AM - 5:00 PM Pacific Standard Time.</p> </br > <p>Thank you for your interest!</p> </br > </br > <p>Best Regards,</p> </br > </br > <p>ALPS Language School</p> </br > </br > <p>430 Broadway East</p> <p>Seattle WA 98102</p> <p>Phone: 206.720.6363</p> <p>Fax: 206. 720.1806</p> <p>Email: [email protected]</p> </div> </body> </html>'; // Always set content-type when sending HTML email $headers .= "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers mail($to,$subject,$message,$headers); ?> So you see where I am trying to get first_name and last_name. Well it doesn't come out correctly. Can someone help here?

    Read the article

  • Regex Remove Images with style tag from Html

    - by Mark Milford
    Hi I am new to Regex, however I decided it was the easiest route to what I needed to do. Basically I have a string (in PHP) which contains a whole load of HTML code... I want to remove any tags which have style=display:none... so for example <img src="" style="display:none" /> <img src="" style="width:11px;display: none" > etc... So far my Regex is: <img.*style=.*display.*:.*none;.* > But that seems to leave bits of html behind and also take the next element away when used in php with preg_replace.

    Read the article

  • What is the most efficient way to encode an arbitrary GUID into readable ASCII (33-127)?

    - by mark
    Dear ladies and sirs. The standard string representation of GUID takes about 36 characters. Which is very nice, but also really wasteful. I am wondering, how to encode it in the shortest possible way using all the ASCII characters in the range 33-127. The naive implementation produces 22 characters, simply because 128 bits / 6 bits yields 22. Huffman encoding is my second best, the only question is how to choose the codes.... Any more ideas? Thanks. P.S. The encoding must be lossless, of course.

    Read the article

  • hibernate insert to a collection causes a delete then all the items in the collection to be inserted

    - by Mark
    I have a many to may relationship CohortGroup and Employee. Any time I insert an Employee into the CohortGroup hibernate deletes the group from the resolution table and inserts all the members again, plus the new one. Why not just add the new one? The annotation in the Group: @ManyToMany(cascade = { PERSIST, MERGE, REFRESH }) @JoinTable(name="MYSITE_RES_COHORT_GROUP_STAFF", joinColumns={@JoinColumn(name="COHORT_GROUPID")}, inverseJoinColumns={@JoinColumn(name="USERID")}) public List<Employee> getMembers(){ return members; } The other side in the Employee @ManyToMany(mappedBy="members",cascade = { PERSIST, MERGE, REFRESH } ) public List<CohortGroup> getMemberGroups(){ return memberGroups; } Code snipit Employee emp = edao.findByID(cohortId); CohortGroup group = cgdao.findByID(Long.decode(groupId)); group.getMembers().add(emp); cgdao.persist(group); below is the sql reported in the log delete from swas.MYSITE_RES_COHORT_GROUP_STAFF where COHORT_GROUPID=? insert into swas.MYSITE_RES_COHORT_GROUP_STAFF (COHORT_GROUPID, USERID) values (?, ?) insert into swas.MYSITE_RES_COHORT_GROUP_STAFF (COHORT_GROUPID, USERID) values (?, ?) insert into swas.MYSITE_RES_COHORT_GROUP_STAFF (COHORT_GROUPID, USERID) values (?, ?) insert into swas.MYSITE_RES_COHORT_GROUP_STAFF (COHORT_GROUPID, USERID) values (?, ?) insert into swas.MYSITE_RES_COHORT_GROUP_STAFF (COHORT_GROUPID, USERID) values (?, ?) insert into swas.MYSITE_RES_COHORT_GROUP_STAFF (COHORT_GROUPID, USERID) values (?, ?) This seams really inefficient and is causing some issues. If sevral requests are made to add an employee to the group then some get over written.

    Read the article

  • In Symfony how can you instantely cache the routing.yml?

    - by Mark
    I have a file located at [application]/config/routing.yml, when I change something in there, the changes aren't active. This probably has to do with the cache as when I go into that directory [cache]/[application]/prod/config the currently active file can be seen config_routing.yml.php. The lifetime of the cache is generally 86400 seconds, is there a way that I can immediately view/activate the changes?

    Read the article

  • Are PDO prepared statements sufficient to prevent SQL injection?

    - by Mark Biek
    Let's say I have code like this: $dbh = new PDO("blahblah"); $stmt = $dbh->prepare('SELECT * FROM users where username = :username'); $stmt->execute( array(':username' => $_REQUEST['username']) ); The PDO documentation says The parameters to prepared statements don't need to be quoted; the driver handles it for you. Is that truly all I need to do to avoid SQL injections? Is it really that easy? You can assume MySQL if it makes a difference. Also, I'm really only curious about the use of prepared statements against SQL injection. In this context, I don't care about XSS or other possible vulnerabilities.

    Read the article

  • iPhone: How can you draw a piece of an image

    - by Mark
    Code sample - (void)drawRect:(CGRect)rect { [super drawRect:rect]; CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGContextTranslateCTM(context, 0, self.frame.size.height); CGContextScaleCTM(context, 1.0, -1.0); CGContextDrawImage(context, CGRectMake(0.0, 0.0, self.frame.size.width, self.frame.size.height), [UIImage imageNamed:@"sample.png"].CGImage); CGContextRestoreGState(context); } ================ I would like to copy a certain rect within an image to the context, so not the entire image is drawn but just a piece of the image. Does anyone have a solution for this? I can't find anything on google nor the documentation. I know there are alternatives like: 1. Create a UIView with clipping and then just position the UIImageView within it. 2. Create the UIImageView within the UIScrollView and use content offset. But I think those are lame...

    Read the article

  • Missing System.Core.dll and others on Visual Studio 2010 Project targeting 3.5 Framework

    - by Mark Struzinski
    I just got Visual Studio 2010 installed and running on my development machine (alongside VS 2008). The first thing I did was make a copy of an existing project and convert it up to the VS 2010 project. I told the conversion wizard to leave the project targeting the 3.5 framework. The project compiles and runs just fine in VS 2008. When I go to build it, several of my references are marked as missing (System.Core, System.Xml.Linq, System.Data.DataSetExtensions). When I go to the Add Reference dialog, they are not present. Yet if I view the GAC at C:\Windows\Assembly, I can see the entries there. I have tried converting the projects to 4.0, then back down to 3.5, and also unloading/reloading the projects. Nothing works. Has anyone else ran across this problem?

    Read the article

< Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >