c#,javascript,silverlight,asynchronous,webbrowser-controlRelated issues-Collection of common programming errors
Nathan Campos
c# visual-studio windows-mobile-5.0 fatal-error
I was compiling my Windows Mobile project that is a image viewer and just when I clicked in the build button I got this error:CVTRES : fatal error CVT1105: cannot seek in fileI’m using Windows 7 Ultimate with Visual Studio 2008 SP1.
Robbie Dee
c# inheritance
Knowing that C# doesn’t support multiple inheritance, is it considered bad form to write a utility base class?Some initial thoughts:I could create an interface and a concretion, but then the implementation isn’t portable Should the developer need to extend the class in say, a decorator pattern, they could implement this new class and inherit the base class in their new classEDIT:N.B. I’m not talking about vanilla inheritance here e.g. poodle<–dog<–mammal<–animalMore this sort of thin
p.s.w.g
c# coding-style coding-standards teamwork
I have one one software system which allows developers to specify an ID or name to create NodeReferences. Both work fine, but ID’s are not guaranteed to be the same across different environments. I’ve tried in documentation and in conversations to stress that ID’s should not be hard coded (since they will break when deployed to a different environments), but some developers are still using them. This works only in dev environment:var level = LevelReference.ById(20); var node = NodeReference.ByNa
Andrei
c# .net git debugging
When our application doesn’t work the way we expect it to (e.g. throws exceptions etc.), I usually insert a lot of debug code at certain points in the application in order to get a better overview of what exactly is going on, what the values for certain objects are, to better trace where this error is triggered from. Then I send a new installer to the user(s) that are having the problem and if the problem is triggered again I look at the logs and see what they say.But I don’t want all this debug
Ismail Gunes
mysql c#
I use this query for loading sql data from my pc to localhost mysql database.(version 5.0.10 working witj XAMPP)The query is as below:cmd = new MySqlCommand(“LOAD DATA LOCAL INFILE ‘” + filename + “‘ IGNORE INTO TABLE ” + tblname + ” CHARACTER SET UTF8″, conn);And I tried this also (enclosed tblname) cmd = new MySqlCommand(“LOAD DATA LOCAL INFILE ‘” + filename + “‘ INTO TABLE `” + tblname + “` CHARACTER SET UTF8”, conn);And one line of my sql data (loaded without problem by phpmyadmin) :INSERT I
Max Vernon
c# oracle
I have an Oracle server running on Windows Server. When an INSERT statement runs I receive an Oracle Ora-00603 error. The insert statement just tries to insert a BLOB into a table. I searched the error specification on Google and found that perhaps there are network connection issues. The suggested action is to log in again to Oracle Server. I followed this tip, however I still receive the same error.The error I receive is the following:ora-00603: ORACLE server session terminated by fatal error
MikroDel
c# refactoring unit-testing wcf
I have WCF Service. Its work fine and I want to have test coverage for it. Unit tests and acceptance. The problem is static class using in the code. How is it possible to avoid it?If it will be refactored to the code without static classes – I can use mocks for example Moq.I have also used Ninject as DI Framework so far.[ServiceContract]public interface IWorkingService{[OperationContract]Collection<Ergebnis> UpdateEntity(int entityID);}public class WorkingService : IWorkingService{private
Jamal
c# networking socket tcp
I’ve only been coding C# a few weeks and was just hoping for a little constructive criticism of a socket server I’ve been working on:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net.Sockets; using System.Net;namespace NetworkCommunication {public class TCPSocketServer : IDisposable{private int portNumber;private int connectionsLimit;private Socket connectionSocket;private List<StateObject> connectedClients = new List<StateObject>(
kmp
c# .net
I saw this question “Is this implementation of an Asynchronous TCP/UDP Server correct” and it is very similar to what I want to do but it goes about it in a different way so I am wondering if anyone would mind doing some constructive critism on my method please.I’m looking for any feedback along the lines of “when x happens your server will fall over because of y” or something like that.My intention is that the server should log out errors that happen and raise an event when it has data. I wan
tesicg
c#
The code I want to refactor look as following:public bool CheckPay(Int64 orderID) {vpc_OrderInfo = orderID;RequestParams =string.Format(“vpc_Version={0}&vpc_Command={1}&vpc_AccessCode={2}&vpc_MerchTxnRef={3}&vpc_Merchant={4}&vpc_User={5}&vpc_Password={6}”,vpc_Version, vpc_Command, vpc_AccessCode, vpc_MerchTxnRef, vpc_Merchant, vpc_User, vpc_Password);string[] response = SendRequest(vpc_VirtualPaymentClientURL, RequestParams).Split(‘&’);bool ResponseCode = false;bool e
Jamal
javascript jquery datetime plugin twitter
I’ve built a Twitter plugin recently and was wondering if I could get some feedback on it. There is also a PHP side that grabs the actual tweets and I can post that code if it’s needed.http://jsfiddle.net/cKfDd/;(function ( $, window, document, undefined ) { /************************************* Plugin Functions *************************************/ /*************************************/ Plugin.prototype.init = function () {var params = [ ‘?user=’ + this.options.user,’&limit=’
adambender
javascript best-practice
I come from a Java background so my desire for proper unambiguous logging is strong. I prefer using the console to using some other gui widget however, in the browser I know that I can’t always count on the console to exist or for it to have all the levels I might like. To remedy this I worked up the following console sanitizer and I was curious what drawbacks it might have.function configureConsoleLog() {“use strict”;var logMethods = [ ‘trace’, ‘debug’, ‘log’, ‘info’, ‘warn’, ‘error’ ], i;if (!
palacsint
javascript php google html5
I am newbie at JavaScript, I am using PHP to get data from a MySQL database, and use the data to drop multiple markers into google map. Please give me some suggestion to my code, really appreciate for any your advice.<?php require_once ‘Common/system_start.php’; $sql=”select * from tab_mem order by sn desc “; $result= mysql_query($sql); $data=mysql_fetch_assoc($result); $row=mysql_num_rows($result);header(“Content-type: text/xml”);// Iterate through the rows, adding XML nodes for eachwhile (
Brandon Wamboldt
javascript node.js
I’m looking for some general feedback about the layout and structure of my code. Basically just any feedback, as I’m not super happy about this code, but I’m not sure how to improve it further.’use strict’;/* jshint node: true */var fs = require(‘fs’); var os = require(‘os’); var nodemailer = require(‘nodemailer’); var rimraf = require(‘rimraf’); var config = require(‘../config’); var dropbox = require(‘../lib/dropbox-sync’); var mysql = require(‘../lib/mysql-back
user2456359
php javascript wordpress
I’m struggling with adding the jQuery to the templated I transfered to WordPress, From what I’ve already learned from WordPress you need to use WordPress functions to include js files, is that always neccasary? Could somebody please take a look at the function I’ve written?header.php<!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta http-equiv=”Content-Type” content=”<?php bloginfo(‘HTML_type’);?>” charset=”<?php bloginfo( ‘charset’ ); ?>”
Fran Verona
php javascript jquery ajax
I have a PHP file with the following code:<html><head><!– HEAD –><?php require_once ‘Language.php’; ?></head><body><script type=”text/javascript”>$.get(‘step2.php’,function(data){// Do something});</script></body> </html>As you can see, I’m trying to load some content via Ajax call. The problem is that step2.php contains some PHP code:<div class=”step-content table-bordered”><h3><?php echo $Lang->get(‘create_s2_title
Sean
javascript node.js gruntjs livereload
PC Specs: Windows 7 Enterprise x64I’m running grunt.js on a project and recently started receiving an error when attempting to run ‘grunt watch’.Grunt worked fine yesterday but today I started seeing:Running “watch” task Waiting…Fatal error: listen EACCESI read another question here: Cloud 9 and Grunt.jsthat lead me to remove ‘options: {livereload: true}’ from Gruntfile.jsrunning watch again works as intended. Is there a way to reconfigure grunt or livereload to get livereload working with G
Asenar
javascript php jquery callback
i have make an php editor with so much effort but i cant print the fatal error. and want to print the fatal error. How to do this. I have code for run the php through eval function here is my jsfiddle – **http://jsfiddle.net/3c7F6/3/** I want to print an fatal error. Please help me to do this.please check the code and give me the suggestion
Septagram
javascript fatal-error
Is it possible to terminate script on a certain condition with a specific error message? Exceptions are not an option, as they can be catched, thus avoiding termination.Update:I’d prefer the universal approach, but if there’s none, then it’s for the in-browser JavaScript. Error should be silent, and the error message should only go into the browser error log.
Ates Goral
javascript gruntjs
I removed the old grunt first,and I install the new grunt.But I got an error:D:\www\grunt-test\grunt grunt-cli: The grunt command line interface. (v0.1.4)Fatal error: Unable to find local grunt.If you’re seeing this message, either a Gruntfile wasn’t found or grunt hasn’t been installed locally to your project. For more information about installing and configuring grunt, please see the Getting Started guide: http://gruntjs.com/getting-startedIs there haven’t a grunt in my system path, or somethi
Shawn
silverlight exception fatal-error
Receiving this error when trying to build a Silverlight 4 project.The code generator’Microsoft.ServiceModel.DomainServices.Tools.CSharpCodeDomClientCodeGenerator’encountered a fatal exception and could not generate code for project’TheProject.csproj’: Exception has been thrown by the target of aninvocation.
Drazisil
c# silverlight asynchronous world-of-warcraft
I have been stuck on this all weekend and failed miserably! Please help me to claw back my sanity!!Your challengeFor my first Silverlight application I thought it would be fun to use the World of Warcraft armoury to list the characters in my guild. This involves making an asyncronous from Silverlight (duh!) to the WoW armoury which is XML based. SIMPLE EH?Take a look at this link and open the source. You’ll see what I mean: http://eu.wowarmory.com/guild-info.xml?r=Eonar&n=Gifted and Talen
lukas
c# c++ silverlight html5 windows-phone-7
I recently decided to go into WP7 app development, but haven’t actually started learning silverlight/xna; Only C#. I already know C++ quite well.my Dad, who works for Microsoft, has recently told me that there’s no point to learning Silverlight because it will become irrelevant in the long run; due to HTML5’s superiority. However, Im not aware of any way to develop apps for WP7 using HTML5, and I barely know anything about markup languagez anyway.I wanted to get some proffesional advice on this,
Mmerrell
c# silverlight
Currently i’m tracking down a memory leak issue in a Silverlight 4 application. I can watch the memory used by iexplorer.exe increase gradually using Task Manager. However, I am looking for a way within the Silverlight code to tell how much memory the application is currently using within the IE Process. I have tried GC.GetTotalMemory but it does not represent the actual memory usage by iexplorer. I have developer tools for tracking down the memory leak itself, so i’m not looking for that but
Mud
java silverlight flash printing hardware
I need direct-to-printer functionality for my website, with the ability to distinguish a physical printer from a virtual printer (file).Coupons.com has this functionality via a native binary which must be installed by the user. I’d prefer to avoid that.SmartSource.com does it via Java applet:Does anybody know how this is done? I dug through that Java APIs a bit, and don’t see anything that would let you determine physical vs virtual, except looking at the name (that seems prone to misidentificat
ForbesLindesay
c# silverlight visual-studio-2010 silverlight-4.0 mediaelement
I want to write a method like the one bellow. However, in the event that Silverlight is unable to play the stream natively, I would like it to go through a list of MediaStreamSource classes, and try each one in turn till either one of them works, or it has no more to try. My question is, how do I tell whether the method below is sufficient for a particular stream.public static void OpenMedia(this MediaElement ME, Stream FileData) {ME.SetSource(FileData); }I need some code to execute in the ev
user2056563
c# silverlight pdf windows-phone-8 windows-phone
I have few pdf in a folder say Data/PDF/abc.pdf.I am trying to open PDF with the below code:private async void LaunchPDFNew(string name){string imageFile = @”Data/PDF/”+name+”.pdf”;// Get the image file from the package’s image directoryvar file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);if (file != null){bool success = await Windows.System.Launcher.LaunchFileAsync(file, options);if (success){// File launchedDebug.WriteLine(“File Launched”);}else{/
Adam Cobb
silverlight printing telerik reporting
I am trying to trigger a Telerik report to print once it has been rendered using either the native Silverlight printing ability or the integration with Adobe Acrobat.In my searches I have found this forum post – http://www.telerik.com/community/forums/reporting/telerik-reporting/reporting-parameters-first-time-not-applied-when-usenativeprinting-false.aspxWhich seems to describe how to do it, but when I try this approach, using the ReportServiceClient RenderAndCacheCompleted event, I get a Securi
spoof3r
java silverlight networking dns applet
I’m trying to create a Silverlight application that gathers network information, similar to that of running the command ‘ipconfig /all’ from the command line. I simply want to display the client’s IP address, default gateway, and the DNS server(s). If the DNS server is pointed to their router, then I need a way to get the DNS server being used by the router. Any suggestions? I’ve looked a little into WMI but with no success. Silverlight is simply too compressed.I have not done a lot in Java, but
AnthonyWJones
silverlight printing xps
Is there any way (library or native) to use the printing API to print an XPS document? I tried using the Document Toolkit API which works up to a point, but I get a COM exception when I try to set PrintPageEventArgs.PageVisual.
Brandon
java json asynchronous file-download
I am downloading from a server using AsyncTask class. Sometimes my code works fine, and sometimes it throws an exception.This is my logcat:06-29 17:29:01.123: E/AndroidRuntime(321): FATAL EXCEPTION: AsyncTask #5 06-29 17:29:01.123: E/AndroidRuntime(321): java.lang.RuntimeException: An error occured while executing doInBackground() 06-29 17:29:01.123: E/AndroidRuntime(321): at android.os.AsyncTask$3.done(AsyncTask.java:200) 06-29 17:29:01.123: E/AndroidRuntime(321): at java.util.concurrent.Futu
kittu88
java android post asynchronous forceclose
I have a login activity, the activity shows news updates on the top. To show the news updates, in the onCreate method of the activity, I am asynchronously posting to an url to get the XML for the news. Everything is working fine, but sometimes, the marquee is giving me a null pointer exception.The code of the activity:public class LoginActivity extends Activity {Button login;EditText txtUsername;EditText txtPassword;//variables to send post requestString responseBody;String responseCode;//Progre
jason
android asynchronous android-asynctask
I have 3 async calls executed in OnCreate() I am executing all 3 which fetches data and updates the listview .This works perfectly on Mobile network but on Wifi it does not work sometime.Also,I am guessing its happening parallel . Please let me know why it does not work perfectly on wifi.Also let me know if this is perfect to execute 3 async calls at a time.I really appreciate any help.Thanks in Advance.public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);mContext
NewUserSOF
android eclipse asynchronous android-emulator android-sdk-2.2
I have a 2 part splash screen that I’ve been trying to get to work on Android 2.2 (eclipse emulator) Everything works in 2.3 emulator. In 2.2 it works more often than not – sometimes goes to black screen – sometimes I need to restart the emulator. If I try to click the screen to cancel the splash and go right to the main activity, it goes to black screen and in the log I see: 06-29 12:23:54.474: I/ActivityManager(58): Starting activity: Intent { cmp=org.test.game/.MainActivity } 06-29 12:23:54.4
Julius F
node.js postgresql asynchronous express
One of the advantages of NodeJS is its async and non-blocking I/O, which in my case is great on the one hand, but breaks my neck every day on the other hand.I consider myself a NodeJS / Async novice and I often end up having such code:function(req, res) {req.assert(“name”, “Lobbyname is required”).notEmpty();req.assert(“name”, “Lobbyname length should be between 4 and 64 characters”).len(4, 64);req.assert(“game”, “Game not found”).isInt();req.sanitize(“game”).toInt();var userId = req.user.id;var
Kendall Hopkins
php events asynchronous daemon
I’m working on an online PHP application that has a need for delayed PHP event. Basically I need to be able to execute arbitrary PHP code x many seconds (but it could be days) after the initial hit to a URL. I need fairly precise execution of these PHP event, also I want it to be fairly scalable. I’m trying to avoid the need to schedule a cron job to run every second. I was looking into Gearman, but it doesn’t seem to provide any ability to schedule events and as I understand, PHP isn’t really m
user1363871
java android asynchronous download progressdialog
I have a simple code that is supposed to do one task, when the button is clicked download a file, save it to the SD card, and open it. Everything works except during the download, for larger files, the connection drops and the progress bar hangs – almost always at 20%. I have searched and searched and cannot figure out what to do to keep the connection alive and allow the download to complete. Any ideas how to keep the connection alive so the download completes instead of stalling at 20%?impor
Drazisil
c# silverlight asynchronous world-of-warcraft
I have been stuck on this all weekend and failed miserably! Please help me to claw back my sanity!!Your challengeFor my first Silverlight application I thought it would be fun to use the World of Warcraft armoury to list the characters in my guild. This involves making an asyncronous from Silverlight (duh!) to the WoW armoury which is XML based. SIMPLE EH?Take a look at this link and open the source. You’ll see what I mean: http://eu.wowarmory.com/guild-info.xml?r=Eonar&n=Gifted and Talen
Glyph
linux asynchronous posix bsd aio
There are pages scattered around the web that describe POSIX AIO facilities in varying amounts of detail. None of them are terribly recent. It’s not clear what, exactly, they’re describing. For example, the “official” (?) web site for Linux kernel asynchronous I/O support here says that sockets don’t work, but the “aio.h” manual pages on my Ubuntu 8.04.1 workstation all seem to imply that it works for arbitrary file descriptors. Then there’s another project that seems to work at the library
user782104
android asynchronous android-asynctask progressdialog
I am currently work on an async task to post some data to the API , the problem is it will throw an exception when I was working with the progress dialog. The async task is named “APIhandler” that will handle several type of case. Here is the constructorpublic APIHandler(Context _ctx,EasyTracker _tracker,String _formType) {this.ctx = _ctx;this.tracker = _tracker;this.formType = _formType;SharedPreferences prefs = ctx.getSharedPreferences(“userInfo”, 0);token = prefs.getString(“token”,””);memId =
Noseratio
c++ com activex webbrowser-control atl
I have a window based on the CAxWindow. In this window I create WebBrowser control. When the DISPID_DOCUMENTCOMPLETE happens I do:void __stdcall document_complete( LPDISPATCH pBrowser, VARIANT* ) {CComQIPtr< IWebBrowser2 > wb( pBrowser );CComPtr< IDispatch > doc;if( SUCCEEDED( wb->get_Document( &doc ) ) ){_docs.push_back( doc );}… }When the page is loaded I call for each document in _docs the script (IActiveScript and IActiveScriptSite):function main( doc ) {try{return doc.U
ire_and_curses
javascript webbrowser-control
I have a native (windows) application that has an embedded web browser. Currently I’m invoking a javascript function from the backend (c++/c#). However, if javascript is disabled this fails and I’d like to provide a fallback mechanism. Is there a way to determine if javascript is disabled?
johnc
.net winforms webbrowser-control
I have a .NET Winforms web browser control that is rendering some application information, rendered from an xslt, for me, and providing links that I want to capture, in order to open relevant forms. The link href is in the format “context#id”, for example, “employee#123”.Although ‘Show Source’ on the browser shows the link correctly, when I capture the web browser ‘Navigating’ event, the Url is being returned as an about: url, e.g. about:employee#123.Whilst I can code around this, I would prefer
Noseratio
c# wpf winforms webbrowser-control
I have the below code to show a window as a Dialog BrowserPopupWindow.Navigate(loginType, uri);BrowserPopupWindow.ShowDialog();on the navigate method i am doing some async webrequest , because of which the execution path is returned and the Dialog closes , how do i keep the Dialog open till i get the response of my webrequest. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; us
Anatoliy Nikolaev
c# wpf exception webbrowser-control
I run a simple C# WPF application that uses a browser embedded in it. I have created a event when the browser navigates to the given url. But this bug comes during runtime:An unhandled exception of type ‘System.Reflection.TargetInvocationException’ occurredin PresentationFramework.dllAdditional information: Exception has been thrown by the target of an invocation. The code is as follows,public MainWindow() {// Some initialisationwebBrowser.Navigate(requiredUrl); }private void webBrowser_Navigate
Shane
c# events webbrowser-control
I have a winforms c# app that has an embedded webbrowser control inside it generated through VS.NET 2008. We sink events by inheriting our events class from HTMLDocumentEvents2.public class IEHTMLDocumentEvents : mshtml.HTMLDocumentEvents2{public bool onclick(mshtml.IHTMLEventObj pEvtObj){// Clicking on an input (checkbox, radio, button, image)if (pEvtObj.srcElement.tagName == “INPUT”){// The following will result in a null pointer without VS.NET installedHTMLInputElementClass input = pEvtObj.
Ali
c# .net scrollbar webbrowser-control
When I set webbrowser controls Width and Height at form_load and navigate then it doesn’t show scrollbars.If I leave width and height to default then the control shows scrollbars.How can I show scrollbar after setting width and height of webbrowser control at runtime? Setting ScrollBarsEnabled property doesn’t help!
abatishchev
c# javascript .net web-browser webbrowser-control
I am trying to use InvokeScript method on the WebBrowser control to execute a script on the web page that has been loaded into my WebBrowser control. If I am calling just a simple javascript function, this works properly. However, the javascript function that I am trying to call is nested within a variable like this:var holder = { DoA: function() {….},DoB: function(){…..} }Calling holder.DoA works fine when called from within the javascript, but the function is not called successfully when
CJ7
Greg
.net webbrowser-control
We have a VB.Net CLR 4.0 application in Windows 7 that when you click a button, a webbrowser control pops up and displays a web page. The browser control defaults to IE7 mode, and we need at least IE8 for the page to display correctly (it’s an external site that we don’t have any control over).All of our users are on Windows 7 x86 machines, with the following registry key installed through AppSense:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULA
Web site is in building