It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I've a problem with the Phonegap File API.
Here a simple example of my problem :
function gotFileWriter(writer) {
for(var i=0;i<300;i++){
alert(i);
writer.write(i);
}
}
Navigator alert 0.
0 is written is the file
Navigator alert 1.
And nothing else.
Thanks
PhoneGap file operations are async. What is most probably happening is that the first write has not finished before you call the second write which would cause an exception, a PendingOperation one IIRC. You will either want to build up a string with all the information you want to write to the file and send it over in one write command or you'll need to wait for the onwriteend event from the FileWriter before you can write the next item.
Take a look at the FileWriter full example for an idea of how to use onwriteend.
http://docs.phonegap.com/en/1.3.0/phonegap_file_file.md.html#FileWriter
Related
Closed. This question is not written in English. It is not currently accepting answers.
Stack Overflow is an English-only site. The author must be able to communicate in English to understand and engage with any comments and/or answers their question receives. Don't translate this post for the author; machine translations can be inaccurate, and even human translations can alter the intended meaning of the post.
Closed 9 days ago.
This post was edited and submitted for review 9 days ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
Good day people, sorry to bother with a consultation that is sure is very easy but I am very new to the subject and there are simple things that complicate me. The issue is that I have a Form which is the main screen and from the menu I call another Form (Customers) and without closing this second I want to open a third (Articles) but it does not let me open it until the first child closes. This is all in C#. I would appreciate it if someone could explain to me how I should do it. Thank you
I've always called with .Show() but in this case I do not know how to do it
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to make my own message dispatcher in C...
For example, I want to send a message to MyButton or MyWindow structures.
And these structures have their own handlers.
Have any gurus any suggestions?
PS: for embedded application (using microcontroller)
PPS: thanks to sean - this is what I need.
My simple interpretation of sean's advice:
typedef void (*MyHandler)(size_t param);
MyHandler Handlers[32];
void RegisterHandlers(size_t id, MyHandler handler) {
Handlers[id] = handler;
}
void SendMessage(size_t id, size_t param) {
Handlers[id](param);
}
To implement this I would do the following:
Design a thread safe container for the events that are fired, a queue.
Then I would design a system to tie an event id, string or a integer, to a function through way of a hash table or some other mechanism like that.
After these two chunks are made you just need a way to register event id's with a function pointer and then just have a common way to send parameters to the functions and that's pretty much all there needs to be done with a message dispatcher. You push messages to the queue and then you pop things off the queue and react to whatever the message contains.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
The GetPattern() method implementation of WPF UI Automation system is implemented taking the enum parameter PatternInterface and we normally use it in the following way:
//Code with original implementation
ButtonAutomationPeer buttonPeer = new ButtonAutomationPeer(button1);
IInvokeProvider provider = (IInvokeProvider)buttonPeer.GetPattern(PatternInterface.Invoke); //Line in Question
//To invoke the click event of button we then use the following code:
provider.Invoke();
From the above code, it seems that the line with comment Line in Question is not strongly typed, we need to cast the return from GetPattern() method to the required interface and then use it to invoke the specific UI automations.
Question is:
Would it not have been better if the implementation of the GetPattern() method in WPF was done using already present Generics in .Net Framework as below:
public T GetPattern<T>;
where, I would then pass the required interface pattern name while
calling the GetPattern<T> method and get that interface instance
strongly typed and would also not need a cast. What
thought has Microsoft given in the original implementation of
GetPattern() method requiring an enum?
Would using enums in the method parameters not break the
maintainability of the GetPattern() original implementation. I
would say that when a new Control interface pattern is needed to be
supported, that pattern interface's enum value would need to be
added to the enum parameter named PatternInterface
I suppose it is easier and better to call the method and get the interface pattern using the below new code that uses calling the Generic implementation:
//Code with New Generics based implementation
ButtonAutomationPeer buttonPeer = new ButtonAutomationPeer(button1);
IInvokeProvider provider = buttonPeer.GetPattern<IInvokeProvider>(); //Line in Question
//To invoke the click event of button we then use the following code:
provider.Invoke();
It is for the usual reason: they didn't have a time machine. Visible from the "History" annotations in the source code files available from the Reference Source, work on the UI Automation classes started around June 2003 with evidence that it got derived from earlier work. Generics didn't become available until 2005.
From dd/wpf/src/UIAutomation/UIAutomationTypes/System/Windows/AutomationPattern.cs:
// History:
// 06/02/2003 : BrendanM Ported to WCP
Which was very likely Brendan McKeon. No decent guess at what "WCP" might have meant.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have created a windows service, however when I start the service I get a 1053 error.I have installed .net framework 4 on my machine.can anybody help!!
More than likely you are doing to much in the OnStart(). Try something like this.
'Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
Try
Dim worker = New Thread(AddressOf DoWork)
worker.Name = "MyWork"
worker.IsBackground = False
worker.Start()
Catch ex As Exception
'write to a log somewhere, however you usually handle your errors
End Try
End Sub'
Try something like that but we really do need more information to help you
You absolutely need to debug further. As others have already pointed out, "error 1053" is too generic to help much.
1) Read this link. It tells you how to debug a service in Visual Studio. You'll need to create a dummy "OnStart()" method (so that you can debug the "real" OnStart):
http://msdn.microsoft.com/en-us/library/7a50syb3%28v=vs.80%29.aspx
2) Here's a good article on Windows Event logging:
http://www.codeproject.com/Articles/39218/How-To-Create-a-Windows-Event-Log-and-Write-your-C
For starters (if you don't already have your own event log), I'd consider just appending "printf's" to a text file
3) Once you've isolated the problem to a specific part of your code, feel free to post it here.
'Hope that helps!
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I am trying to save email like example#gmail.com to the model and then save to the server using backbone.
When i am sending normal words like "sdnfkjs" , it is saving correctly and sending model to server.
But when i am sending "example#gmail.com" it is saying "400 Bad Request" with the url like this :->
...test/contact_email/sdf#hjkg.com/tid/2924 400 Bad Request
What should be the reason ?
Thanks
You might want to use with the built in Javascript encoder/decoder :
encodeURIComponent("example#gmail.com") // returns "example%40gmail.com"
decodeURIComponent("example%40gmail.com") // returns "exampl#gmail.com"