Search Results

Search found 9082 results on 364 pages for 'c functions'.

Page 156/364 | < Previous Page | 152 153 154 155 156 157 158 159 160 161 162 163  | Next Page >

  • C#: My callback function gets called twice for every Sent Request

    - by Madi D.
    I've Got a program that uploads/downloads files into an online server,Has a callback to report progress and log it into a textfile, The program is built with the following structure: public void Upload(string source, string destination) { //Object containing Source and destination to pass to the threaded function KeyValuePair<string, string> file = new KeyValuePair<string, string>(source, destination); //Threading to make sure no blocking happens after calling upload Function Thread t = new Thread(new ParameterizedThreadStart(amazonHandler.TUpload)); t.Start(file); } private void TUpload(object fileInfo) { KeyValuePair<string, string> file = (KeyValuePair<string, string>)fileInfo; /* Some Magic goes here,Checking The file and Authorizing Upload */ var ftiObject = new FtiObject () { FileNameOnHDD = file.Key, DestinationPath = file.Value, //Has more data used for calculations. }; //Threading to make sure progress gets callback gets called. Thread t = new Thread(new ParameterizedThreadStart(amazonHandler.UploadOP)); t.Start(ftiObject); //Signal used to stop progress untill uploadCompleted is called. uploadChunkDoneSignal.WaitOne(); /* Some Extra Code */ } private void UploadOP(object ftiSentObject) { FtiObject ftiObject = (FtiObject)ftiSentObject; /* Some useless code to create the uri and prepare the ftiObject. */ // webClient.UploadFileAsync will open a thread that // will upload the file and report // progress/complete using registered callback functions. webClient.UploadFileAsync(uri, "PUT", ftiObject.FileNameOnHDD, ftiObject); } I got a callback that is registered to the Webclient's UploadProgressChanged event , however it is getting called twice per sent request. void UploadProgressCallback(object sender, UploadProgressChangedEventArgs e) { FtiObject ftiObject = (FtiObject )e.UserState; Logger.log(ftiObject.FileNameOnHDD, (double)e.BytesSent ,e.TotalBytesToSend); } Log Output: Filename: C:\Text1.txt Uploaded:1024 TotalFileSize: 665241 Filename: C:\Text1.txt Uploaded:1024 TotalFileSize: 665241 Filename: C:\Text1.txt Uploaded:2048 TotalFileSize: 665241 Filename: C:\Text1.txt Uploaded:2048 TotalFileSize: 665241 Filename: C:\Text1.txt Uploaded:3072 TotalFileSize: 665241 Filename: C:\Text1.txt Uploaded:3072 TotalFileSize: 665241 Etc... I am watching the Network Traffic using a watcher, and only 1 request is being sent. Some how i cant Figure out why the callback is being called twice, my doubt was that the callback is getting fired by each thread opened(the main Upload , and TUpload), however i dont know how to test if thats the cause. Note: The reason behind the many /**/ Comments is to indicate that the functions do more than just opening threads, and threading is being used to make sure no blocking occurs (there a couple of "Signal.WaitOne()" around the code for synchronization)

    Read the article

  • VBScript: Passing Object to Function?

    - by ioplex
    The below example generates an error: VBScript compilation error: Cannot use parentheses when calling a Sub This error does not occur if all parameters are not objects. Is there a special way to pass object parameters to VBScript functions? Option Explicit Dim obj Function TestFunc(obj) WScript.Echo "Why doesn't this work?" End Function Set obj = CreateObject("Scripting.Dictionary") obj.Add("key", "val") TestFunc(obj) ' Error here!

    Read the article

  • Create thread is not accepting the member functon

    - by prabhakaran
    I am trying to create a class for network programming. This will create a general purpose socket with thread. But when I tried to creat the thread using createthread(). The third argument is producing errors. And from the net I came to know that I can't use the member functions as a argument to the createthread(). Is there any thing by which I can achieve this.

    Read the article

  • output with "Private`" Content in Mathematica Package

    - by madalina
    Hello everyone, I am trying to solve the following implementation problem in Mathematica 7.0 for some days now and I do not understand exactly what is happening so I hope someone can give me some hints. I have 3 functions that I implemented in Mathematica in a source file with extension *.nb. They are working okay to all the examples. Now I want to put these functions into 3 different packages. So I created three different packages with extension .*m in which I put all the desired Mathematica function. An example in the "stereographic.m" package which contain the code: BeginPackage["stereographic`"] stereographic::usage="The package stereographic...." formEqs::usage="The function formEqs[complexBivPolyEqn..." makePoly::usage="The function makePoly[algebraicEqn] ..." getFixPolys::usage="The function..." milnorFibration::usage="The function..." Begin["Private`"] Share[]; formEqs[complex_,{m_,n_}]:=Block[{complexnew,complexnew1, realeq, imageq, expreal, expimag, polyrealF, polyimagF,s,t,u,v,a,b,c,epsilon,x,y,z}, complexnew:=complex/.{m->s+I*t,n->u+I*v}; complexnew1:=complexnew/.{s->(2 a epsilon)/(1+a^2+b^2+c^2),t->(2 b epsilon)/(1+a^2+b^2+c^2),u->(2 c epsilon)/(1+a^2+b^2+c^2),v->(- epsilon+a^2 epsilon+b^2 epsilon+c^2 epsilon)/(1+a^2+b^2+c^2)}; realeq:=ComplexExpand[Re[complexnew1]]; imageq:=ComplexExpand[Im[complexnew1]]; expreal:=makePoly[realeq]; expimag:=makePoly[imageq]; polyrealF:=expreal/.{a->x,b->y,c->z}; polyimagF:=expimag/.{a->x,b->y,c->z}; {polyrealF,polyimagF} ] End[] EndPackage[] Now to test the function I load the package Needs["stereographic`"] everything is okay. But when I test the function for example with formEqs[x^2-y^2,{x,y}] I get the following ouput: {Private`epsilon^2 + 2 Private`x^2 Private`epsilon^2 + Private`x^4 Private`epsilon^2 - 6 Private`y^2 Private`epsilon^2 + 2 Private`x^2 Private`y^2 Private`epsilon^2 + Private`y^4 Private`epsilon^2 - 6 Private`z^2 Private`epsilon^2 + 2 Private`x^2 Private`z^2 Private`epsilon^2 + 2 Private`y^2 Private`z^2 Private`epsilon^2 + Private`z^4 Private`epsilon^2, 8 Private`x Private`y Private`epsilon^2 + 4 Private`z Private`epsilon^2 - 4 Private`x^2 Private`z Private`epsilon^2 - 4 Private`y^2 Private`z Private`epsilon^2 - 4 Private`z^3 Private`epsilon^2} Of course I do not understand why Private` appears in front of any local variable which I returned in the final result. I would want not to have this Private` in the computed output. Any idea or better explanations which could indicate me why this happens? Thank you very much for your help. Best wishes, madalina

    Read the article

  • Dynamic content doesn't work when loaded with ajax

    - by Wurlitzer
    I'm trying to load some dynamic content after the user has logged in, using $.ajax, like so: $.ajax({ url: "functions.php", type: "GET", data: login_info, datatype: 'html', async: false, success: function (response) { $('#main').html(response); } }); The problem is, that some events don't work, when loaded this way. I fixed the buttons with the .live() method, but a sortable list for example, doesn't work. How can I somehow refresh the DOM, and let jquery know of these new added elements? Thanks!

    Read the article

  • c# delegete creation and activation

    - by aharont
    I have two functions: double fullFingerPrinting(string location1, string location2, int nGrams) double AllSubstrings(string location1, string location2, int nGrams) I want to go in a loop and activate each function in its turn, and after each function I also want to print the name of the function, how can I do that?

    Read the article

  • Problem with the POSIX module

    - by planetp
    After moving my mod_perl site from Linux hosting to FreeBSD, I have this error in the logfile: Your vendor has not defined POSIX macro SIGRTMIN, used at ../../lib/POSIX.pm (autosplit into ../../lib/auto/POSIX/SigRt/_init.al) line 993\n The script just imports POSIX and utilizes some functions (ceil, etc) How can I solve this issue ?

    Read the article

  • vim unicode bufread/bufwrite script

    - by anon
    Problem: I want my unicode characters to be stored on disk as (rather tan utf8/16 encoding) \u#### However, I want them dispalyed as unicode characters when opened up in vim. I think the easiest way to acheive this is some bufopen/bufwrite script that automatically: on opening, convert \u#### to unicode character on writing, convert unicode characters into \u#### However, I don't know what functions to call to make this happen. Can someone lend a hand? Thanks!

    Read the article

  • Editing an UIImage

    - by wwrob
    I have an UIImage that I want to edit (say, make every second row of pixels black). Now I am aware of the functions that extract PNG or JPEG data from the image, but that's raw data and I have no idea how the png/jpeg files work. Is there a way I can extract the colour data from each pixel into an array? And then make a new UIImage using the data from the array?

    Read the article

  • On-demand refresh mode for indexed view (=Materialized views) on SQL Server?

    - by MOLAP
    I know Oracle offers several refreshmode options for their materialized views (on demand, on commit, periodically). Does Microsoft SQLServer offer the same functions for their indexed views? If not, how can I else use indexed views on SQLServer if my purpose is to export data on a daily+ on-demand basis, and want to avoid performance overhead problems? Does a workaround exist?

    Read the article

  • Where are the function literals in c++?

    - by academicRobot
    First of all, maybe literals is not the right term for this concept, but its the closest I could think of (not literals in the sense of functions as first class citizens). The idea is that when you make a conventional function call, it compiles to something like this: callq <immediate address> But if you make a function call using a function pointer, it compiles to something like this: mov <memory location>,%rax callq *%rax Which is all well and good. However, what if I'm writing a template library that requires a callback of some sort with a specified argument list and the user of the library is expected to know what function they want to call at compile time? Then I would like to write my template to accept a function literal as a template parameter. So, similar to template <int int_literal> struct my_template {...};` I'd like to write template <func_literal_t func_literal> struct my_template {...}; and have calls to func_literal within my_template compile to callq <immediate address>. Is there a facility in C++ for this, or a work around to achieve the same effect? If not, why not (e.g. some cataclysmic side effects)? How about C++0x or another language? Solutions that are not portable are fine. Solutions that include the use of member function pointers would be ideal. I'm not particularly interested in being told "You are a <socially unacceptable term for a person of low IQ>, just use function pointers/functors." This is a curiosity based question, and it seems that it might be useful in some (albeit limited) applications. It seems like this should be possible since function names are just placeholders for a (relative) memory address, so why not allow more liberal use (e.g. aliasing) of this placeholder. p.s. I use function pointers and functions objects all the the time and they are great. But this post got me thinking about the don't pay for what you don't use principle in relation to function calls, and it seems like forcing the use of function pointers or similar facility when the function is known at compile time is a violation of this principle, though a small one.

    Read the article

  • Executing Page Page Load from Popup

    - by cem
    Hi, is it possible to trigger Parent's page load event from a popup.When i use javascript function window.parent.document.form.submit,this creates a postback.I want a function which creates "reload" for page because some of my functions work in the "if not postback" statement.

    Read the article

  • OpenCV performance in different languages

    - by h0b0
    I'm doing some prototyping with OpenCV for a hobby project involving processing of real time camera data. I wonder if it is worth the effort to reimplement this in C or C++ when I have it all figured out or if no significant performance boost can be expected. The program basically chains OpenCV functions, so the main part of the work should be done in native code anyway.

    Read the article

  • Calendar event correct PHP script

    - by Marin
    Hello everybody! I need somebody(If you have time:) ) to help me find a good Calendar event script that functions:)Please help me.Thank you in advance:) Ps:I am looking for a complete web application which will run on a WAMP environment and has a GUI based installer or minimal command line installation requirements

    Read the article

  • Combining graphs in Mathematica

    - by pizziaolo
    Any idea how I can overlay the following two functions to compare them? ln[1]:= p1 = Plot[(E^((Pi/6)^(1/3)/x) (Pi/6)^(2/3))/((-1 + E^((Pi/6)^(1/3)/x))^2 x^2), {x, -2.2, 2.2}] ln[2]:= p2 = Plot[(E^((Pi/6)^(1/3)/t) (Pi/6)^(2/3))/((-1 + E^((Pi/6)^(1/3)/t))^2 t^2), {t, 0, 2.0}] When I try Show[p1,p2] it doesn't work

    Read the article

  • Core Location and speed measurements

    - by Krumelur
    Does anyone know if Core Location in the iPhone OS uses anything but simple vector math to calculate speed? I've read that the GPS system can provide speed measurements that can be accurate when position is not (I believe using the Doppler shifts of the signals). I've tried and failed to see if the iPhone does this. The question is basically, does this data contain information or is it just convenience functions, using (filtered?) location data?

    Read the article

  • How to display formated Calendar type in JSTL?

    - by maectpo
    Hi, I am using Calendar type in Java and I would like to display formated date in jstl. I was trying: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <fmt:parseDate var="date" type="date" dateStyle="short" value="${photo.dateCreated}" /> <c:out value="${data}" /> But it doesn't work: java.text.ParseException: Unparseable date Can JSP format "Calendar" type?

    Read the article

  • Dreamweaver javascript code hints

    - by xdevel2000
    I'd to use DW cs 4 but before to buy I want to test javascript code hints. However that feature doesn't work at all. I have an external .js library and then into an html file I load it but when I type functions or object by name nothing happen. Any idea?

    Read the article

  • Reopening serial port fails if not closed properly with CloseHandle

    - by superg
    I am working with USB device on Windows that is seen as a virtual serial port. I can communicate with the device using CreateFile and ReadFile functions, but in some cases my application does not call CloseHandle (when my application in development crashes). After that all calls to CreateFile fail (ERROR_ACCESS_DENIED), and the only solution is to log in to my computer again. Is there any way to force closing the open handle (or reopening) programmatically?

    Read the article

  • Need to know how to properly create a new object in another cpp file

    - by karikari
    I have a class. The problem now is, after a few attempt, I'm still in huge error. My problem is I don't know how to properly declare a new object for this class, inside another cpp file. I wanted to call/trigger the functions from this RebarHandler class from my other cpp file. I keep on getting problems like, 'used without being initialized', 'debug assertion failed' and so on. In the other cpp file, I include the RebarHandler.h and did like this: CRebarHandler *test=NULL; test->setButtonMenu2(); When compile, I does not give any error. But, when run time, it gives error and my IE crash. I need help. Below is the class I meant: #pragma once class CIEWindow; class CRebarHandler : public CWindowImpl<CRebarHandler>{ public: CRebarHandler(HWND hWndToolbar, CIEWindow *ieWindow); CRebarHandler(){}; ~CRebarHandler(); BEGIN_MSG_MAP(CRebarHandler) NOTIFY_CODE_HANDLER(TBN_DROPDOWN, onNotifyDropDown) NOTIFY_CODE_HANDLER(TBN_TOOLBARCHANGE, onNotifyToolbarChange) NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, onNotifyCustomDraw) NOTIFY_CODE_HANDLER(TBN_ENDADJUST, onNotifyEndAdjust) MESSAGE_HANDLER(WM_SETREDRAW, onSetRedraw) END_MSG_MAP() // message handlers LRESULT onNotifyDropDown(WPARAM wParam, LPNMHDR pNMHDR, BOOL& bHandled); LRESULT onNotifyToolbarChange(WPARAM wParam, LPNMHDR pNMHDR, BOOL& bHandled); LRESULT onNotifyCustomDraw(WPARAM wParam, LPNMHDR pNMHDR, BOOL& bHandled); LRESULT onNotifyEndAdjust(WPARAM wParam, LPNMHDR pNMHDR, BOOL& bHandled); LRESULT onSetRedraw(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); // manage the subclassing of the IE rebar void subclass(); void unsubclass(); void handleSettings(); void setButtonMenu2(); bool findButton(HWND hWndToolbar); private: // handles to the various things HWND m_hWnd; HWND m_hWndToolbar, m_hWndRebar, m_hWndTooltip; HMENU m_hMenu; int m_buttonID; int m_ieVer; CIEWindow *m_ieWindow; // toolbar finding functions void scanForToolbarSlow(); void getRebarHWND(); void setButtonMenu(); };

    Read the article

  • Validate input parameters in VB?

    - by EdOxH
    Should I validate input parameters on all functions I create? Input isn't passed from a user, but from other routines as part of an automatic process. I use error handling. I'm not sure what more validating input could do for me. If the input isn't valid, that's pretty much the same thing as an error, isn't it?

    Read the article

  • In flex how do I pass data retrieved from a remote object service to a modules interface?

    - by Dan G
    I found at this Adobe tutorial a nice "RemoteService" class that creates a RemoteObject and contains the functions for handling the result and fault events. If I wanted to use this approach, how could I pass the data from the result handler to interfaces that modules from the main application could use? I could put the RemoteService/RemoteObject in the modules, but (in my opinion- and I could be wrong) the best design seems to be using the remote calls in the main app and passing the data along to the modules.

    Read the article

  • Can an algorithmic process ever give true random numbers ?

    - by Arkapravo
    I have worked with random functions in python,ruby, MATLAB, Bash and Java. Nearly every programming language has a function to generate Random numbers. However, these apparently random sequences are termed as pseudo-random number sequences as the generation follows a deterministic approach, and the sequence seems to repeat (usually with a very large period). My question, can an algorithmic/programming process ever yield true random numbers ? The questions probably is more of theoretical computer science than just programming !

    Read the article

  • How do you avoid an invalid search space in a genetic algorithm?

    - by Dave
    I am developing a GA for a school project and I've noticed that upon evaluating my functions for fitness, an individual is equivalent to its inverse. For example, the set (1, 1, -1, 1) is equivalent to (-1, -1, 1, -1). To shrink my search space and reach a solution more efficiently, how can I avoid my crossovers from searching in this second half of the search space?

    Read the article

< Previous Page | 152 153 154 155 156 157 158 159 160 161 162 163  | Next Page >