I have a public website that does not require authentication. It's a lighting calculator for indoor cultivation. Anyone can enter and complete the process and ultimately save your settings for future use sharing it on Facebook or twitter.

The configuration is saved as a document in a database, using a REST api. At this time nothing prevents someone make a bot and fill my hard disk in a few hours.

What steps can I take to give protection to my service?

So I am working on a solo project that involves a lot of strings. In one of my smaller test cases there will be at least 70 million elements. So my question is, what is the largest possible size a TreeSet or a HashSet can reach until it can no longer grow OR until it reaches a size that it can no longer be feasible to use in terms of efficiency.

If I use an Open Source library which is released under a zLib like license, but it has dependencies on libraries that are using LGPL or GPL; what license am I able to release my project under? If I read things I find on the net it sounds like I can sell my project but I can't stop people from distributing it freely as per GPL?

I've been trying to come up with the best way to design my file manager for a project. I need to work with many file implementations and I have a File class made of 2 classes inside: Data and Descriptor.

enter image description here

As you can see, I have many different implementations of the Data class, one for each file organization. All of the implementations use records to organize their information but the fields for each kind of file (users, transactions, etc...) have to be stored as metadata inside their respective descriptor file. So basically my problem is trying to access and updating the descriptor of each file.

For example, while trying to search() inside the Users file from the Stacked class, I need the fields (username, name, last name, etc...) which are inside the Users Descriptor file, but I cant come up with a nice design for it. The only way I can think of is passing the Descriptor reference to each method (search, write, etc...) but I have a feeling that my solution would be bad design.

Please note that I still have to keep adding more file organizations for different files, so I want to plan ahead and have a nice file manager to handle all the requests the best way possible, but currently this is what I've come up with.

![Blockquote][1]

asdasdasdasdasdasdasdasdas asdasd asd asd asdas dasd asdas d adas dasd

asdasdasdasdasdasdasdasdas asdasd asd asd asdas dasd asdas d adas dasd

asdasdasdasdasdasdasdasdas asdasd asd asd asdas dasd asdas d adas dasd

asdasdasdasdasdasdasdasdas asdasd asd asd asdas dasd asdas d adas dasd

asdasdasdasdasdasdasdasdas asdasd asd asd asdas dasd asdas d adas dasd

asdasdasdasdasdasdasdasdas asdasd asd asd asdas dasd asdas d adas dasd

So I'm not a big fan of change and the new itunes connect is making me unhappy. I just uploaded an app binary and realized there is an issue I need to fix before Apple spends another 2 weeks reviewing it. In the old days, I could just reject the binary, but I am not seeing that as an option now. My app exists in the Pre-Release section, but I cannot figure out where to go to remove it. Where do I go and how do I do it?

I want to download my photos from old windows phone (synced on "Camera roll" folder). But windows phone only lets me to see these photos online. There is an option that sync this folder in two-way?

PS.: Sorry for my bad english.

When my nokia lumia 1020 is connected to my PC is it running off my internet or using my data?

We have an application that does a significant amount of text to speech activity, providing performance information to a team every few seconds. The application works perfectly when using the phone speaker in WP8 and WP8.1 but we are seeing a variety of strange and poor behaviors in WP8.1 when using Bluetooth speakers. The first change is there is a delay of about half a second before the speech begins on the speaker. Under WP8 the delay was not noticeable at all.

The big problem is that the audio seems to degrade after a few minutes of use with the audio breaking up badly with breaks in the words like the radio is not working. We have tested with Lumia phones 520, 920 and 1520 and all exhibit similar but not exact behaviors. We have a few different Bluetooth devices and they all fail under WP8.1, again with slightly different behaviors. Usually, the audio gets to the point of no intelligibly within a few minutes. Sometimes, the speaker just stops working and it APPEARS the speaker has lost connection with the phone based on the silly blue/red lights but the phones always show the speaker still connected.

The phone and speakers are always within 5 feet of one another so radio signal issues do not appear to be a factor.

We have tried the exact same phones under WP8 and WP8.1. They work perfectly with WP8 but not under WP8.1.

Has anyone else seen this sort of issue under WP8.1?

Thanks!

I'm currently writing a Mobile iOS app that is using the iOS Significant Location Change service to manage lots and lots of geofences, enabling and disabling geofences as we receive this message from the CoreLocation Framework.

On the Apple Developer Website it says:

The significant-change location service delivers updates only when there has been a significant change in the device’s location, such as 500 meters or more.

What really throws me off is "500 meters or more", what exactly is the significant location change service based on and what guarantees do we actually have?

Is this API reliable for tracking changes between regions so that when we receive the message we know it's time to redistribute our geofences (assuming we have less than 20 geofences per 500 meter radius)?

There are many answers explaining how to create a link to the app in the iTunes store:

itms-app://itunes.apple.com/app/id{APPID}

My application is sending out an email via the sharing functionality in iOS7 (UIActivityViewController) which includes the above URL.

If the application has never been published before, clicking on the above link in the email on the iPhone device (the Simulator doesn't have the iTunes application) opens iTunes as expected but nothing is displayed.

How can I verify before publishing the initial version of my app that my iTunes link is indeed correct?

I believe ive looked at every article related to keyboard input, but still cant get it to work. ALl i want is a output, using NSLog everytime i hit a key, in the app or not. Im currently using xcode 5. Ive tried many snippets of code such as

[NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event)
    NSLog(@"%@",event.characters);

and im not sure where to put his code. Do i put it in the main function like this

 #import <Foundation/Foundation.h>
#import <appkit/NSEvent.h>

int main(int argc, char * argV[]) {
@autoreleasepool{
[NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event)
    NSLog(@"%@",event.characters);
 }
}

Clearly im new to objective-C, and i dont plan on continuing with it unless i can get keyboard input to work. Ive tried tutorials, snippets from keyloggers, and the mac dev forums. Thanks.

I am trying to use a simple block to iterate over an array of objects and sort them into two new arrays. I have created two arrays inside my method, and used the __block prefix so they can be modified inside the block. When I log the process and results, though, the arrays come back as null, but I am expecting them to have objects.

Here is the method:

- (NSPredicate *)predicateForSelectedRows:(NSArray *)selectedRows
{
    NSLog(@"selectedRows is: %@", selectedRows);

    __block NSMutableArray *systemsIndexPaths;
    __block NSMutableArray *knownIndexPaths;

    [selectedRows enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        NSIndexPath *indexPathObj = obj;
        if (indexPathObj.section == 0) {
            [systemsIndexPaths addObject:indexPathObj];
            NSLog(@"Going into sytemsIndexPaths: %@", indexPathObj);
            NSLog(@"Systems index path objects: %@", systemsIndexPaths);
        }
        else if (indexPathObj.section == 1) {
            [knownIndexPaths addObject:indexPathObj];
            NSLog(@"Going into knownIndexPaths: %@", indexPathObj);
            NSLog(@"Known index path objects: %@", knownIndexPaths);
        }
        else {
            NSLog(@"Index path of selected row in filter table view is larger than what the data model knows. Something is really wrong!");
        }
    }];

    NSLog(@"Systems index path objects: %@", systemsIndexPaths);
    NSLog(@"Known index path objects: %@", knownIndexPaths);

...

Here is the output from the console (timestamps removed, for space/clarity):

b5[6598:60b] selectedRows is: (
    "<NSIndexPath: 0xc000000000008016> {length = 2, path = 0 - 1}",
    "<NSIndexPath: 0xc000000000010016> {length = 2, path = 0 - 2}",
    "<NSIndexPath: 0xc000000000008056> {length = 2, path = 1 - 1}",
    "<NSIndexPath: 0xc000000000010056> {length = 2, path = 1 - 2}"
)
b5[6598:60b] Going into sytemsIndexPaths: <NSIndexPath: 0xc000000000008016> {length = 2, path = 0 - 1}
b5[6598:60b] Systems index path objects: (null)
b5[6598:60b] Going into sytemsIndexPaths: <NSIndexPath: 0xc000000000010016> {length = 2, path = 0 - 2}
b5[6598:60b] Systems index path objects: (null)
b5[6598:60b] Going into knownIndexPaths: <NSIndexPath: 0xc000000000008056> {length = 2, path = 1 - 1}
b5[6598:60b] Known index path objects: (null)
b5[6598:60b] Going into knownIndexPaths: <NSIndexPath: 0xc000000000010056> {length = 2, path = 1 - 2}
b5[6598:60b] Known index path objects: (null)
b5[6598:60b] Systems index path objects: (null)
b5[6598:60b] Known index path objects: (null)

The console logging tells me I have objects in the selectedRows array that gets passed to the method and that the logic inside the block is executing correctly. It also tells me that the object I'm trying to put into those arrays has a value.

What is a good pattern for using enumerateObjectsUsingBlock and sorting into new arrays like this?

I'm trying to use an ImageReader to get RGB images from the camera. I'm using the Camera2 API from Android 5.0 "L" on a Nexus 5 running the developer preview.

I already have a SurfaceView configured for RGB images which is working fine, and I know that the camera hardware produces RGB data (because all the tone mapping and color gain settings on Android are specified to operate on RGB channels).

I can obtain YUV_420_888 images from ImageReader by creating the ImageReader this way:

imageReader = ImageReader.newInstance(W, H, ImageFormat.YUV_420_888, 4);

and then converting the YUV images to RGB. However, this is introducing both an unwanted quantization error (since my application requires RGB images), and unnecessary processing time.

However, when I try creating the image reader this way:

imageReader = ImageReader.newInstance(W, H, PixelFormat.RGB_888, 4);

the image capture fails with the following exception:

java.lang.UnsupportedOperationException: The producer output buffer format 0x22 doesn't match the ImageReader's configured buffer format 0x3.
        at android.media.ImageReader.nativeImageSetup(Native Method)
        at android.media.ImageReader.acquireNextSurfaceImage(ImageReader.java:293)
        at android.media.ImageReader.acquireNextImage(ImageReader.java:339)
        at android.media.ImageReader.acquireLatestImage(ImageReader.java:243)
        at <my code...>

I'm confused on two fronts. First, the output format mentioned, 0x22, is not in either PixelFormat or ImageFormat. It seems to be some sort of undocumented raw mode, but I can't use ImageReader.newInstance(W, H, 0x22, 4) to capture it (I get java.lang.UnsupportedOperationException: Invalid format specified 34). I would love to capture in the raw format but I can't convince ImageFormat to accept it (and the other raw format ImageFormat.RAW_SENSOR is incredibly slow for some reason).

Second, the SurfaceView is already happily consuming RGB_888 images (as far as I can tell), and putting them directly on the screen. So why isn't ImageReader not accepting RGB images properly? What did I do wrong?

So I've loosely followed the tutorial below for getting a dropdown list in my ActionBar: http://www.vogella.com/tutorials/AndroidActionBar/article.html#actionbar_navigation_dropdown

I want to get the string value of the selected item.

However, onNavigationItemSelected only passes in position and id. I could do something like the following referencing selectionItems which is a string array that gets passed into the adapter that populates the dropdown:

public boolean onNavigationItemSelected(int position, long id) {
    // Our logic
    selectionItem = selectionItems[position];
    if(selectionItem.equals(getString(R.string.no_selection))) {
        toast = Toast.makeText(getApplicationContext(), "Please select something", Toast.LENGTH_SHORT);
        toast.show();
    }
    else {
      // Do action
}

I'd rather do something similar to what you do with Spinner objects where you don't reference the String array used but grab the actual value of the selected object:

if (String.valueOf(spnr.getSelectedItem()).equals(getString(R.string.no_selection))) {

  // Do stuff

}

Is there any way to get the actual value of the NavigationItem based on the position that doesn't require cross-referencing your String array from before?

After looking around for some time, I've yet to find a question that matches my problem. My issue is this, I have a ListView whose entries adhere to the following layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:baselineAligned="false"
    android:paddingTop="5dp"
    android:paddingBottom="5dp"
    android:orientation="horizontal"
    android:descendantFocusability="blocksDescendants" >

    <LinearLayout 
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        amdroid:layout_weight="1"
        android:orientation="vertical" >
        ...
    </LinearLayout>

    <LinearLayout 
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:orientation="vertical" >
        ...
    </LinearLayout>

    <LinearLayout 
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical" >
        ...
    </LinearLayout>
</LinearLayout>

I would expect this to produce an entry in which the 1st nested layout gets 1/4 of the available width, the 2nd gets 1/2 of the width, and the 3rd gets 1/4 of the width. This isn't what happens, though; instead, the width of each nested layout is wrapped for some reason.

Interestingly, if I specify a particular width in the parent LinearLayout instead of "match_parent", the nested layout widths obey the weights as expected. For example, the following produces the expected result:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="290dp"
    android:layout_height="wrap_content"
    android:baselineAligned="false"
    android:paddingTop="5dp"
    android:paddingBottom="5dp"
    android:orientation="horizontal"
    android:descendantFocusability="blocksDescendants" >

    <LinearLayout 
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        amdroid:layout_weight="1"
        android:orientation="vertical" >
        ...
    </LinearLayout>

    <LinearLayout 
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:orientation="vertical" >
        ...
    </LinearLayout>

    <LinearLayout 
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical" >
        ...
    </LinearLayout>
</LinearLayout>

Obviously, though, specifying a particular width ignores the whole point of weights. So my question is this: why aren't the weights actually filling the parent LinearLayout when "match_parent" is used, and how can this be corrected?

Oh and one final point of interest, the graphical layout preview in Eclipse produces expected results when "match_parent" is used for the parent LinearLayout width. It's only when emulated or used on an actual device that the contents of the nested LinearLayouts get width-wrapped. I'm guessing that this is due to the layout's use inside of a ListView, but who knows?

Thanks

I am building a .NET 4.5 C# Web API RESTful solution and I would like someone to tell me if my project solution is correct and/or wise(-enough?) for a solution designed using Domain Driven Design, please.

The solution has been split into 6 projects:

  • /Base

(Not referenced by anything)

The web project and forms the interface between the solution and the outside world. Contains the Web API controllers. Contains almost no logic beyond gathering values from request objects and asking the BizApi layer for work.

  • /Biz.Api

(Referenced by Base])

Provides the domain services and allows the /Base interface project to have access to the domain business logic objects in the /Biz.Domain project.

  • /Biz.Domain

(Referenced by Biz.Api)

Provides the domain classes for the Biz.Api layer. These provide methods to manipulate the data of the business in memory.

  • /Dal.Db

(Referenced by Biz.Api)

The database repository layer. Accesses the databases and maps returned data into internal DTO's defined in the /Interfaces layer.

  • /Dal.Services

(Referenced by Biz.Api)

Provides a proxy layer to external dependencies like web services and maps their returned data to internal DTOs defined in the /Interfaces project.

  • /Interfaces

(Referenced by most projects above)

Contains the DTO classes for passing data around the solution and the C# interfaces to define contracts for things like IoC.

Is there any rule that says the head of any linked list should contain data. Is it because by doing it so we save a space for one node. Why for some implementation of head contains data and for other it doesn't.

Producing predictable output for each possible input is the responsibility of each module. For example (in C#):

class Logger
{
    public ITextWriter Writer { get; set; }

    private uint counter;

    /// <summary>
    /// Writes message in special format and returns the number of total messages written
    /// </summary>
    public uint Debug(string message)
    {
        if (message == null) throw new ArgumentNullException("message");

        if (Writer == null) throw new InvalidOperationException("Writer not set");

        Writer.Write(string.Format("{0:HHmmss}: [DEBUG] {1}", DateTime.Now, message));

        return ++counter;
    }
}

Logger module is quite verbose, but it's output - exception, call to a depedency and returned value - is predictable and obvious for each argument and state.

But one possible use-case bothers me. What if Writer was set to some weird implementation which somehow calls the Logger.Debug method on that same object? First possible consequence is stackoverflow due to infinite recursion. Second - unpredictable output and possible bugs. It's obvious that such situation must be controlled somehow. If we want predictable output for our logger, it should control double-entries:

    // ...
    private bool enter;

    public uint Debug(string message)
    {
        if (message == null) throw new ArgumentNullException("message");

        if (Writer == null) throw new InvalidOperationException("Writer not set");

        if (enter) throw new InvalidOperationException("Double-entry");

        enter = true;

        Writer.Write(string.Format("{0:HHmmss}: [DEBUG] {1}", DateTime.Now, message));

        enter = false;

        return ++counter;
    }
    // ...

And it seems that every external call (a call not to it's own components) must be wrapped with such flags. That looks crazy!

Is it how good code written? Or is it normal to beleive that your system has no circular calls? Am I missing something important? Please, advise.

UPDATE

It's even worse, guys:

    // ...

    private bool enter;

    public uint Debug(string message)
    {
        if (message == null) throw new ArgumentNullException("message");

        if (Writer == null) throw new InvalidOperationException("Writer not set");

        if (enter) throw new InvalidOperationException("Double-entry");

        try
        {
            enter = true;

            Writer.Write(string.Format("{0:HHmmss}: [DEBUG] {1}", DateTime.Now, message));
        }
        finally
        {
            enter = false;
        }

        return ++counter;
    }
    // ...

I beleive that catching an exception is on duty of higher-level module (the one which created them all), so exceptions must follow their way. But the state after unsuccessfull call must remain correct. Exception is not the end of the world, and modules possibly can be re-used.

I have built an android game - I would like to add a "high score" leaderboard to it, such that people can show off how high they managed to score. How should I design it so that people can't "hack" it by decompiling it and sending a fake score? I don't believe android has a TPM module yet for most devices, so I can't store a password there (even if I could, how could I insert it there without it being detected in transmission?).

I could obfuscate the code, but that isn't going to prevent hacking, only deter it.

I will be using a secured connection, so I shouldn't have any network-sniffing issues.

I am not sure if it would be better to post it under android or security instead of here, but I think this is the correct place since I am asking for a design.

We wrote a simple .NET (C#) desktop application in Wpf. We also used WIF (Windows Identity Framework) to get a list of claims for the authenticated user. Some examples are:

  • CanOverrideSalesAmount
  • CanAddContact
  • etc.

This works fine and all, the client seems very protected. But, when I was debugging the application it occurred to me that all of the authorization is happening on the client side. A devious person could use a tool such as Snoop to hook into the application and make changes to the domain model that s/he isn't supposed to do.

We thought about moving the authorization checks on the property setters, but even that isn't good enough because when we serialize the object graph to send over the wire, the serialized data can be altered (far fetched, but still possible).

It seems to me that the only true way to protect my object graph is to have it only reside on the server and to have the client make calls to update it, but that seems like such an overkill. Is there a better way to handle this situation? I want our application to be as secure as possible.