Thursday, 3 October 2013

How to get aSQL of a table?

How to get aSQL of a table?

How to get aSQL of a table?
I want tghe SQL...Can anybody tell me the TABLE_NAME where SQL is maintained?
I used SQL developer but is there any command or script or table name
which shows the SQL of a table.

Wednesday, 2 October 2013

Oracle blocking repeated inserts

Oracle blocking repeated inserts

Consider a system that has multipile requests for course enrollments
coming in. We need a way to block duplicate enrollments in the system. I
created a trigger as follows, but when I get two requests from different
connections at the same time (ms apart) they are both inserted. What am I
doing wrong
create trigger enrollment_duplicates
before insert
on enrollment
for each row
begin
select count(*) into cnt from enrollment where user = :new.user and
course = :new.course and status = 'Enrolled';
if cnt > 0 then
raise_application_error(-20001, 'User already enrolled in course');
end if;
end;

How to return a dynamic allocated struct of arrays in a method?

How to return a dynamic allocated struct of arrays in a method?

I have the following struct and method in the public part of my headerfile:
struct InputtedInstructions
{
string name;
string arg1;
string arg2;
string arg3;
};
InputtedInstructions get_instruction(vector<string>& text, int count);
then in my cpp file:
Instructions::InputtedInstructions
Instructions::get_instruction(vector<string>& vec, int counter)
{
int ListPosition = 0;
InputtedInstructions* InputList = new InputtedInstructions[counter];
while (ListPosition != counter)
{
string text = vec.at(ListPosition);
istringstream iss(text);
string command, arg1, arg2, arg3;
int CommaAmount = count(text.begin(), text.end(), ',');
if (CommaAmount == 2)
{
while( iss >> command >> arg1 >> arg2 >> arg3)
{
InputList[ListPosition].name = command;
InputList[ListPosition].arg1 = arg1;
InputList[ListPosition].arg2 = arg2;
InputList[ListPosition].arg3 = arg3;
ListPosition++;
}
}
//same thingfor 3 commas, 4, etc.
return InputList;
My issue is on that return statement down there. it wants me to add [] to
the end of it. but I want to return the entire InputList array. Is there
something glaringly obvious I am doing wrong? Thanks for your help.

Stack trace analysis assistance

Stack trace analysis assistance

I have a mvc3 app and I'm unable to debug it. Any assistance would be
great since I'm a newbie to reading the stack trace. Is this 1 exception
thrown or more and where to search for the prob? Tnx
Server Error in '/' Application.
The network path was not found
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The network path
was not found
Source Error:
Line 188: orderby s.Name Line 189: select s; Line 190: var settings =
query.ToDictionary(s => s.Name.ToLowerInvariant()); Line 191: Line 192:
return settings;
Source File: C:...***.FB.Services\Configuration\Services\SettingService.cs
Line: 190
Stack Trace:
[Win32Exception (0x80004005): The network path was not found]
[SqlException (0x80131904): A network-related or instance-specific error
occurred while establishing a connection to SQL Server. The server was not
found or was not accessible. Verify that the instance name is correct and
that SQL Server is configured to allow remote connections. (provider:
Named Pipes Provider, error: 40 - Could not open a connection to SQL
Server)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection, Action1 wrapCloseInAction) +5296071
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +558
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo,
SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64
timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean
integratedSecurity, Boolean withFailover) +5308555
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, SecureString newSecurePassword, Boolean
ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo
serverInfo, String newPassword, SecureString newSecurePassword, Boolean
redirectedUserInstance, SqlConnectionString connectionOptions,
SqlCredential credential, TimeoutTimer timeout) +889
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer
timeout, SqlConnectionString connectionOptions, SqlCredential credential,
String newPassword, SecureString newSecurePassword, Boolean
redirectedUserInstance) +307
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential credential,
Object providerInfo, String newPassword, SecureString newSecurePassword,
Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions)
+434
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo,
DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions
userOptions) +225
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool
pool, DbConnectionOptions options, DbConnectionPoolKey poolKey,
DbConnectionOptions userOptions) +37
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions
userOptions) +558
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions
userOptions) +67
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate,
Boolean onlyOneCheckConnection, DbConnectionOptions userOptions,
DbConnectionInternal& connection) +1052
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
owningObject, TaskCompletionSource1 retry, DbConnectionOptions
userOptions, DbConnectionInternal& connection) +78
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
owningConnection, TaskCompletionSource1 retry, DbConnectionOptions
userOptions, DbConnectionInternal& connection) +167
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory,
TaskCompletionSource1 retry, DbConnectionOptions userOptions) +143
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
+83 System.Data.SqlClient.SqlConnection.Open() +96
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure) +44
[EntityException: The underlying provider failed on Open.]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure) +203
System.Data.EntityClient.EntityConnection.Open() +104
System.Data.Objects.ObjectContext.EnsureConnection() +75
System.Data.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption) +41
System.Data.Objects.ObjectQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
+36 System.Linq.Enumerable.ToDictionary(IEnumerable1 source, Func2
keySelector, Func2 elementSelector, IEqualityComparer1 comparer) +146
System.Linq.Enumerable.ToDictionary(IEnumerable1 source, Func2
keySelector) +89
***.FB.Services.Configuration.Services.SettingService.<GetAllSettings>b__3()
in C:\***.FB.Services\Configuration\Services\SettingService.cs:190
***.FB.Core.Caching.Extensions.CacheExtensions.Get(ICacheManager
cacheManager, String key, Int32 cacheTimeInMinutes, Func1 acquire) in
C:**.FB.Core\Caching\Extensions\Extensions.cs:47
.FB.Core.Caching.Extensions.CacheExtensions.Get(ICacheManager
cacheManager, String key, Func1 acquire) in
C:\***.FB.Core\Caching\Extensions\Extensions.cs:19
***.FB.Services.Configuration.Services.SettingService.GetAllSettings() in
C:\***.FB.Services\Configuration\Services\SettingService.cs:185
***.FB.Services.Configuration.Services.SettingService.GetSettingByKey(String
key, T defaultValue) in
C:\***.FB.Services\Configuration\Services\SettingService.cs:116
***.FB.Services.Configuration.ConfigurationProvider1.b__4(PropertyInfo
prop) in C:*.FB.Services\Configuration\ConfigurationProvider.cs:30
System.Linq.WhereSelectArrayIterator2.MoveNext() +66
System.Linq.WhereSelectEnumerableIterator2.MoveNext() +85
System.Collections.Generic.List1..ctor(IEnumerable1 collection) +381
System.Linq.Enumerable.ToList(IEnumerable1 source) +58
***.FB.Services.Configuration.ConfigurationProvider1.BuildConfiguration()
in C:**.FB.Services\Configuration\ConfigurationProvider.cs:37
.FB.Services.Configuration.ConfigurationProvider`1..ctor(ISettingService
settingService) in
C:*.FB.Services\Configuration\ConfigurationProvider.cs:16
lambda_method(Closure , Object[] ) +66
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
+212
[DependencyResolutionException: An exception was thrown while invoking the
constructor 'Void
.ctor(*.FB.Services.Configuration.Interfaces.ISettingService)' on type
'ConfigurationProvider1'.]
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
+381
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext
context, IEnumerable1 parameters) +184
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
+48 Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +7
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1
creator) +112 Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope
currentOperationScope, IComponentRegistration registration, IEnumerable1
parameters) +167
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration
registration, IEnumerable1 parameters) +24
Autofac.Core.Activators.Reflection.<>c_DisplayClass2.b_0() +31
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
+94
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext
context, IEnumerable1 parameters) +184
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
+48 Autofac.Core.Resolving.InstanceLookup.b_0() +7
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1
creator) +112 Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope
currentOperationScope, IComponentRegistration registration, IEnumerable1
parameters) +167
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration
registration, IEnumerable1 parameters) +24
Autofac.Core.Activators.Reflection.<>c__DisplayClass2.<CanSupplyValue>b__0()
+31
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
+94
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext
context, IEnumerable1 parameters) +184
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
+48 Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +7
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1
creator) +112 Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope
currentOperationScope, IComponentRegistration registration, IEnumerable1
parameters) +167
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration
registration, IEnumerable1 parameters) +24
Autofac.Core.Activators.Reflection.<>c_DisplayClass2.b_0() +31
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
+94
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext
context, IEnumerable1 parameters) +184
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
+48 Autofac.Core.Resolving.InstanceLookup.b_0() +7
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1
creator) +112 Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope
currentOperationScope, IComponentRegistration registration, IEnumerable1
parameters) +167
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration
registration, IEnumerable1 parameters) +24
Autofac.Core.Activators.Reflection.<>c__DisplayClass2.<CanSupplyValue>b__0()
+31
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
+94
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext
context, IEnumerable1 parameters) +184
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
+48 Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +7
Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1
creator) +112 Autofac.Core.Resolving.InstanceLookup.Execute() +132
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope
currentOperationScope, IComponentRegistration registration, IEnumerable1
parameters) +167
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration
registration, IEnumerable1 parameters) +24
Autofac.Core.Activators.Reflection.<>c_DisplayClass2.b_0() +31
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
+94
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext
context, IEnumerable1 parameters) +184
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
+48 Autofac.Core.Resolving.InstanceLookup.Execute() +48
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope
currentOperationScope, IComponentRegistration registration, IEnumerable1
parameters) +167
Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration
registration, IEnumerable1 parameters) +64
Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration
registration, IEnumerable1 parameters) +163
Autofac.ResolutionExtensions.TryResolveService(IComponentContext context,
Service service, IEnumerable1 parameters, Object& instance) +70
Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext
context, Service service, IEnumerable`1 parameters) +54
Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context,
Type serviceType) +84
Autofac.Integration.Mvc.AutofacDependencyResolver.GetService(Type
serviceType) +21
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext
requestContext, Type controllerType) +41
[InvalidOperationException: An error occurred when trying to create a
controller of type '*.FB.Redirector.Controllers.RedirectController'. Make
sure that the controller has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext
requestContext, Type controllerType) +179
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext
requestContext, Type controllerType) +80
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext
requestContext, String controllerName) +74
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext,
IController& controller, IControllerFactory& factory) +196
System.Web.Mvc.<>c_DisplayClass6.b_2() +49
System.Web.Mvc.<>c__DisplayClassb1.<ProcessInApplicationTrust>b__a() +13
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func1 func) +88
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext,
AsyncCallback callback, Object state) +98
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext,
AsyncCallback callback, Object state) +50
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext
context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+301 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +155

Tuesday, 1 October 2013

Should I use Nullable in F#?

Should I use Nullable in F#?

Which way is more idiomatic to use Nullable<'a> or to use Option<'a> for
representing a nullable int?

Stripe.com component or module for use with Joomla CMS?

Stripe.com component or module for use with Joomla CMS?

Does anyone know of a component or module for Joomla that uses Stripe.com
to process payments?
The closest I've found is: http://www.jpayplans.com/
Any help would be great!

how do I run the ISO installation file?

how do I run the ISO installation file?

pOK, I've downloaded ubuntu desktop file ubuntu-12.04.3-desktop-i386.iso
but what do I do to get it to run amp; install ubuntu?/p

Norms and Inner Products

Norms and Inner Products

Is it possible to form an inner product from a norm or only the other way
around? When do inner products not have norms?