Daily Archives

Articles indexed Sunday May 9 2010

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

  • SVN checkout/export too long to download

    - by sasayins
    Hi, My checkout/export session in svn is kinda weird. The file is just a 300KB in size but the downloading keeps going and it reaches a megabytes in size. The file is in RPM format. I don't know if the file is corrupt or the SVN has a bug. I tried to download the file using web browser and seems the downloading works fine. What probably is the main problem is here?

    Read the article

  • How to convert binary read/write to non-binary read/write in C++

    - by Phenom
    I have some C++ code from somewhere that reads and writes data in binary format. I want to see what it's reading and writing in the file, so I want to convert it's binary read and write to non-binary read and write. Also, when I convert the binary write to non-binary write, I want it to still be able to read in the information correctly. How can this be done? The write function: int btwrite(short rrn, BTPAGE *page_ptr) { // long lseek(), addr; long addr; addr = (long) rrn * (long) PAGESIZE + HEADERSIZE; lseek(btfd, addr, 0); return (write(btfd, page_ptr, PAGESIZE)); } The read function: int btread(short rrn, BTPAGE *page_ptr) { // long lseek(), addr; long addr; addr = (long)rrn * (long)PAGESIZE + HEADERSIZE; lseek(btfd, addr, 0); return ( read(btfd, page_ptr, PAGESIZE) ); }

    Read the article

  • drupal - override form action?

    - by n00b0101
    I originally started this question in another thread, but that thread was sorta, kinda answered, and now I primarily want to know how to specify another form action... I tried using the code below, but the form action, when output, remains unchanged, although looking at the print_r($form), it's correctly changed... Why isn't it picking up? function mytheme_user_profile_form($form) { global $user; $uid = $user->uid; //print '<pre>'; print_r($form); print '</pre>'; $category = $form['_category']['#value']; switch($category) { case 'account': $form['#action'] = '/user/'.$uid.'/edit?destination=user/'.$uid; break; case 'education': $form['#action'] = '/user/'.$uid.'/edit/education?destination=user/'.$uid; break; case 'experience': $form['#action'] = '/user/'.$uid.'/edit/experience?destination=user/'.$uid; break; case 'publications': $form['#action'] = '/user/'.$uid.'/edit/publications?destination=user/'.$uid; break; case 'conflicts': $form['#action'] = '/user/'.$uid.'/edit/conflicts?destination=user/'.$uid; break; } //print '<pre>'; print_r($form); print '</pre>'; //print $form['#action']; $output .= drupal_render($form); return $output;

    Read the article

  • Submit by pressing enter in a windows form

    - by Avik
    In order to transfer text from one textbox to another, I have created a submit button. However it would be preferable to use the functionality of the 'enter' key. I am not sure but i think the ascii code is 13.Anyway how do I go about this task at hand?

    Read the article

  • Best practice to calculate the average speed from GPS coordinates

    - by Sebi
    i have here a device which can give me gps coordinates. the time intervall i can define. i want to use it to calculate the average speed during driving or travelling by car. actually i used a orthodrome formula to calculate the distance between two points and then divided it by the given time intervall. by the implemenation i followed this term (http://de.wikipedia.org/wiki/Orthodrome#Genauere_Formel_zur_Abstandsberechnung_auf_der_Erde). Unfortunately i could only find a german link, but i think the formula should be understandable in any language ;) Unfortunately, using this formula and a time intverall of 1 seconds gives very unprecises results. the speed while walking is between 1 km/h and 20km/h. So i wonder if there is a general reference how to implement distance calculation between two gps coordinates (i found something similar on SO) and particulary, which is the best time intervall to update the GPS coordiantes.

    Read the article

  • Compact Framework development using C# Express Version

    - by Bobby Cannon
    I am wondering if one could use the C# Express version to do Compact Framework development. I've done some Google searches but I can't find a defiant answer. I have installed C# Express but there isn't a project template to select for "smart device" development. I will continue my search but I was hoping that the stackoverflow community may be able to assist in finding this information.

    Read the article

  • Getting the record ID just added with mysql prepared statements

    - by dmontain
    I'm inserting a record using PDO (very similar to mysqli). $addRecord->execute(); To know if the operation worked, I've learned that I can save it to a variable $result that can be used as true false $result = $addRecord->execute(); if ($result){ //add successful } else { //add unsuccessful } What I'd like to do is also get the record id just added. In the table, each record has an auto_incremented field called id. I tried doing this $new_id = $result['id']; but it seems that $result is purely boolean and doesn't actually hold the actual record that was added. Can someone confirm this and how would I then access the record just added? Note that several people may be adding to the same table at the same time, so I think getting just the last one would not be very accurate.

    Read the article

  • How to mass insert/update in linq to sql?

    - by chobo2
    Hi How can I do these 2 scenarios. Currently I am doing something like this public class Repository { private LinqtoSqlContext dbcontext = new LinqtoSqlContext(); public void Update() { // find record // update record // save record ( dbcontext.submitChanges() } public void Insert() { // make a database table object ( ie ProductTable t = new ProductTable() { productname ="something"} // insert record ( dbcontext.ProductTable.insertOnSubmit()) // dbcontext.submitChanges(); } } So now I am trying to load an XML file what has tons of records. First I validate the records one at a time. I then want to insert them into the database but instead of doing submitChanges() after each record I want to do a mass submit at the end. So I have something like this public class Repository { private LinqtoSqlContext dbcontext = new LinqtoSqlContext(); public void Update() { // find record // update record } public void Insert() { // make a database table object ( ie ProductTable t = new ProductTable() { productname ="something"} // insert record ( dbcontext.ProductTable.insertOnSubmit()) } public void SaveToDb() { dbcontext.submitChanges(); } } Then in my service layer I would do like for(int i = 0; i < 100; i++) { validate(); if(valid == true) { update(); insert() } } SaveToDb(); So pretend my for loop is has a count for all the record found in the xml file. I first validate it. If valid then I have to update a table before I insert the record. I then insert the record. After that I want to save everything in one go. I am not sure if I can do a mass save when updating of if that has to be after every time or what. But I thought it would work for sure for the insert one. Nothing seems to crash and I am not sure how to check if the records are being added to the dbcontext.

    Read the article

  • Deploying software on compromised machines

    - by Martin
    I've been involved in a discussion about how to build internet voting software for a general election. We've reached a general consensus that there exist plenty of secure methods for two way authentication and communication. However, someone came along and pointed out that in a general election some of the machines being used are almost certainly going to be compromised. To quote: Let me be an evil electoral fraudster. I want to sample peoples votes as they vote and hope I get something scandalous. I hire a bot-net from some really shady dudes who control 1000 compromised machines in the UK just for election day. I capture the voting habits of 1000 voters on election day. I notice 5 of them have voted BNP. I look these users up and check out their machines, I look through their documents on their machine and find out their names and addresses. I find out one of them is the wife of a tory MP. I leak 'wife of tory mp is a fascist!' to some blogger I know. It hits the internet and goes viral, swings an election. That's a serious problem! So, what are the best techniques for running software where user interactions with the software must be kept secret, on a machine which is possibly compromised?

    Read the article

  • ASP.NET MVC MapRoute problem

    - by MaxFX
    Default ASP.NET MVC project has one MapRoute like routes.MapRoute( "Default", "{controller}/", new { controller = "Home", action = "Index" } ); And urls like these are equivalent: www.mysite.com, w*ww.mysite.com/home*, www.mysite.com/home/index But if I trying to use a MapRoute like routes.MapRoute( "Sitemap", "{contoller}/{action}", new { controller = "Sitemap", action = "ShortMap" } ); and test url www.mysite.com/sitemap I recieve error 404 but I'm expecting that it's work like www.mysite.com/sitemap/shortmap How to write this MapRoute correctly?

    Read the article

  • Visual C# Express 2010 Beta 2 install fails [closed]

    - by RCIX
    I'm trying to install Microsoft Visual C# Express 2010 Beta 2 on my machine but it's not working. It blazes through what should be a 150 MB download then fails installing the very first item after about 5 seconds. I had VS 2010 Beta 1 installed but removed it beforehand. Any tips for installing it right? The problem signature is as follows: Problem signature: Problem Event Name: VSSetup Problem Signature 01: Microsoft Visual C# 2010 Express Beta 2 - ENU Problem Signature 02: 10.0.21006.01 Problem Signature 03: 10.0.21006.1 Problem Signature 04: 1 Problem Signature 05: GFN_MID Chained VC 90 Runtime for x86 Problem Signature 06: Repair_I_Interactive_Error Problem Signature 07: 0x0 Problem Signature 08: unknown Problem Signature 09: unknown OS Version: 6.1.7600.2.0.0.256.1 Locale ID: 1033

    Read the article

  • Delphi 2010 Calcualted Column In DBGrid

    - by Ken Lange
    I have a Delphi 2010 ADO program that has a DBGrid. Its dataset selects from an Access query. The query has a column defined as, CStr(Amount*UnitCount)+" "+Unit. The query works fine in Acecss. But the DBgrid refuses to show the values for this column

    Read the article

  • How to use global view files in Zend Framework?

    - by terrani
    Hi, I am trying to use global or shared view files. Let's say I have a module in Application/Modules/default and I have "IndexController.php" inside "default/controllers" within "IndexController", I would like to render a view that is located in "Application/Views". I tried to use addScriptPath, but Zend_View tries to look "Application/Views/index" directory. How do I eliminate "index" ?

    Read the article

  • claws-mail suddenly does not recognize my .claws-mail folder

    - by Mala
    Hi I turned my computer on today like any other day, and fired up my email-client claws-mail. However, instead of showing me my inbox, it just pops up the new-account wizard, as though my .claws-mail folder did not exist! I've double-checked that it's there, and that it (seems to) contain everything that it should. I tried running claws-mail from the terminal to see if it returned any useful messages about why it couldn't find my email account, but no dice... For reference, this is CM version 3.7.2 running on Gentoo kernel 2.6.31-gentoo-r6 (x86_64) Any clues as to how to get my beloved inbox/config back? Thanks!

    Read the article

  • Utility method - Pass a File or String?

    - by James P.
    Here's an example of a utility method: public static Long getFileSize(String fileString) { File file = new File(fileString); if (file == null || !file.isFile()) return null; return file.length(); } Is it a good practise to pass a String rather than a File to a method like this? In general what reasoning should be applied when making utility methods of this style?

    Read the article

  • How do I implement a dispatch table in a Perl OO module?

    - by Iain
    I want to put some subs that are within an OO package into an array - also within the package - to use as a dispatch table. Something like this package Blah::Blah; use fields 'tests'; sub new { my($class )= @_; my $self = fields::new($class); $self->{'tests'} = [ $self->_sub1 ,$self->_sub2 ]; return $self; } _sub1 { ... }; _sub2 { ... }; I'm not entirely sure on the syntax for this? $self->{'tests'} = [ $self->_sub1 ,$self->_sub2 ]; or $self->{'tests'} = [ \&{$self->_sub1} ,\&{$self->_sub2} ]; or $self->{'tests'} = [ \&{_sub1} ,\&{_sub2} ]; I don't seem to be able to get this to work within an OO package, whereas it's quite straightforward in a procedural fashion, and I haven't found any examples for OO. Any help is much appreciated, Iain

    Read the article

  • Error URL redirection

    - by xRobot
    urls.py: url(r'^book/(?P<booktitle>[\w\._-]+)/(?P<bookeditor>[\w\._-]+)/(?P<bookpages>[\w\._-]+)/(?P<bookid>[\d\._-]+)/$', 'book.views.book', name="book"), views.py: def book(request, booktitle, bookeditor, bookpages, bookid, template_name="book.html"): book = get_object_or_404(book, pk=bookid) if booktitle != book.book_title : redirect_to = "/book/%s/%s/%s/%s/%i/" % ( booktitle, bookeditor, bookpages, bookid, ) return HttpResponseRedirect(redirect_to) return render_to_response(template_name, { 'book': book, },) . So the urls of each book are like this: example.com/book/the-bible/gesu-crist/938/12/ I want that if there is an error in the url, then I get redirected to the real url by using book.id in the end of the url. For example if I go to: example.com/book/A-bible/gesu-crist/938/12/ the I will get redirected to: example.com/book/the-bible/gesu-crist/938/12/ but I go to wrong url I will get this error: TypeError at /book/A-bible/gesu-crist/938/12/ %d format: a number is required, not unicode . Why ? What I have to do ?

    Read the article

  • XMLHttpRequest leak in javascript. please help.

    - by Raja
    Hi everyone, Below is my javascript code snippet. Its not running as expected, please help me with this. <script type="text/javascript"> function getCurrentLocation() { console.log("inside location"); navigator.geolocation.getCurrentPosition(function(position) { insert_coord(new google.maps.LatLng(position.coords.latitude,position.coords.longitude)); }); } function insert_coord(loc) { var request = new XMLHttpRequest(); request.open("POST","start.php",true); request.onreadystatechange = function() { callback(request); }; request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); request.send("lat=" + encodeURIComponent(loc.lat()) + "&lng=" + encodeURIComponent(loc.lng())); return request; } function callback(req) { console.log("inside callback"); if(req.readyState == 4) if(req.status == 200) { document.getElementById("scratch").innerHTML = "callback success"; window.setTimeout("getCurrentLocation()",5000); } } getCurrentLocation(); //called on body load </script> What i'm trying to achieve is to send my current location to the php page every 5 seconds or so. i can see few of the coordinates in my database but after sometime it gets weird. Firebug show very weird logs like simultaneous POST's at irregular intervals. Here's the firebug screenshot: IS there a leak in the program. please help.

    Read the article

  • Why doesn't my Perl code work when I put it in a foreach loop?

    - by foxhop
    This code outputs the scalars in the row array properly: $line = "This is my favorite test"; @row = split(/ /, $line); print $row[0]; print $row[1]; The same code inside a foreach loop doesn't print any scalar values: foreach $line (@lines){ @row = split(/ /, $line); print $row[0]; print $row[1]; } What could cause this to happen? I am new to Perl coming from python. I need to learn Perl for my new position.

    Read the article

  • Having problem dynamically invoking unmanaged VB COM dll from c#?

    - by Ramesh Vel
    I have a problem calling unmanaged VB COM dll from c#. This is dynamic invocation using loadLibrary and GetProcAddress. I can successfully loaded the dll using loadLibrary , but the GetProcAddress always return 0. It wasnt log any error msg and nothing. it just returns 0. below the sample code VB COM VERSION 1.0 CLASS BEGIN MultiUse = -1 Persistable = 0 DataBindingBehavior = 0 DataSourceBehavior = 0 MTSTransactionMode = 0 END Attribute VB_Name = "Sample" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Option Explicit Private Attribute1 As String Private Sub Class_Initialize() Attribute1 = "test" End Sub Public Sub TestSub() End Sub Public Function testFunction() As String testFunction = "default.html" End Function Public Function SetData(XML As String) As String SetData = Date + Time End Function c# code static class UnManagedInvoker { [DllImport("kernel32.dll")] private static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string dllToLoad); [DllImport("kernel32.dll")] private static extern IntPtr GetProcAddress(IntPtr hModule, [MarshalAs(UnmanagedType.LPStr)] string procedureName); [DllImport("kernel32.dll")] private static extern bool FreeLibrary(IntPtr hModule); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate string MethodToInvoke(string sdata); public static string InvokeUnmanagedDll(string dllPath, string methodName) { IntPtr DIedDll = LoadLibrary(dllPath); IntPtr AddressOfFunction = GetProcAddress(DIedDll, methodName); MethodToInvoke MI = (MethodToInvoke)Marshal.GetDelegateForFunctionPointer(AddressOfFunction, typeof(MethodToInvoke)); string data = MI("ssdasda"); FreeLibrary(DIedDll); return data; } } And the calling code string res = UnManagedInvoker.InvokeUnmanagedDll("xx.dll","SetData"); Can someone help me out.. Update: I can successfully call the methods if the component is registered. using the below code Type Med = Type.GetTypeFromCLSID(new Guid("089DD8B0-E12B-439B-B52C-007CA72C93D0")); object MedObj = Activator.CreateInstance(Med); object[] parameter = new object[1]; parameter[0] = "asdasd"; var ss = Med.InvokeMember("SetData", System.Reflection.BindingFlags.InvokeMethod, null, MedObj, parameter); is there a way if the dll not registered.?

    Read the article

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