Monday, 30 September 2013

Will my Cookie Clicker save last beyond a reboot=?iso-8859-1?Q?=3F_=96_gaming.stackexchange.com?=

Will my Cookie Clicker save last beyond a reboot? – gaming.stackexchange.com

I have been loathe to reboot my machine for risk my Cookie Clicker game
would lose all its hard-won progress. Am I being silly, here?

Prove that $ P \cup Q = Q$ and $P \cap Q = P$ if $P$ is a subset of $Q$

Prove that $ P \cup Q = Q$ and $P \cap Q = P$ if $P$ is a subset of $Q$

pWhen $P$ is a subset of $Q$, use logical connectives to/p blockquote ol
lipProve $P \cup Q = Q$./p/li lipProve $P \cap Q = P$./p/li /ol
/blockquote pI know that they are true, but I don't know how to use the
definitions of union and intersection in terms of logical connectives to
prove them./p pThanks in advance!/p

Android and expandable results preview

Android and expandable results preview

what I want to do is realizing an awsome layout for my app. For this
reason I've thought to Display result of searches in a particular way: -
when I have less then or 4 results I display them in a simple listview; -
when I have more then 4 results I display the first four resoults and an
element that, when is clicked, expands my listview and shows all results.
I've seen ExpandableListView but it does not give me the possibility of
results preview. Any ideas?

VisualStateManager: how the page is aware of initial VisualState

VisualStateManager: how the page is aware of initial VisualState

I have one doubt regarding the working of VisualStateManager in Windows
Store apps...
Assume this sample page:
<common:LayoutAwarePage x:Name="pageRoot">
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ListView Grid.Column="0"
x:Name="testElement" />
<Grid Grid.Column="1" />
</Grid>
<common:LayoutAwarePage/>
I declare the next VisualStateManager behavior, with a sample VisualState:
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ApplicationViewStates">
<VisualState x:Name="Snapped">
<Storyboard>
<ObjectAnimationUsingKeyFrames
Storyboard.TargetName="testElement"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0"
Value="Collapsed" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
And now my questions:
How can the application determine that the "state" (I mean, the values of
the properties) is the one I used in the XAML declaration of the page?
Do I need to explicitly set the "initial" values of the page in - for
example - a FullScreenLandscapeOrWide VisualState?
Is it possible that the page will start (maybe with other screen
resolutions or particular devices) in a different VisualState "state" (not
FullScreenLandscapeOrWide), giving me problems if I do not declare the
FullScreenLandscapeOrWide VisualState (the initial status) ?
Thank you in advance for clarifications...

Sunday, 29 September 2013

C++ return negative string

C++ return negative string

Hi i have the following code to convert string integer into integer, these
are the code:
#include <stdio.h>
int str_to_int(char* str) {
int output = 0;
char* p = str;
for (int i=0;str[i]!='\0';i++) {
char c = *p++;
if (c < '0' || c > '9')
continue;
output *= 10;
output += c - '0';
}
return output;
}
int main(){
printf("%d\n", str_to_int("456xy"));
printf("%d\n", str_to_int("32"));
printf("%d\n", str_to_int("-5"));
return 0;
}
But some how printf("%d\n", str_to_int("-5")); some how returning 5
instead -5, where am i wrong here? Thanks

Umbraco 6.1.3 - Specified cast is not valid

Umbraco 6.1.3 - Specified cast is not valid

I am getting error that is "Specified cast is not valid." in umbraco 6.1.3
version. (Razor - MVC)
Page has macro that is rendering company list to the page. I am creating
company list data with ucomponents data grid component.
Also I added all error below. Why can i get this error? And how can i fix
this? I searched it but i didnt get any idea to fix.
Thanks



Server Error in '/' Application.
Specified cast is not valid.
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.InvalidCastException: Specified cast is not valid.
Source Error:
Line 7:
Line 8: <div class="interior-page-content">
Line 9: @Umbraco.RenderMacro("All-FirmaListesi", new {anaSayfa="1055"})
Line 10: </div>
Source File:
c:\inetpub\vhosts\cbmeturkey.com\httpdocs\Views\KatilimListesi.cshtml
Line: 9
Stack Trace:
[InvalidCastException: Specified cast is not valid.]
System.Data.SqlClient.SqlBuffer.get_Byte() +52
System.Data.SqlClient.SqlDataReader.GetByte(Int32 i) +62
umbraco.DataLayer.RecordsReaderAdapter`1.GetByte(String fieldName) +168
umbraco.cms.businesslogic.macro.MacroProperty.setup() +215
umbraco.cms.businesslogic.macro.MacroProperty.GetProperties(Int32
MacroId) +189
umbraco.cms.businesslogic.macro.MacroModel..ctor(Macro m) +186
umbraco.macro..ctor(String alias) +117
Umbraco.Web.UmbracoHelper.RenderMacro(String alias, IDictionary`2
parameters) +59
Umbraco.Web.UmbracoHelper.RenderMacro(String alias, Object parameters) +47
ASP._Page_Views_KatilimListesi_cshtml.Execute() in
c:\inetpub\vhosts\cbmeturkey.com\httpdocs\Views\KatilimListesi.cshtml:9
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +199
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter
writer, Object instance) +257
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext,
TextWriter writer) +107
StackExchange.Profiling.MVCHelpers.WrappedView.Render(ViewContext
viewContext, TextWriter writer) +159
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
+291
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext
controllerContext, ActionResult actionResult) +13
System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
+23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter
filter, ResultExecutingContext preContext, Func`1 continuation) +245
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
+22
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter
filter, ResultExecutingContext preContext, Func`1 continuation) +245
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
+22
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext
controllerContext, IList`1 filters, ActionResult actionResult) +176
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext
controllerContext, String actionName) +311
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +23
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult
_) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult
ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult
asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult
asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult
ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult
result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+9629708
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +155
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.0.30319.17929

Making stored procedure after insert update other table trigger

Making stored procedure after insert update other table trigger

I've got these tables:
Reservations
Reseration_ID
User_ID
Total_Amount
Tourist_Reservation
Tourist_ID- foreign key
Reservation_ID - foreign key to Reservation
Extra_Charges table
Extra_Charge_ID
Amount
Description
Tourist_Extra_Charges
Tourist_ID - foreign key
Extra_Charge_ID - foreign key
But when a user makes a reservation at first – for example, the basic
packet costs 500 euro – it is inserted into the TotalAmount column in the
Reservation table.
But in the next form the user can select extra_charges which will (but
also he may not select any extra_charges) which are immediately inserted
in the Tourist_Extra_charges table.
The problem is that as the user has selected extra_charges I should update
the column TotalAMount.
So after insert in the tourist_extra_charges table I want to make a
trigger that will update the column TotalAmount in the Reservation table.
And this is what I came up with. Please advice me if I can optimize it and
as a whole if the procedure is good.
CREATE TRIGGER [dbo].[tralAmount] on [dbo].[TOURIST_EXTRA_CHARGES] After
Insert
AS
BEGIN
Declare @Res_ID int
Declare @Sum_toAdd money
select @Res_ID = Reservation_ID from inserted
Inner join TOURIST_RESERVATION on
inserted.Tourist_ID=TOURIST_RESERVATION.Tourist_ID
select @Sum_toAdd = Amout from inserted
Inner Join EXTRA_CHARGES on inserted.Extra_Charge_ID=
EXTRA_CHARGES.Extra_Charge_ID
Update RESERVATIONS
Set Reservation_TotalAmount = (Reservation_TotalAmount + @Sum_toAdd)
where Reservation_ID=@Res_ID
END