Id int64 34.6M 60.5M | Title stringlengths 15 150 | Body stringlengths 33 36.7k | Tags stringlengths 3 112 | CreationDate stringdate 2016-01-01 00:21:59 2020-02-29 17:55:56 | Y stringclasses 3 values |
|---|---|---|---|---|---|
35,436,116 | Can SSRS Reports be used without a SQL Server Database? | <p>I have an application that gets all its data from an old AS400 application. </p>
<p>I get a model out (what in MVC I'd call a ViewModel) that has all the data for the reports, but the current legacy code is using the windows forms drawing API to place each box and label and data value on the report. It is hard-coded and maintenance is what you'd expect in terms of nightmare level. </p>
<p>I want to switch over to a report based on the data object or a collection thereof. I know how to write code against an object data source in ASP.Net, but I was wondering if the same can be done using SSRS for the report design, then using the objects collection as the data source. Has anyone done this?</p>
<p>Joey Morgan</p>
| <c#><winforms><reporting-services><objectdatasource> | 2016-02-16 15:13:25 | LQ_CLOSE |
35,436,643 | How to find height of status bar in Android through React Native? | <p>How can I find the height of the status bar on Android through React Native?</p>
<p>If I check the <code>React.Dimensions</code> height the value seems to include the status bar height too but I'm trying to find the height of the layout without the status bar.</p>
| <android><react-native><statusbar> | 2016-02-16 15:34:43 | HQ |
35,436,654 | Can't open resource file in VS 2015: Can't open include file afxres.h | <p>I converted my VS 2012 projects to VS 2015 by using the automatic conversion tool. When I try to load a resource file (.rc) it fails with this error:</p>
<p>fatal error RC1015: Can't open include file afxres.h</p>
<p>Any idea?</p>
| <visual-studio-2015> | 2016-02-16 15:35:31 | HQ |
35,437,253 | How to git cherrypick all changes introduced in specific branch | <p><strong>Background info:</strong> </p>
<p>Due to restrictions in workflow with out existing systems, we need to set up a somewhat unorthodox git process. </p>
<pre><code>(patch) A-B---F
| |
(hotfix) C-D-E
|
(dev) 1-2-3-G
</code></pre>
<p>On the patch branch, there are some commits. The files here are similar but not identical to the ones on dev (sync scripts switch around the order of settings in many of the files, making them appear changed while they are functionally the same). </p>
<p>A fix is needed on this branch so a hotfix branch is created and worked on. This branch is then merged back into patch, so far, so good.</p>
<p>This same fix needs to be deployed to the dev branch so it stays relatively in sync with patch, but trying to merge the hotfix branch leads to git trying to merge all the unrelated and 'unchanged' files from A and B as well, rather than only C,D and E.</p>
<p><strong>Question:</strong></p>
<p>It seems that cherry-pick does what we want in terms of only getting changes from selected commits, but I would really like a way to cherry-pick all commits in a given branch at once, without having to look up the commit ids every time. </p>
| <git><merge><git-cherry-pick> | 2016-02-16 16:01:28 | HQ |
35,437,825 | Problems with inheritance in the STL | <p>In <a href="http://www.stepanovpapers.com/notes.pdf">http://www.stepanovpapers.com/notes.pdf</a>, Alexander Stepanov mentions:</p>
<blockquote>
<p>It is interesting to note that the only examples of inheritance that
remained in STL inherit from empty classes. Originally, there were
many uses of inheritance inside the containers and even iterators, but
they had to be removed because of the problems they caused.</p>
</blockquote>
<p>What are the technical problems that precluded the use of inheritance in the STL?</p>
| <c++><inheritance><stl> | 2016-02-16 16:27:36 | HQ |
35,438,104 | JavaFX alignment of Label in GridPane | <p>I'm confused as to why setting the Label.setAlignment(Pos.CENTER_RIGHT) does not affect the alignment of a label that is then added into a GridPane? The only way to do it is seemingly through the grid (e.g. ColumnConstraints) or by e.g. adding the Label to a HBox that has right alignment.</p>
<p>Why does setting the alignment of the label to CENTER_RIGHT have no effect? I can see the API says: "Specifies how the text and graphic within the Labeled should be aligned when there is empty space within the Labeled." But how do I get empty space in a label?</p>
| <javafx><grid><alignment><label> | 2016-02-16 16:40:13 | HQ |
35,438,268 | RxSwift - Debounce/Throttle "inverse" | <p>Let's say I have an instant messaging app that plays a beep sound every time a message arrives. I want to <code>debounce</code> the beeps, but I'd like to play the beep sound for the first message arrived and not for the following ones (in a timespan of, say, 2 seconds).</p>
<p>Another example might be: my app sends typing notifications (so the user I'm chatting with can see that I'm typing a message). I want to send a typing notification when I start typing, but only send new ones in X-seconds intervals, so I don't send a typing notification for every character I type.</p>
<p>Does this make sense? Is there an operator for that? Could it be achieved with the existing operators?</p>
<p>This is my code for the first example. I'm solving it now with <code>debounce</code>, but it's not ideal. If I receive 1000 messages in intervals of 1 second, it won't play the sound until the last message arrives (I'd like to play the sound on the first one).</p>
<pre><code>self.messagesHandler.messages
.asObservable()
.skip(1)
.debounce(2, scheduler: MainScheduler.instance)
.subscribeNext { [weak self] message in
self?.playMessageArrivedSound()
}.addDisposableTo(self.disposeBag)
</code></pre>
<p>Thanks!</p>
| <ios><swift><rx-swift> | 2016-02-16 16:47:05 | HQ |
35,438,883 | In MsBuild, what's the difference between PropertyGroup and ItemGroup | <p>I can compile a <code>.cs</code> file referenced by <code>PropertyGroup</code>:</p>
<pre><code><Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AssemblyName>MSBuildSample</AssemblyName>
<OutputPath>Bin\</OutputPath>
<Compile>helloConfig.cs</Compile>
</PropertyGroup>
<Target Name="Build">
<MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')" />
<Csc Sources="$(Compile)" OutputAssembly="$(OutputPath)$(AssemblyName).exe"/>
</Target>
</Project>
</code></pre>
<p>or do the same thing using ItemGroup:</p>
<pre><code><Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Include="helloConfig.cs" />
</ItemGroup>
<PropertyGroup>
<AssemblyName>MSBuildSample</AssemblyName>
<OutputPath>Bin\</OutputPath>
</PropertyGroup>
<Target Name="Build">
<MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')" />
<Csc Sources="@(Compile)" OutputAssembly="$(OutputPath)$(AssemblyName).exe"/>
</Target>
</Project>
</code></pre>
<p>I know that using <code>ItemGroup</code> should be the preferred method, but what's when I should use each one of these properties?</p>
| <c#><visual-studio><msbuild> | 2016-02-16 17:14:07 | HQ |
35,438,997 | VS2015 Design view unresponsive issue | <p>I am able to work in the Source view with no problems. However, as soon as I click Design the source freezes and hangs. The same thing happens when I switch to Split as well. I cannot find much documentation/support for this issue and wondered if anyone else ran into this as well or has a potential fix? </p>
| <asp.net><visual-studio-2015> | 2016-02-16 17:19:57 | HQ |
35,439,123 | systemd: "Environment" directive to set PATH | <p>What is the right way to set PATH variable in a <code>systemd</code> unit file?
After seeing a few examples, I tried to use the format below, but the variable doesn't seem to expand.</p>
<pre><code>Environment="PATH=/local/bin:$PATH"
</code></pre>
<p>I am trying this on CoreOS with the below version of systemd.</p>
<pre><code>systemd 225
-PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT -GNUTLS -ACL +XZ -LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD -IDN
</code></pre>
| <linux><systemd><coreos> | 2016-02-16 17:26:14 | HQ |
35,439,613 | python pandas - dividing column by another column | <p>I'm trying to add a column to my <code>DataFrame</code> which is the product of division of two other columns, like so:</p>
<pre><code>df['$/hour'] = df['$']/df['hours']
</code></pre>
<p>This works fine, but if the value in <code>['hours']</code> is less than <code>1</code>, then the <code>['$/hour']</code> value is greater than the value in <code>['$']</code>, which is not what I want.</p>
<p>Is there a way of controlling the operation so that if <code>['hours'] < 1</code> then <code>df['$/hour'] = df['$']</code>?</p>
| <python><python-2.7><pandas><dataframe> | 2016-02-16 17:48:56 | HQ |
35,439,742 | How to use AWS IoT to send/receive messages to/from Web Browser | <p>We are trying to use Amazon Web Services Internet of Things (AWS IoT) to send messages from/to a Web Browser (e.g: . Given that the AWS IoT supports JavaScript we <em>expect</em> that this is <em>possible</em> ...</p>
<p>We have searched at the AWS IoT Documentation but <em>only found <strong>server-side examples</em></strong> <em>(which expose AWS secrets/keys...)</em></p>
<p>Are there any good <em>working</em> examples or tutorials for using AWS IoT to send/receive messages via WebSockets/MQTT in the browser <em>(e.g: authenticating with AWS Cognito)</em>? Thanks!</p>
| <node.js><amazon-web-services><websocket><amazon-cognito><aws-iot> | 2016-02-16 17:55:26 | HQ |
35,440,051 | Write a query to find the rental return date for customers Bill? I want find out the customer "Bill" Car return date | [enter image description here][1]
[1]: http://i.stack.imgur.com/RBEdN.jpg
Write a query to find the rental return date for customers Bill? I want find out the customer "Bill" Car return date | <mysql><sql> | 2016-02-16 18:12:28 | LQ_EDIT |
35,440,211 | UISplitViewController always show master view in iPad portrait mode iOS 9 | <p>I'm building a universal app using UISplitViewController and targeting iOS 9 and above. The app language is Objective-C.</p>
<p>Having started with the Xcode Master/Detail template and set up my views in the standard way, I'm realising that the app will be better if I keep the master view on screen at all times (on iPad), including when the device is in portrait mode. However, no matter how hard I search, I can't find anything to help me learn how this is achieved. I know this was previously achieved using splitViewController:shouldHideViewController:inOrientation:</p>
<p>However, this method is deprecated in iOS 9 and I can't figure out what replaces it and why. I've looked at the new delegate methods for UISplitViewController and find them completely lacking in any level of intuitiveness.</p>
<p>I'd really appreciate some pointers in regard to what replaces splitViewController:shouldHideViewController:inOrientation: and how it can be used to keep the master view displayed at all times on the iPad.</p>
| <ios><objective-c><ipad><ios9><uisplitviewcontroller> | 2016-02-16 18:22:00 | HQ |
35,441,202 | WPF native windows 10 toasts | <p>Using .NET WPF and Windows 10, is there a way to push a local toast notification onto the action center using c#? I've only seen people making custom dialogs for that but there must be a way to do it through the os.</p>
| <wpf><windows-10> | 2016-02-16 19:17:34 | HQ |
35,441,280 | Kotlin RxJava Nullable Bug | <p>I've run into an issue in my Android app using Kotlin and RxJava. It's presented below.</p>
<pre><code>import rx.Observable
data class TestUser(val name: String)
fun getTestUser(): Observable<TestUser> {
return Observable.just(TestUser("Brian")).flatMap { getUser() } // this compiles
}
fun getTestUser2(): Observable<TestUser> {
val observable = Observable.just(TestUser("Brian")).flatMap { getUser() }
return observable // this does not compile
}
fun getUser(): Observable<TestUser?> {
return Observable.just(null)
}
</code></pre>
<p>In <code>getTestUser2</code>, the compiler infers the final return type as <code>Observable<TestUser?></code> and doesn't compile. However in <code>getTestUser</code> the code does compile, and when it's run, any subscriber to that observable may be in for a surprise when the <code>TestUser</code> comes back <code>null</code>.</p>
<p>I'm guessing it's something to do with going back and forth between Kotlin and Java. But, the fact that the compiler <em>can</em> see the difference in <code>getTestUser2</code> makes me think this could be fixable.</p>
<p>Edit</p>
<p>This is on Kotlin 1.0, the final version released just yesterday (Feb 15, 2016).</p>
| <rx-java><kotlin> | 2016-02-16 19:21:31 | HQ |
35,442,072 | How do I get the django HttpRequest from a django rest framework Request? | <p>I'm trying to use the <a href="https://docs.djangoproject.com/en/1.9/ref/contrib/messages/" rel="noreferrer">django messages framework</a> to show messages after <code>ModelViewSet.create()</code>:</p>
<pre><code>class DomainModelViewSet(ModelViewSet):
def create(self, request):
super(DomainModelViewSet, self).create(request)
messages.success(self.request, "Domain Added.")
return HttpResponseRedirect(reverse('home'))
</code></pre>
<p>But I get:</p>
<pre><code>TypeError: add_message() argument must be an HttpRequest object, not 'Request'.
</code></pre>
<p>So, how can use the Django <code>HttpRequest</code> from django rest framework <code>Request</code>?</p>
| <python><django><django-rest-framework> | 2016-02-16 20:11:11 | HQ |
35,442,174 | javascript import from '/folder' with index.js | <p>I've noticed a few cases where I've seen something like the following:</p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>// /reducers/reducer1.js
export default function reducer1(state = {}, action){
// etc...
}
// /reducers/reducer2.js
export default function reducer2(state = {}, action){
// etc...
}
// /reducers/index.js
import { combineReducers } from 'redux';
import reducer1 from './reducer1';
import reducer2 from './reducer2';
export default combineReducers({
reducer1,
reducer2
})
// /store.js
import masterReducer from './reducers';
export default function makeStore(){
// etc...
}</code></pre>
</div>
</div>
</p>
<p>Notice the last "file" where we call <code>import masterReducer from './reducers'</code> - A few people seem to believe this should import the <code>default export</code> from the index.js file.</p>
<p>Is this actually part of the specification? - my interpretation/question is that this is the result of many folks using WebPack v1 which translates <code>import</code> statements into CommonJS-style <code>requires</code> statements? Or will this break in WebPack v2 with "official" <code>import</code>/<code>export</code> support?</p>
| <javascript><ecmascript-6><webpack> | 2016-02-16 20:17:07 | HQ |
35,442,450 | How to compare System.Enum to enum (implementation) without boxing? | <p>How can I compare a <code>System.Enum</code> to an <code>enum</code> without boxing? For example, how can I make the following code work without boxing the <code>enum</code>?</p>
<pre><code>enum Color
{
Red,
Green,
Blue
}
...
System.Enum myEnum = GetEnum(); // Returns a System.Enum.
// May be a Color, may be some other enum type.
...
if (myEnum == Color.Red) // ERROR!
{
DoSomething();
}
</code></pre>
<p>To be specific, the intent here is not to compare the underlying values. In this case, the underlying values are not meant to matter. Instead, if two Enums have the same underlying value, they should not be considered equal if they are two different kinds of enums:</p>
<pre><code>enum Fruit
{
Apple = 0,
Banana = 1,
Orange = 2
}
enum Vegetable
{
Tomato = 0,
Carrot = 1,
Celery = 2
}
myEnum = Vegetable.Tomato;
if (myEnum != Fruit.Apple) // ERROR!
{
// Code should reach this point
// even though they're the same underlying int values
Log("Works!");
}
</code></pre>
<p>This is basically the same functionality as <code>Enum.Equals(Object)</code>. Unfortunately <code>Equals()</code> requires boxing the enum, which in our case would be a naughty thing to do.</p>
<p>Is there a nice way to compare two arbitrary enums without boxing or otherwise creating a bunch of overhead?</p>
<p>Thanks for any help!</p>
| <c#><enums> | 2016-02-16 20:34:46 | HQ |
35,443,312 | Refine my t-sql query to increase performance | Created a sql query to summarize some data.
It is slow, so I thought I'd ask for some help.
Table is a log table that has : loc,tag,entrytime,exittime,visits,entrywt,exitwt.
My test log has 700,000 records in it. The entrytime and exittime are epoch values.
I know my query is inefficient as it rips through the table 4 times.
select loc,edate,tag,
(Select COUNT(*) from mylog as ml where mvlog.loc = ml.loc and mvlog.edate = CONVERT(date, DATEADD(ss, ml.entrytime,'19700101')) and mvlog.tag = ml.tag) as visits,
(Select SUM(entrywt - exitwt) from mylog as ml2 where mvlog.loc = ml2.loc and mvlog.edate = CONVERT(date, DATEADD(ss, ml2.entrytime,'19700101')) and mvlog.tag = ml2.tag) as consumed,
(Select SUM(exittime - entrytime) from mylog as ml3 where mvlog.loc = ml3.loc and mvlog.edate = CONVERT(date, DATEADD(ss, ml3.entrytime,'19700101')) and mvlog.tag = ml3.tag) as occupancy
from eventlogV as mvlog with (INDEX(pt_index))
index pt_index is fields tag and loc.
When I run this query, it completes in roughly 30 seconds. Since my query is inefficient, I am sure it can be better.
any ideas appreciated. | <sql><sql-server><query-performance><sqlperformance> | 2016-02-16 21:26:06 | LQ_EDIT |
35,443,608 | Creating a Scientific Calculator in Javascript | <p>I have a scientific calculator and I have a Calculator. My question is how do I write a scientific calculator class that matches this specification.</p>
<pre><code>describe( "ScientificCalculator", function(){
var calculator;
beforeEach( function(){
calculator = new ScientificCalculator();
}
);
it( "extends Calculator", function(){
expect( calculator ).to.be.instanceOf( Calculator );
expect( calculator ).to.be.instanceOf( ScientificCalculator );
}
);
it( "returns the sine of PI / 2", function(){
expect( calculator.sin( Math.PI / 2 ) ).to.equal( 1 );
}
);
it( "returns the cosine of PI", function(){
expect( calculator.cos( Math.PI ) ).to.equal( -1 );
}
);
it( "returns the tangent of 0", function(){
expect( calculator.tan( 0 ) ).to.equal( 0 );
}
);
it( "returns the logarithm of 1", function(){
expect( calculator.log( 1 ) ).to.equal( 0 );
}
);
}
);
</code></pre>
| <javascript> | 2016-02-16 21:44:31 | LQ_CLOSE |
35,443,817 | Is there a way to overwrite log files in python 2.x | <p>I'm using python2.x logging module, like,</p>
<pre><code>logging.basicConfig(format='%(asctime)s %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p',
filename='logs.log',
level=logging.INFO)
</code></pre>
<p>I want my program to overwrite logs.log file for each execution of the script, currently it just appends to old logs.
I know the below code will overwrite, but if there is a way to do it via logging config, it'll look better.</p>
<pre><code>with open("logs.log", 'w') as file:
pass
</code></pre>
| <python-2.7><logging> | 2016-02-16 21:58:05 | HQ |
35,444,188 | Difference between using the Stack or the Heap | <p><strong>Are there any problems when using the stack instead of the heap?</strong></p>
<p>Basically I want some 200 positions in memory (or more, 1000, who knows, this is hypothetical anyways), I can allocate it in the stack using an array, or on the heap using <code>malloc()</code>. On the heap I have to remember to always <code>free()</code> the memory...but using the stack, as soon as the function returns, all the memory is nicely cleaned for me.</p>
<p>I am just wondering if there are any issues with holding large amounts of memory on the stack. As far as I know, the stack and the heap are basically the same, just they sit on opposite sides in a RAM frame, and they grow towards the other, like in the image below.</p>
<p><a href="https://i.stack.imgur.com/02kBO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/02kBO.jpg" alt="Stack and Heap"></a></p>
| <c++><c><memory><stack><heap-memory> | 2016-02-16 22:23:53 | LQ_CLOSE |
35,445,186 | Can GitHub automatically merge branches? | <p>We want to automatically merge out from master to another long-lived branch whenever any changes are committed to master (at the moment, this is a manual process and people forget)</p>
<p>I appreciate that it may not always be possible, owing to merge conflicts, but if it is possible, we'd like it to happen automatically.</p>
<p>Is this possible?</p>
| <git><github> | 2016-02-16 23:39:05 | HQ |
35,445,849 | Sequelize findOne latest entry | <p>I need to find the latest entry in a table. What is the best way to do this? The table has Sequelize's default <code>createdAt</code> field.</p>
| <javascript><node.js><sequelize.js> | 2016-02-17 00:43:19 | HQ |
35,446,022 | how to select a cell that matches another cell value vba | <p>Does anyone know how i might select any cell in a range that matches another?
for Example:</p>
<p>comparing range ("A9:A200") to range("B9")</p>
<p>if say range ("A10") is "bellingham" and range ("B9") is also bellingham </p>
<p>I want A10 to be the active cell. </p>
<p>any help would be most apreciated. thank you.</p>
| <vba><excel> | 2016-02-17 01:00:00 | LQ_CLOSE |
35,446,352 | Trying to see if this is responsive | <p>Review the basic CSS below, confirm whether this will provide a responsive page or not. If not, what changes would need to take place for it to be responsive?</p>
<pre><code> <style>
.article {
float: left;
margin: 5px;
padding: 5px;
width: 300px;
height: 300px;
border: 1px solid black;
}
</style>
</code></pre>
| <html><css> | 2016-02-17 01:33:01 | LQ_CLOSE |
35,446,386 | Setting a textView equal to a value in an Array Java | <p>I have written some simple code to generate a random value in my array. It generates that random value, but I cannot set my textView equal to that value. This is a very simple problem, but I can't seem to find the solution anywhere.</p>
<p>Here is my code...</p>
<pre><code>final String[] group_topics = {"Walking", "Swimming", "Running"};
public void getRandomTopic1() {
Random random = new Random();
int index = random.nextInt(group_topics.length);
topicOne.setText(group_topics[index]);
topicOne = (TextView) findViewById(R.id.textView2);
}
</code></pre>
| <java><android><arrays> | 2016-02-17 01:36:42 | LQ_CLOSE |
35,446,765 | ImportError: No module named extern | <p>I'm getting this error when trying to install any package with pip. I have two pip instances, one with Python 2.7 and other with Python 3.</p>
<pre><code> Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 375, in setup_py
import setuptools # noqa
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extern.six.moves import filterfalse, map
File "/usr/local/lib/python2.7/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
ImportError: No module named extern
</code></pre>
<p>Even when I try to install the 'extern' module I get this error. Also when installing with Python itself, like <code>python setup.py install</code>.</p>
<p>Thanks in advance. </p>
| <python><python-2.7><pip><setuptools><importerror> | 2016-02-17 02:22:33 | HQ |
35,447,873 | Storing value in memory node js | <p>I use a request to return a value in node js. I would like to store the value return in memory in node js. Besides, the value should be initialize on app start. How could it be achieved?</p>
| <node.js><express> | 2016-02-17 04:18:48 | LQ_CLOSE |
35,448,269 | Angular Materials: Can you disable the autocomplete suggestions for an input? | <p>I'm just using simple input containers such as this</p>
<pre><code><md-input-container class="md-block" flex-gt-sm >
<label>Name</label>
<input md-maxlength="30" name="name" ng-model="name" />
</md-input-container>
</code></pre>
<p>The input field is suggesting previously entered values which is obscuring some important interface elements and also really not necessary in my case. Is there any way to disable the suggestions?</p>
| <angularjs><angular-material> | 2016-02-17 04:59:35 | HQ |
35,448,413 | Drawing a pyramid in console application( VB.NET) | How can i write a program that asks the user to enter the number of lines for the pyramid to be
drawn. If I typed number 6 the pyramid will have 6 star from the bottom to the top. | <vb.net> | 2016-02-17 05:13:14 | LQ_EDIT |
35,448,737 | connecting java application to mysql(wamp) | this is my first post to This blog .....
Well I am trying to make a chat messenger in netbeans with java as front end and mysql in wamp and I'm stuck at point where i want to display the registered users in jTextArea as shown
[chat messenger frame][1] [1]: http://i.stack.imgur.com/8PO2c.png
Also i want to add that my database is connected to the appication
Do tell me if more information is required .....Thank you in advance
| <java><mysql><netbeans><wamp> | 2016-02-17 05:38:47 | LQ_EDIT |
35,449,226 | Laravel - Seeding Relationships | <p>In Laravel, database seeding is generally accomplished through Model factories. So you define a blueprint for your Model using Faker data, and say how many instances you need:</p>
<pre><code>$factory->define(App\User::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
'email' => $faker->email,
'password' => bcrypt(str_random(10)),
'remember_token' => str_random(10),
];
});
$user = factory(App\User::class, 50)->create();
</code></pre>
<p>However, lets say your User model has a <code>hasMany</code> relationship with many other Models, like a <code>Post</code> model for example:</p>
<pre><code>Post:
id
name
body
user_id
</code></pre>
<p>So in this situation, you want to seed your Posts table with <strong><em>actual</em></strong> users that were seeded in your Users table. This doesn't seem to be explicitly discussed, but I did find the following in the Laravel docs:</p>
<pre><code>$users = factory(App\User::class, 3)
->create()
->each(function($u) {
$u->posts()->save(factory(App\Post::class)->make());
});
</code></pre>
<p>So in your User factory, you create X number of Posts for each User you create. However, in a large application where maybe 50 - 75 Models share relationships with the User Model, your User Seeder would essentially end up seeding the entire database with all it's relationships.</p>
<p>My question is: Is this the best way to handle this? The only other thing I can think of is to Seed the Users first (without seeding any relations), and then pull random Users from the DB as needed while you are seeding other Models. However, in cases where they need to be unique, you'd have to keep track of which Users had been used. Also, it seems this would add a lot of extra query-bulk to the seeding process.</p>
| <php><laravel> | 2016-02-17 06:15:53 | HQ |
35,449,324 | TCL get the last line with consecutive pattern | Hi I have a pattern in a line and I want to get the last line if there are consecutive occurrence in the file.
example file:
apple 1
banana 5
banana 6
apple 2
apple 5
apple 7
banana 9
expected output:
apple 1
banana 6
apple 7
banana 9
Thanks in advance | <tcl> | 2016-02-17 06:22:11 | LQ_EDIT |
35,449,664 | Grab the return value and get out of forEach in JavaScript? | <p>How can I modify this code so that I can grab the field.DependencyFieldEvaluated value and get out of the function as soon I get this value?</p>
<pre><code>function discoverDependentFields(fields) {
fields.forEach(function (field) {
if (field.DependencyField) {
var foundFields = fields.filter(function (fieldToFind) { return fieldToFind.Name === field.DependencyField; });
if (foundFields.length === 1) {
return field.DependencyFieldEvaluated = foundFields[0];
}
}
});
}
</code></pre>
| <javascript> | 2016-02-17 06:43:34 | HQ |
35,449,679 | Is it possible to convert String to ResultSet in jsp? | <p>How can I convert List to Result Set. Is it possible to do this conversion?</p>
| <java><jsp> | 2016-02-17 06:44:33 | LQ_CLOSE |
35,450,535 | Is it considered grey/black hat SEO if I modify the sizing of the headings? | <p>The situation is the following:</p>
<p>The page's title is H3, the article's title is H2 and some keyword/important sentence is H1 in the article. They have custom css classes on them, so the H3 looks like a H1, and the H1 looks like normal text. Is this considered grey/black hat SEO, or Google doesn't care about their rendered size?</p>
| <html><css><seo> | 2016-02-17 07:38:56 | LQ_CLOSE |
35,451,154 | Interchange of Function in OpenCV 3.0 | Want these function in OpenCV 3.0 Java
**
**Mat imageHSV = new Mat(image.size(), Core.DEPTH_MASK_8U); Mat imageBlurr = new Mat(image.size(), Core.DEPTH_MASK_8U);
new Mat(image.size(), Core.DEPTH_MASK_ALL);
Mat imageA =new Mat(image.size(), Core.DEPTH_MASK_ALL);
**
| <java><opencv3.0> | 2016-02-17 08:13:16 | LQ_EDIT |
35,451,540 | Extracting Windows File Properties (Custom Properties) C# | <p>In Word/Excel you have to possibility to add Custom properties. (See Image)
<a href="http://i.stack.imgur.com/ESWIw.png">Custom Properties</a>.
As you guys can see there is the field: "Properties:", you can add any information you want there.
When you save the file and you go to the file location in the folder, you can right click -> Properties and you have all the tabs: General/Security/Details/Previous Versions. with the feature you add the tab Custom.</p>
<p>Now I want to get this information through coding: <a href="http://i.stack.imgur.com/06nsA.png">Custom Properties information</a>. and extract it later to notepad.
So far i used the <code>Shell32</code> but then I only get the information that is in the Details tab. I did some research and saw some possibilities with <code>DSOfile.dll</code>. But I want to know if there is a possibility to do this without installing other DLL?
This is my code so far with the <code>Shell32</code>.</p>
<pre><code> static void Main(string[] args)
{
//using (StreamWriter writer = new StreamWriter(@"filepathhere"))
//{
//Console.SetOut(writer);
ReadProperties();
//}
}
static void ReadProperties()
{
List<string> arrHeaders = new List<string>();
Shell shell = new Shell();
Folder objFolder = shell.NameSpace(@"filepathhere");
FolderItem objFolderItem = objFolder.ParseName("filehere.doc");
for (int i = 0; i < short.MaxValue; i++)
{
string header = objFolder.GetDetailsOf(objFolder, i);
if (String.IsNullOrEmpty(header))
break;
arrHeaders.Add(header);
}
for ( int i = 0; i < arrHeaders.Count; i++)
{
Console.WriteLine("{0}\t{1}: {2}", i, arrHeaders[i], objFolder.GetDetailsOf(objFolderItem, i));
}
Console.ReadKey();
}
</code></pre>
<p>Thanks in advance!</p>
<p>Desu</p>
| <c#><windows><file><properties><visual-studio-2015> | 2016-02-17 08:36:13 | HQ |
35,452,040 | select tow table oracle | Please help
I am I have two tables
EMPLOYEE, DEPARTMENT
Table DEPARTMENT
There are fields in which
DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
EMPLOYEE table
There are fields in which
EMPLOYEE_ID
FIRST_NAME
LAST_NAME
EMAIL
PHONE_NUMBER
HIRE_DATE DATE
JOB_ID
SALARY
COMMISSION_PCT
MANAGER_ID
DEPARTMENT_ID
When the desired number appears DEPARTMENT_ID chose me EMPLOYEE_ID
> FIRST_NAME
> LAST_NAME
> EMAIL
> PHONE_NUMBER
> HIRE_DATE DATE
> JOB_ID
> SALARY
> COMMISSION_PCT
> MANAGER_ID
> DEPARTMENT_ID | <oracle10g> | 2016-02-17 09:02:30 | LQ_EDIT |
35,452,074 | Why does Spark job fail with "Exit code: 52" | <p>I have had Spark job failing with a trace like this one:</p>
<pre><code>./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr-Container id: container_1455622885057_0016_01_000008
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr-Exit code: 52
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr:Stack trace: ExitCodeException exitCode=52:
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr- at org.apache.hadoop.util.Shell.runCommand(Shell.java:545)
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr- at org.apache.hadoop.util.Shell.run(Shell.java:456)
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr- at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:722)
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr- at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:211)
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr- at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr- at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr- at java.util.concurrent.FutureTask.run(FutureTask.java:262)
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr- at java.lang.Thread.run(Thread.java:745)
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr-
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr-
./containers/application_1455622885057_0016/container_1455622885057_0016_01_000001/stderr-Container exited with a non-zero exit code 52
</code></pre>
<p>It took me a while to figure out what "exit code 52" means, so I'm putting this up here for the benefit of others who might be searching</p>
| <apache-spark><yarn><spark-dataframe> | 2016-02-17 09:04:04 | HQ |
35,452,878 | Continuous Deployment of a NodeJS using GitLab | <p>I have an API developed in NodeJS and have successfully set up continuous integration via a <code>.gitlab-ci.yml</code> file. The next stage is to set up continuous deployment to Heroku if all tests pass on the master branch.</p>
<p>There are plenty of tutorials covering the deployment of Ruby and Python apps but nothing on NodeJS. Currently my <code>.gitlab-ci.yml</code> file looks like this:</p>
<pre><code>image: node:latest
job1:
script: "ls -l"
test:
script: "npm install;npm test"
production:
type: deploy
script:
- npm install
- npm start
- gem install dpl
- dpl --provider=heroku --app=my-first-nodejs --api-key=XXXXXXXXXX
only:
- master
</code></pre>
<p>The Ruby and Python tutorials use the <code>dpl</code> tool to deploy but how can I start the NodeJS script on the server once deployed?</p>
<p>After adding the production section and pushing it the tests run and pass but the deploy stage gets stuck on pending. The console is blank. Has anyone set up a successful CD script for NodeJS?</p>
| <javascript><node.js><heroku><gitlab><continuous-deployment> | 2016-02-17 09:39:23 | HQ |
35,453,174 | I am having trouble with getting my image to rotate anti-clockwise, i feel i may be missing a simple step, here is my code : | `.image {
position: absolute;
top: 30%;
left: 37%;
width: 430px;
height: 430px;
margin:210px 0 0 -60px;
-webkit-animation:spin 75s linear infinite;
-moz-animation:spin 75s linear infinite;
animation:spin 75s linear infinite;
}
`.redline {
position: absolute;
top: 30%;
left: 37%;
width: 430px;
height: 430px;
margin:210px 0 0 -60px;
-webkit-animation:spin 35s linear infinite;
-moz-animation:spin 35s linear infinite;
animation:spin 35s linear infinite;
}
@-moz-keyframes spin { 100% { transform-moz-transform: spin(-720deg); } }` | <jquery><html><css><animation> | 2016-02-17 09:51:45 | LQ_EDIT |
35,453,653 | Why am I getting a run time error(SIGSEGV) for the following code? | <p>This is the solution of the Prime Generator problem on SPOJ(Sphere online judge), I have checked and no array is out of bound, and still it is showing run time error.</p>
<pre><code>#include <stdio.h>
int main(){
int n;
int i,j,a,b;
scanf("%d", &n);
while(n){
scanf("%d %d", &a, &b);
int arr[b];
// Filling the array
for(i=2;i<=b;i++){
arr[i-2]=i;
}
int p,c;
for(p=0;p<b-1;p++){
if(arr[p]){
if(arr[p]>=a){
printf("\n%d", arr[p]);
}
for(c=p+arr[p];c<b-2;c+= arr[p]){
arr[c]=0;
}
}
}
n--;
}
</code></pre>
| <c> | 2016-02-17 10:12:12 | LQ_CLOSE |
35,453,704 | How to clear CrashLoopBackOff | <p>When a Kubernetes pod goes into <code>CrashLoopBackOff</code> state, you will fix the underlying issue. How do you force it to be rescheduled?</p>
| <kubernetes> | 2016-02-17 10:14:08 | HQ |
35,455,792 | How Java random generator works? | <p>I wrote program that simulates dice roll</p>
<pre><code> Random r = new Random();
int result = r.nextInt(6);
System.out.println(result);
</code></pre>
<p>I want to know if there is a way to "predict" next generated number and how JVM determines what number to generate next?</p>
<p>Will my code output numbers close to real random at any JVM and OS?</p>
| <java><random><jvm> | 2016-02-17 11:44:53 | HQ |
35,455,831 | Get html table content via Pyton | i would like to extract the following table content and save it in a csv file via pandas, but only extract the date (e.g. Thu, 11/02) and all values, which are tagged by €/MWh. Thank you all very much in advance.
Source code:
<table cellspacing="0" cellpadding="0" border="0" class="list hours responsive" width="100%">
<tbody>
<tr>
<th class="title"></th>
<th class="units"></th>
<th>Thu, 11/02</th>
<th>Fri, 12/02</th>
<th>Sat, 13/02</th>
<th>Sun, 14/02</th>
<th>Mon, 15/02</th>
<th>Tue, 16/02</th>
<th>Wed, 17/02</th>
</tr>
<tr class="no-border">
<td class="title">
00 - 01
</td>
<td>€/MWh</td>
<td>23.82</td>
<td>22.81</td>
<td>22.23</td>
<td>13.06</td>
<td>16.57</td>
<td>25.99</td>
<td>32.45</td>
</tr>
<tr>
<td> </td>
<td>MWh</td>
<td>10,266.0</td>
<td>9,626.6</td>
<td>12,255.9</td>
<td>11,084.7</td>
<td>11,039.5</td>
<td>13,134.7</td>
<td>9,958.1</td>
</tr>
<tr class="no-border">
<td class="title">
01 - 02
</td>
<td>€/MWh</td>
<td>21.48</td>
<td>21.59</td>
<td>21.10</td>
<td>12.17</td>
<td>16.00</td>
<td>23.65</td>
<td>31.27</td>
</tr>
<tr>
<td> </td>
<td>MWh</td>
<td>9,843.3</td>
<td>9,494.4</td>
<td>11,823.3</td>
<td>10,531.9</td>
<td>9,970.5</td>
<td>12,875.6</td>
<td>9,958.8</td>
</tr>
<tr class="no-border">
<td class="title">
02 - 03
</td>
<td>€/MWh</td>
<td>21.00</td>
<td>21.30</td>
<td>20.21</td>
<td>8.81</td>
<td>14.55</td>
<td>22.91</td>
<td>29.72</td>
</tr>
<tr>
<td> </td>
<td>MWh</td>
<td>9,857.0</td>
<td>9,427.9</td>
<td>11,755.2</td>
<td>10,061.9</td>
<td>9,881.7</td>
<td>12,841.0</td>
<td>9,896.9</td>
</tr>
<tr class="no-border">
<td class="title">
03 - 04
</td>
<td>€/MWh</td>
<td>19.94</td>
<td>19.86</td>
<td>19.94</td>
<td>6.74</td>
<td>13.14</td>
<td>22.04</td>
<td>27.44</td>
</tr>
<tr>
<td> </td>
<td>MWh</td>
<td>9,486.2</td>
<td>10,492.7</td>
<td>12,609.1</td>
<td>11,216.6</td>
<td>10,199.9</td>
<td>11,209.7</td>
<td>9,698.5</td>
</tr>
</tbody>
</table> | <python> | 2016-02-17 11:46:46 | LQ_EDIT |
35,457,154 | Finding data within a class | I am using this class:
class player
{
public string name;
public int rating;
{
and would like to access the 'name' due to the 'rating' that I have. Something along the lines of:
Get the name of the player that has the rating '4', or whatever the rating may be. There must be some sort of link between name and rating because they are in the same class, but im not sure how to exploit this. Also if there are class instances where two of them have the same rating, how would it effect this?
| <c#><list><class> | 2016-02-17 12:46:21 | LQ_EDIT |
35,457,167 | Looping JSON Array | > I'm trying to make a program that will display multiple titles with
> pictures under them. I looked over stackoverflow, and can't get
> any of the suggestions to work for me. All my errors are within private
> void ShowJSON
>
> package br.exemplozxingintegration;
>
> import android.annotation.SuppressLint;
> import android.app.ProgressDialog;
> import android.content.ClipData;
> import android.content.ClipboardManager;
> import android.content.Intent;
> import android.os.Bundle;
> import android.support.v7.app.AppCompatActivity;
> import android.view.View;
> import android.widget.Button;
> import android.widget.EditText;
> import android.widget.ImageView;
> import android.widget.TextView;
> import android.widget.Toast;
>
> import com.android.volley.RequestQueue;
> import com.android.volley.Response;
> import com.android.volley.VolleyError;
> import com.android.volley.toolbox.StringRequest;
> import com.android.volley.toolbox.Volley;
> import com.squareup.picasso.Picasso;
>
> import org.json.JSONArray;
> import org.json.JSONException;
> import org.json.JSONObject;
>
>
>
> public class ForthActivty extends AppCompatActivity implements View.OnClickListener {
>
> private EditText pastetext;
> private ClipboardManager myClipboard;
> private ClipData myClip;
> private Button btn;
> private Button btn2;
> private EditText textView1;
> private Button buttonGet;
> private TextView textViewResult;
> private ImageView ImageView1;
>
> private ProgressDialog loading;
>
>
> @Override
> protected void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
>
> setContentView(R.layout.activity_forth_activty);
> myClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
> pastetext = (EditText) findViewById(R.id.textView1);
>
> btn = (Button)findViewById(R.id.buttonPaste);
> btn.performClick();
>
>
> textView1 = (EditText) findViewById(R.id.textView1);
> buttonGet = (Button) findViewById(R.id.buttonGet);
> textViewResult = (TextView) findViewById(R.id.textViewResult);
> ImageView1= (ImageView) findViewById(R.id.imageView1);
>
> buttonGet.setOnClickListener(this);
>
> btn2 = (Button)findViewById(R.id.buttonGet);
> btn2.performClick();
>
>
> }
>
> @SuppressLint("NewApi")
> public void paste(View view) {
> ClipData cp = myClipboard.getPrimaryClip();
> ClipData.Item item = cp.getItemAt(0);
> String text = item.getText().toString();
> pastetext.setText(text);
> Toast.makeText(getApplicationContext(), "",
> Toast.LENGTH_SHORT).show();}
>
>
> private void getData() {
> String qrcode = textView1.getText().toString().trim();
> if (qrcode.equals("")) {
> Toast.makeText(this, "", Toast.LENGTH_LONG).show();
> return;
> }
> loading = ProgressDialog.show(this,"Please wait...","Fetching...",false,false);
>
> String url = ConfigRec.DATA_URL+textView1.getText().toString().trim();
>
> StringRequest stringRequest = new StringRequest(url, new Response.Listener<String>() {
> @Override
> public void onResponse(String response) {
> loading.dismiss();
> showJSON(response);
> }
> },
> new Response.ErrorListener() {
> @Override
> public void onErrorResponse(VolleyError error) {
> Toast.makeText(ForthActivty.this,error.getMessage().toString(),Toast.LENGTH_LONG).show();
> }
> });
>
> RequestQueue requestQueue = Volley.newRequestQueue(this);
> requestQueue.add(stringRequest);
> }
>
> private void showJSON(String response){
> String title="";
> String image = "";
> try {
> for(int response=0;response<JSONArray.length();response++)
> JSONObject jsonObject = new JSONObject(response);
> JSONArray result = jsonObject.getJSONArray(ConfigRec.JSON_ARRAY);
> JSONObject androidData = result.getJSONObject(0);
> title = androidData.getString(ConfigRec.KEY_TITLE);
> image = androidData.getString(ConfigRec.KEY_IMAGE);
> } catch (JSONException e) {
> e.printStackTrace();
> }
> textViewResult.setText(title);//+"\nImagine :\t"+ image);
> //int id = >getResources().getIdentifier("http://192.168.1.254/2015/380panel/uploads/images>/sm/"+ image, null, null);
> //ImageView1.setImageURI(id);
> >Picasso.with(this).load("http://192.168.1.254/2015/380panel/uploads/images/sm/+ image).into(ImageView1);
>
> }
>
>
>
>
And my errors are: Variable response is already defined in the scope
Non-static method length cannot be referenced from a static context
Cannot resolve constructor JSONobject(int)
Cannot resolve symbol JSONobject | <android><android-json> | 2016-02-17 12:46:49 | LQ_EDIT |
35,457,461 | Remove particular elements from an array using php | <p>I have one array like below</p>
<pre><code>Array
(
[AllocationPool] => TEST do not USE
[Quarter] => 2016-Q4
[Segment] => Storage
[Region] =>
[SubRegion] =>
[Country] =>
[typeofrec] => 0
[TotalAllocations] => 100
[TotalTransfersOut] => 75
[TotalTransfersIn] => 0
[StartOfAllocation] => 25
[ApprovedActivities] => 0
[AvailableBalance] => 25
[TotalApprovedClaims] => 0
[Balance] => 25
[TotalUnApprovedClaims] => 0
[Exposure] => 25
)
</code></pre>
<p>I need to remove some elements from this array and formatted to new structure.</p>
<p>I need to change below structure after format my array </p>
<pre><code>Array
(
[AllocationPool] => TEST do not USE
[Quarter] => 2016-Q4
[Segment] => Storage
[Region] =>
[SubRegion] =>
[Country] =>
)
</code></pre>
<p>Is any method available in php for remove some elements in an array using php?</p>
| <php><arrays> | 2016-02-17 12:59:56 | LQ_CLOSE |
35,457,980 | QueryException: ResultTransformer is not allowed for 'select new' queries | <p>I have the following SpringData Repository Query:</p>
<pre><code> @Query("SELECT new com.mypackage.MobileCaseList(c.ident, concat(c.subtype, ' - ', c.contactName), c.type, coalesce(c.updateTimestamp,c.insertTimestamp) )" +
"FROM MobileCase c WHERE c.mobileUser.ident = ?1 AND c.origin = 'SOURCE' ORDER BY c.appointmentFrom NULLS LAST")
List<MobileCaseList> findCasesForUser(String userIdent);
</code></pre>
<p>And following runtime code:</p>
<pre><code> List<MobileCaseList> result = caseRepo.findCasesForUser(userIdent);
</code></pre>
<p>This worked fine until now - no idea what causes the exception now. On my PC (localhost) it still works!? But on the Ubuntu server the query execution fails with following error:</p>
<pre><code>2016-02-17 12:56:49.696 ERROR 13397 --- [http-nio-9090-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.QueryException: ResultTransformer is not allowed for 'select new' queries.; nested exception is java.lang.IllegalArgumentException: org.hibernate.QueryException: ResultTransformer is not allowed for 'select new' queries.] with root cause
org.hibernate.QueryException: ResultTransformer is not allowed for 'select new' queries.
at org.hibernate.loader.hql.QueryLoader.checkQuery(QueryLoader.java:502) ~[hibernate-core-4.3.11.Final.jar!/:na]
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:496) ~[hibernate-core-4.3.11.Final.jar!/:na]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387) ~[hibernate-core-4.3.11.Final.jar!/:na]
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:236) ~[hibernate-core-4.3.11.Final.jar!/:na]
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1300) ~[hibernate-core-4.3.11.Final.jar!/:na]
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103) ~[hibernate-core-4.3.11.Final.jar!/:na]
at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573) ~[hibernate-entitymanager-4.3.11.Final.jar!/:na]
at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:449) ~[hibernate-entitymanager-4.3.11.Final.jar!/:na]
at org.springframework.data.jpa.repository.query.JpaQueryExecution$CollectionExecution.doExecute(JpaQueryExecution.java:114) ~[spring-data-jpa-1.10.0.M1.jar!/:na]
at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:78) ~[spring-data-jpa-1.10.0.M1.jar!/:na]
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:102) ~[spring-data-jpa-1.10.0.M1.jar!/:na]
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:92) ~[spring-data-jpa-1.10.0.M1.jar!/:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482) ~[spring-data-commons-1.12.0.M1.jar!/:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) ~[spring-data-commons-1.12.0.M1.jar!/:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na]
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.12.0.M1.jar!/:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.2.4.RELEASE.jar!/:na]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[spring-tx-4.2.4.RELEASE.jar!/:na]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.2.4.RELEASE.jar!/:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.2.4.RELEASE.jar!/:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na]
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:131) ~[spring-data-jpa-1.10.0.M1.jar!/:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.4.RELEASE.jar!/:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-4.2.4.RELEASE.jar!/:na
at com.sun.proxy.$Proxy144.findCasesForUser(Unknown Source) ~[na:na]
</code></pre>
<p><strong>Any ideas, suggestions...?</strong></p>
| <java><spring><hibernate><jpa><hql> | 2016-02-17 13:24:32 | HQ |
35,458,081 | iOS Universal Links and GET parameters | <p>we're trying to implement app indexing on iOS using the Apple Universal Links (I'm looking at <a href="https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW2" rel="noreferrer">https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW2</a>).</p>
<p>In the "Creating and Uploading the Association File" section I see I can limit the indexing to specific pages, which is good.</p>
<p>I'd like to limit the indexing to <a href="https://www.mywebsite.com?parameter=something" rel="noreferrer">https://www.mywebsite.com?parameter=something</a>, how can I?</p>
<p>I was thinking about something like that:</p>
<pre><code>{
"applinks": {
"apps": [],
"details": [
{
"appID": "MYID",
"paths":[ "*?parameter=*" ]
}
]
}
}
</code></pre>
<p>Do you think it could work? I can't test it yet because it takes time to get the authorization for uploading files on the website root directory, that's why I'm asking you if you think it could work, I'd like to upload the file just once if I can.</p>
<p>Thank you</p>
| <ios><ios-universal-links><google-app-indexing> | 2016-02-17 13:29:43 | HQ |
35,458,107 | How to convert this code in devexpress VCL for Delphi | <p>Hello I want to convert this code into VCL Delphi: </p>
<pre><code> // Create an empty list.
ArrayList rows = new ArrayList();
// Add the selected rows to the list.
for (int i = 0; i < gridView1.SelectedRowsCount; i++) {
if (gridView1.GetSelectedRows()[i] >= 0)
rows.Add(gridView1.GetDataRow(gridView1.GetSelectedRows()[i]));
}
try {
gridView1.BeginUpdate();
for (int i = 0; i < rows.Count; i++) {
DataRow row = rows[i] as DataRow;
// Change the field value.
row["Discontinued"] = true;
}
}
finally {
gridView1.EndUpdate();
}
</code></pre>
<p>I am trying to do the same but in VCL there is not SelectedRowsCount or GetSelectedRows where can I find thoughs?</p>
| <c#><delphi><devexpress> | 2016-02-17 13:31:00 | LQ_CLOSE |
35,458,158 | How to split string to sring array withou word splittig in C++ | I need to split input string (array of word, space delimited), into string array with max length 'M' without breakdown any word,
How can do this in C++?
for example:
input string="I need to split input string";
where M=10;
output array ={"I need to ","split ","input ","string"};
| <c++><arrays><string> | 2016-02-17 13:33:27 | LQ_EDIT |
35,458,623 | Jquery: Uncaught SyntaxError: missing ) after argument list | <p>I am not sure what causes this problem (thought I covered it correctly). What happens is that on click, it should apply the grow class (which is 0.8 seconds) and after that flip over. Else it reverses this proces.</p>
<pre><code>$('.click').toggle(function(){
var self = this;
$(this).removeClass('normal');
$(this).addClass('grow');
setTimeout(function(){
$(self).addClass('flip')
}800); <-- getting my error here
},
function(){
$(this).removeClass('flip');
setTimeout(function(){
$(this).addClass('normal');
$(this).removeClass('grow');
}800);
});
</code></pre>
<p>Yet I get an error <code>Uncaught SyntaxError: missing ) after argument list</code> on the first setTimeout (and probably ont he second one) but I dont see why i missed a <code>)</code></p>
| <javascript><jquery> | 2016-02-17 13:54:31 | LQ_CLOSE |
35,458,824 | How to find a string is Json or not in C++? | I am using #include jansson.h
bool ConvertJsontoString(string inputText, string& OutText)
{
/* Before doing anything i want to check the inputText is a valid json string or not */
} | <c++><json> | 2016-02-17 14:03:23 | LQ_EDIT |
35,459,257 | Tryng to loop my game back to the start dont know how | Im making a simple fighting game and if you die I want it to loop to the start and if you win stage 2 is unlocked and they deal more damage, I've got to a point where you enter y or no to start stage 2 but it doesn't do anything, completely stuck. When you answer please tell me exactly what to do if you say oh just make a while loop that wont help at all lol here's my code thanks.
import random
xp = 0
level = 1
player1 = raw_input("player1 enter name")
enemyhealth = 100
playerhealth = 100
stage2 = "false"
difficulty = raw_input("choose difficulty, rookie,pro,master,legend or god")
if difficulty == "rookie":
enemyhealth = enemyhealth - 15
if difficulty == "pro":
enemyhealth = enemyhealth + 10
if difficulty == "master":
enemyhealth = enemyhealth + 35
if difficulty == "legend":
enemyhealth = enemyhealth + 40
if difficulty == "god":
enemyhealth = enemyhealth + 60
print ("A quick tutorial: Make sure you type you actions with no spaces, heres a list of the moves you can perform")
print ("Punch: A simple attack that has a short range of damage but is reliable.")
print ("flyingkick: not 100 percent reliable but if pulled off correctly can deal good damage.")
print ("uppercut: A somewhat reliable move that deals decent damage.")
print ("kick: A simple attack that has a short range of damage but is reliable.")
print ("stab: can be very powerful or deal next to no damage.")
print ("shoot: deadly if it hits, less so if you miss.")
print ("A man in the street starts a fight with you, beat him!")
while(1):
while enemyhealth >0:
fight = raw_input("fight")
if fight == "punch":
print ("You punched the enemy")
enemyhealth = enemyhealth - random.randint(5,10)
xp = xp + 1
print "the enemy now has", enemyhealth, "health"
print "they fight back!"
playerhealth = playerhealth - random.randint(5,10)
if stage2 == "true":
playerhealth = playerhealth - random.randit (0,5)
print "you now have..", playerhealth
elif fight =="flyingkick":
print "you flying kicked the enemy"
enemyhealth = enemyhealth - random.randint(5,25)
xp = xp + 1
print "the enemy now has", enemyhealth, "health"
print "they fight back!"
playerhealth = playerhealth - random.randint(5,15)
if stage2 == "true":
playerhealth = playerhealth - random.randit (0,5)
print "you now have..", playerhealth
elif fight =="uppercut":
print "you uppercutted the enemy"
enemyhealth = enemyhealth - random.randint(10,25)
xp = xp + 1
print "the enemy now has", enemyhealth, "health"
print "they fight back!"
playerhealth = playerhealth - random.randint(5,15)
if stage2 == "true":
playerhealth = playerhealth - random.randit (1,5)
print "you now have..", playerhealth
elif fight =="rko":
print "you rko'ed the enemy, out of nowhere!"
enemyhealth = enemyhealth - random.randint(9,29)
xp = xp + 1
print "the enemy now has", enemyhealth, "health"
print "they fight back!"
playerhealth = playerhealth - random.randint(5,12)
if stage2 == "true":
playerhealth = playerhealth - random.randit (1,5)
print "you now have..", playerhealth
elif fight =="kick":
print "you kicked the enemy"
enemyhealth = enemyhealth - random.randint(5,10)
xp = xp + 1
print "the enemy now has", enemyhealth, "health"
print "they fight back!"
playerhealth = playerhealth - random.randint(5,10)
if stage2 == "true":
playerhealth = playerhealth - random.randit (1,5)
print "you now have..", playerhealth
elif fight =="ninjastar":
print "you ninjastarred the enemy"
enemyhealth = enemyhealth - random.randint(5,20)
xp = xp + 1
print "the enemy now has", enemyhealth, "health"
print "they fight back!"
playerhealth = playerhealth - random.randint(5,10)
if stage2 == "true":
playerhealth = playerhealth - random.randit (1,5)
print "you now have..", playerhealth
elif fight =="headbutt":
print "you headbutted the enemy"
enemyhealth = enemyhealth - random.randint(5,18)
xp = xp + 1
print "the enemy now has", enemyhealth, "health"
print "they fight back!"
playerhealth = playerhealth - random.randint(5,10)
if stage2 == "true":
playerhealth = playerhealth - random.randit (1,5)
print "you now have..", playerhealth
elif fight =="deathray":
print "you deathrayed the enemy"
enemyhealth = enemyhealth - random.randint(1,50)
xp = xp + 1
print "the enemy now has", enemyhealth, "health"
print "they fight back!"
playerhealth = playerhealth - random.randint(1,30)
if stage2 == "true":
playerhealth = playerhealth - random.randit (1,5)
print "you now have..", playerhealth
elif fight =="stab":
print "you stabbed the enemy"
enemyhealth = enemyhealth - random.randint(3,40)
xp = xp + 1
print "the enemy now has", enemyhealth, "health"
print "they fight back!"
playerhealth = playerhealth - random.randint(2,20)
if stage2 == "true":
playerhealth = playerhealth - random.randit (1,5)
print "you now have..", playerhealth
elif fight =="shoot":
print "you shot the enemy"
enemyhealth = enemyhealth - random.randint(1,50)
xp = xp + 1
print "the enemy now has", enemyhealth, "health"
print "they fight back!"
playerhealth = playerhealth - random.randint(1,30)
if stage2 == "true":
playerhealth = playerhealth - random.randit (1,5)
print "you now have..", playerhealth
if xp == 5:
print "you leveled up! move unlocked: 'rko'"
if xp == 7:
print "you leveled up! move unlocked: 'ninjastar'"
if xp == 10:
print "you leveled up! move unlocked: 'headbutt'"
if xp == 100:
print " you reached the max level! move 'deathray' is now unlocked"
if playerhealth <1:
again = raw_input('you died! Play agian? [y/n]')
if again is "y":
next
else:
print('Thanks for playing!\n')
exit()
if enemyhealth < 1:
again = raw_input('You Won! stage 2 is unlocked would you like to try and beat it?[y/n]:')
if again is "y":
next
else:
print('Thanks for playing!\n')
exit()
stage2 = "true"
else:
None | <java><python><python-2.7> | 2016-02-17 14:21:17 | LQ_EDIT |
35,459,272 | R: What do reshigh and reslow mean? | I'm wondering what reshigh and reslow mean in the portfolio.optim function in the package tseries. | <r><quantitative-finance> | 2016-02-17 14:22:04 | LQ_EDIT |
35,459,360 | How to call static methods inside the same class in python | <p>I have two static methods in the same class</p>
<pre><code>class A:
@staticmethod
def methodA():
print 'methodA'
@staticmethod
def methodB():
print 'methodB'
</code></pre>
<p>How could I call the <code>methodA</code> inside the <code>methodB</code>? <code>self</code> seems to be unavailable in the static method.</p>
| <python> | 2016-02-17 14:25:45 | HQ |
35,459,652 | When would I use `--interactive` without `--tty` in a Docker container? | <p>I did some googling and have had no luck finding a case where I'd run <code>docker run -i some_image</code> rather than <code>docker run -it some_image</code>. </p>
<p>If I run <code>docker run -i --name sample some_image bash</code>, the container runs in the foreground, but I can't interact with it from the shell I'm in. I can't even stop it with CTRL+C. I can, however, pop open another shell and run <code>docker exec -it sample bash</code> and gain access to the container.</p>
<p>If I run <code>docker run -i -d --name sample some_image bash</code>, the container immediately exits. I can restart it with <code>docker start sample</code> and then it stays up, so I can run <code>docker exec -it sample bash</code> and interact with it again.</p>
<p>However, in all these cases, I ultimately end up using <code>-it</code> to interact with my containers. In what world would I not need the <code>-t</code> flag?</p>
<p>Cheers</p>
| <docker> | 2016-02-17 14:36:39 | HQ |
35,460,534 | Gradle: is it possible to publish to Gradle's own local cache? | <p>I know that I can use the <code>maven</code> plugin coupled with <code>mavenLocal()</code> to install an artifact and use it locally.</p>
<p>However investigating this a bit further, I notice that this means the artifacts are installed to Mavens's standard <code>~/.m2</code>, but at the same time Gradle's own cache lives under <code>~/.gradle/caches</code> in a different format.</p>
<p>This seems wasteful to me, a) working with two local caches, and b) having to add <code>mavenLocal()</code> to all projects. I was wondering if there is a way to publish an artifact to Gradle's <code>~/.gradle/caches</code> ?</p>
| <gradle> | 2016-02-17 15:13:24 | HQ |
35,460,594 | Abort called error in Linux when providing a huge input in C | <p>I have written a program in C to find if a pattern exists inside another pattern. Both the patterns are 2-D character arrays.
To explain further, please consider the below case.</p>
<p>Suppose pattern A is </p>
<pre><code>1234567890
0987654321
1111111111
1111111111
2222222222
</code></pre>
<p>and pattern B is </p>
<pre><code>876543
111111
111111
</code></pre>
<p>In this case, pattern B exists inside pattern A. Starting from 2nd row and 3rd column.</p>
<p>Below is my code.</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
int main()
{
int t, T, R, C, r, c;
char** arr;
char ** pat;
int i, j, x, y, m = 0, n = 0, count = 0, brk_flag = 0, brk_flag2 = 0, found = 0;
freopen("C:\\test.txt", "r", stdin);
scanf("%d", &T);
for (t = 0; t<T; t++) {
scanf("%d%d", &R, &C);
arr = (char**)malloc(R * sizeof(char*));
if (arr == NULL) {
printf("Unable to allocate memory.");
exit(1);
}
for (i = 0; i < R; i++) {
arr[i] = (char*)malloc(C * sizeof(char));
scanf("%s", arr[i]);
}
scanf("%d%d", &r, &c);
pat = (char**)malloc(r * sizeof(char*));
if (pat == NULL) {
printf("Unable to allocate memory.");
exit(1);
}
for (i = 0; i < r; i++) {
pat[i] = (char*)malloc(c * sizeof(char));
scanf("%s", pat[i]);
}
brk_flag2 = 0;
found = 0;
for (i = 0; i < R; i++) {
for (j = 0; j < C; j++) {
if (arr[i][j] == pat[0][0]) {
if (i + r > R || j + c > C)
continue;
x = 0;
y = 0;
brk_flag = 0;
for (m = i; m< i + r; m++) {
y = 0;
for (n = j; n< j + c; n++) {
if (arr[m][n] == pat[x][y]) {
count++;
}
else {
brk_flag = 1;
break;
}
y++;
}
if (brk_flag == 1)
break;
x++;
}
if (count == (r * c)) {
printf("YES\n");
brk_flag2 = 1;
found = 1;
break;
}
count = 0;
}
else
continue;
}
if (brk_flag2 == 1)
break;
}
if (found == 0) {
printf("NO\n");
}
/*
for (i = 0; i < R; i++) {
free(arr[i]);
}
for (i = 0; i < r; i++) {
free(pat[i]);
}
*/
}
return 0;
}
</code></pre>
<p>For a testcase with pattern A of size 1000 X 1000, this works fine on Windows. But on Linux, I get an error as "Abort called".</p>
<p>I am unable to find where I am doing it wrong. Any ideas on this this would be hugely appreciated. Thanks.</p>
| <c> | 2016-02-17 15:16:18 | LQ_CLOSE |
35,460,752 | VB.NET Creating multiple FileSystemWatcher dynamically | I'm trying to solve a very similar problem to this question:
http://stackoverflow.com/questions/30807006/multiple-configurable-filesystemwatcher-methods
The answer provided is in C# and I'm working in VB.NET and failing to translate the example despite trying for a couple of hours - I just can't get it due to my lack of experience, can anyone please help me with a VB.NET equivalent? | <.net><vb.net><filesystemwatcher><c#-to-vb.net> | 2016-02-17 15:22:45 | LQ_EDIT |
35,461,148 | How to send XML POST requests with Spring RestTemplate? | <p>Is it possible to send <code>XML</code> <code>POST</code> requests with <code>spring</code>, eg <code>RestTemplate</code>?</p>
<p>I want to send the following xml to the url <code>localhost:8080/xml/availability</code></p>
<pre><code><AvailReq>
<hotelid>123</hotelid>
</AvailReq>
</code></pre>
<p>Also do I want to add custom http headers on each request dynamically(!).</p>
<p>How could I achieve this with spring?</p>
| <java><xml><spring> | 2016-02-17 15:37:33 | HQ |
35,461,330 | How can I adapt this javascript to return a postcode less the last 2 characters? | <pre><code>function() {
var address = $("#postcode").val();
var postcode = address.split(' ');
postcode = "Postcode:"+postcode[(postcode.length-2)];
return postcode;
}
</code></pre>
<p>This js pulls a postcode value from an online form when the user runs a query. I need to know how I get it to deliver the postcode less the last 2 characters. for example, SP10 2RB needs to return SP102.</p>
| <javascript> | 2016-02-17 15:44:57 | LQ_CLOSE |
35,461,561 | Mutually-dependent C++ classes, held by std::vector | <p>I was curious if was possible to create two classes, each of which holds a <code>std::vector</code> of the other. My first guess was that it would not be possible, because <code>std::vector</code> requires a complete type, not just a forward declaration.</p>
<pre><code>#include <vector>
class B;
class A { std::vector<B> b; };
class B { std::vector<A> a; };
</code></pre>
<p>I would think that the declaration of <code>std::vector<B></code> would cause an immediate failure, because <code>B</code> has an incomplete type at this point. However, this compiles successfully under both gcc and clang, without any warnings. Why doesn't this cause an error?</p>
| <c++><vector> | 2016-02-17 15:54:39 | HQ |
35,463,150 | Scheme language setting ignored in iOS unit and ui tests | <p>My final goal is to issue </p>
<pre><code>xcodebuild test
</code></pre>
<p>from command line picking different schemes for different languages.</p>
<p>Currently I have two schemes, the only difference between them is the application language. In one scheme it is English, in the other is Spanish.
If I use xCode to run the application it works nice, it is launched with the language specified in the scheme I have picked, both EN or ES are okay.</p>
<p>If I run the tests from xCode, language setting is ignored. Whichever scheme I pick, it doesn't matter, it is always displayed as the device language. The same on simulator. The same when running tests with
xcodebuild test
picking scheme. (Adding an echo command to the scheme ensures that the correct one is picked)</p>
<p>In the scheme editor "Use the Run action's arguments and environment variables" is checked.</p>
<p>What am I doing wrong?</p>
<p>Thank you.</p>
| <ios><xcode><xctest><xcode-ui-testing> | 2016-02-17 17:06:06 | HQ |
35,463,338 | PHP: Create SQL query for available $_POST variable | <p>I have this $_POST Variable:</p>
<pre><code>Array
(
[phone_1] => 3123213
[phone_2] => 432423
[phone_3] => 4234
[phone_4] => 6456456
[phone_5] => 7567576
[phone_6] =>
)
</code></pre>
<p>Now I have this SQL statement:</p>
<pre><code>UPDATE table_name SET phone_1 = $_POST['phone1'],
phone_2 = $_POST['phone2'],
phone_3 = $_POST['phone3'],
phone_4 = $_POST['phone4'],
phone_5 = $_POST['phone5'],
phone_6 = $_POST['phone6']
WHERE id=$id
</code></pre>
<p>What I want to achieve is to dynamically build the SQL query based from the $_POST variable and only include those that have a post value. So the SQL statement should be:</p>
<pre><code>UPDATE table_name SET phone_1 = $_POST['phone1'],
phone_2 = $_POST['phone2'],
phone_3 = $_POST['phone3'],
phone_4 = $_POST['phone4'],
phone_5 = $_POST['phone5']
</code></pre>
<p>because phone_6 post variable is blank. And yes the $_POST key names is the same as the table field names. TIA!</p>
| <php><mysql><post> | 2016-02-17 17:14:31 | LQ_CLOSE |
35,463,526 | How do I drop a MongoDB database using PyMongo? | <p>I want to drop a database in MongoDB similarly to</p>
<pre><code>use <DBNAME>
db.dropDatabase()
</code></pre>
<p>in the Mongo shell.</p>
<p>How do I do that in PyMongo?</p>
| <python><mongodb><pymongo> | 2016-02-17 17:22:55 | HQ |
35,463,905 | How to add a C# class object to an Enitity table using LINQ | How to add a class object to an Enitity table using LINQ???The prescriber object is built from FullMasters Entity but I need to take that object and save it to EPCS_Prescriber table. Im using linq.
public void SavePrescriber(string id)
{
var data = context.FullMasters.Where(x => x.NPI == id).FirstOrDefault();
Prescriber p = new Prescriber
{
First = data.FirstName,
Last = data.LastName,
DEA = data.DEA,
License = data.LIC,
Life = data.Life_Hosp,
NPI = data.NPI
};
epcs.EPCS_Prescriber.AddObject(p);
epcs.SaveChanges();
} | <c#><asp.net-mvc><linq> | 2016-02-17 17:41:45 | LQ_EDIT |
35,463,936 | at ClaudiaYoga.com I get trim() expects parameter 1 to be string, array given in BUT CANNOT EVEN LOGIN | I get the warning on top of the page Warning [ClaudiaYoga.com]
: trim() expects parameter 1 to be string, array given in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php on line 92
But the worst part is **I CANNOT LOGIN!!!**
When I try to login it gives me this:
Warning: trim() expects parameter 1 to be string, array given in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php on line 92
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-login.php on line 387
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-login.php on line 400
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/pluggable.php on line 955
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/pluggable.php on line 956
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/pluggable.php on line 957
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/pluggable.php on line 1228 | <php><wordpress> | 2016-02-17 17:43:06 | LQ_EDIT |
35,463,985 | default parameters in node.js | <p>How does one go about setting default parameters in node.js?</p>
<p>For instance, let's say I have a function that would normally look like this:</p>
<pre><code>function(anInt, aString, cb, aBool=true){
if(bool){...;}else{...;}
cb();
}
</code></pre>
<p>To call it would look something like this:</p>
<pre><code>function(1, 'no', function(){
...
}, false);
</code></pre>
<p>or:</p>
<pre><code>function(2, 'yes', function(){
...
});
</code></pre>
<p>However, it doesn't seem that node.js supports default parameters in this manner. What is the best way to acomplish above?</p>
| <node.js><parameters><callback><default> | 2016-02-17 17:45:29 | HQ |
35,464,125 | unfortunately android application is stoped | I want to make a login program in android. I write a code for login program. In this program username and password is send to server for authentication. But when i open the app and enter username and password and click on LoiIn button my application unfortunately stopped. But username and password will sent to server.Than means my application will stopped when i click on Login button.Here is my code.
public class LogIn extends Activity implements View.OnClickListener{
private Socket socket;
private DataOutputStream out;
private DataInputStream in;
private String username,password,s;
EditText eT_username,eT_password;
Button b_login,b_signup,b_connect;
TextView t;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log_in);
eT_username = (EditText)findViewById(R.id.eT_username);
eT_password = (EditText)findViewById(R.id.eT_password);
b_login = (Button)findViewById(R.id.b_login);
b_signup = (Button)findViewById(R.id.b_signup);
b_connect = (Button)findViewById(R.id.b_connect);
t = (TextView)findViewById(R.id.tV);
b_login.setOnClickListener(this);
}
@Override
public void onClick(View v) {
String toast_msg;
try {
out = new DataOutputStream(socket.getOutputStream());
in = new DataInputStream(socket.getInputStream());
out.writeUTF("1");
username = eT_username.getText().toString();
password = eT_password.getText().toString();
out.writeUTF(username);
// out.flush();
out.writeUTF(password);
// out.flush();
t.setText("hi");
s = in.readUTF();
if (s.equals("ok")) {
toast_msg = "Login is successfull";
t.setText(toast_msg);
} else {
toast_msg = "username or password is incorrect";
t.setText(toast_msg);
}
} catch (IOException e) {
t.setText(e.toString());
}
}
public void connect(View v)
{
new Thread(new Runnable() {
@Override
public void run() {
try
{
socket = new Socket("192.168.0.101",5000);
}
catch(Exception e)
{
TextView t = (TextView)findViewById(R.id.textView);
t.setText(e.toString());
// Toast.makeText(LogIn.this,"Make sure that you are connected to Internet",Toast.LENGTH_LONG).show();
}
}
}).start();
}
public void openSignUp(View v)
{
if (v.getId()== R.id.b_signup)
{
Intent i = new Intent(LogIn.this,SignUp.class);
startActivity(i);
}
new SignUp(socket);
}
} | <android> | 2016-02-17 17:52:14 | LQ_EDIT |
35,464,174 | Java FilePath folder find | <p>Is there any solution for my problem? I want work with files, which i add to my program by every run, for example folder1, folder2 and this folders contains .txt files. How can i make it with Java language?</p>
<p>Next problem is, how to set Uni for my program, when some files are named FileInfo and some FileInformations.</p>
<pre><code> pdfManager.setFilePath("D:\\virusTotal\\FileInfo.pdf");
</code></pre>
<p>Thanks for help guys.</p>
| <java><filepath> | 2016-02-17 17:54:45 | LQ_CLOSE |
35,464,187 | Creating new database in DataGrip JetBrains | <p>Anybody know how to create new database in <strong><a href="https://goo.gl/99xqGb" rel="noreferrer">DataGrip</a></strong> (database IDE from JetBrains)?
Could not find in <a href="https://goo.gl/pnFpGS" rel="noreferrer">DataGrip Help page</a>.</p>
| <mysql><database><ide><datagrip> | 2016-02-17 17:55:54 | HQ |
35,464,292 | How to find/watch the dimensions of a view in a NativeScript layout? | <p>When my layout loads any view inside of it has a width and height of <code>NaN</code>, it also has a <code>getMeasuredHeight()</code> and <code>getMeasuredWidth()</code> of <code>0</code>.</p>
<p>At some point <code>getMeasuredHeight()</code> and <code>getMeasuredWidth()</code> (after the layout is laid out I guess) receive useful values.</p>
<p>How can I get the dimensions of anything? How can I watch them change?? When will <code>.width</code> and <code>.height</code> ever not be <code>NaN</code>??? Why can't I make a view hover over the entire screen????</p>
<p>So far I've been <strong>polling</strong> every 100ms and I feel pretty dumb. Please help.</p>
| <nativescript> | 2016-02-17 18:01:56 | HQ |
35,464,512 | Swift create array of first letters from array of strings with no duplicates | <p>I have an array of strings. I want to iterate through the array and grab the first letter from each string and add it to another array but only if that letter hasn't already been added. All of the answers i've found on google are really advanced and I was looking for a simple function.</p>
| <arrays><swift> | 2016-02-17 18:14:14 | LQ_CLOSE |
35,464,806 | Project Euler task #8, code starts returning wrong answers after certain point | <p>I am having some sort of a problem in a task from
<a href="https://projecteuler.net/problem=8" rel="nofollow">https://projecteuler.net/problem=8</a>, (finding highest product of 13 consecutive numbers from a 1000-number string) where up to some point the program gives me predictable results and then the function returns a number very close to the <strong><em>unsigned long long int</em></strong> range. The point where it occurs depends on the values which were read, for instance if the string of numbers consisted mostly of 8s and 9s, it would happen sooner than it would if it had only 5s and 6s. Why does it happen?</p>
<pre><code>#include <iostream>
#include <fstream>
using namespace std;
int product (int res, int a, char buffer[]){
for (int i = 0; i < a; i++){
//simple char to int conversion
res*=(buffer[i] - '0');
}
return res;
}
int main () {
char check;
int res = 1;
fstream plik;
plik.open ("8.txt");
unsigned long long int high;
unsigned long long int result;
//main function in the program
if (plik.good()){
char buffer [13];
for (int i = 0; i < 13; i++){
plik >> buffer[i];
}
result = product (res, 13, buffer);
high = result;
cout << high << endl;
//the main checking loop
while (!plik.eof()){
//just an interruption to make it possible to view consecutive products
//the iteration in the buffer
for (int i = 0; i < 12; i++){
buffer[i] = buffer[i+1];
}
plik >> buffer[12];
result = product (res, 13, buffer);
//comparison between the current product and highest one
if (high < result){
high = result;
}
cin >> check;
cout << high << endl;
//again a tool for checking where the problem arises
for (int i = 0; i < 13; i++){
cout << buffer[i] << " ";
}
cout << endl;
}
plik.close();
cout << high << endl;
}
return 0;
}
</code></pre>
<p>The program prints out the currently highest product and all the numbers currently contained in the array.
It looks like this:
<a href="http://i.stack.imgur.com/E9FaK.png" rel="nofollow">The error</a></p>
| <c++><debugging><overflow><codeblocks><unsigned-long-long-int> | 2016-02-17 18:29:29 | LQ_CLOSE |
35,465,182 | How to find all divs who's class starts with a string in BeautifulSoup? | <p>In BeautifulSoup, if I want to find all div's where whose class is span3, I'd just do:</p>
<pre><code>result = soup.findAll("div",{"class":"span3"})
</code></pre>
<p>However, in my case, I want to find all div's whose class starts with span3, therefore, BeautifulSoup should find:</p>
<pre><code><div id="span3 span49">
<div id="span3 span39">
</code></pre>
<p>And so on...</p>
<p>How do I achieve what I want? I am familiar with regular expressions; however I do not know how to implement them to beautiful soup nor did I find any help by going through BeautifulSoup's documentation.</p>
| <python><beautifulsoup> | 2016-02-17 18:50:10 | HQ |
35,465,589 | How do I compile grails project using grails command line? I want to compile it to get .war file so I can deploy it on server | How do I compile my grails project? I want to get a .war file so I can deploy it.
First I installed Jdk then I installed grails and I have properly set environment variables for both and checked it.Now I want to compile this grails project using grails command line.how can I do it?
Thanks in advance | <grails> | 2016-02-17 19:10:57 | LQ_EDIT |
35,465,637 | Javascript: only execute a function if body class is exist | I have a body class like this:
<body class="horizontal">
I try to target with the following code:
'use strict';
(function() {
if(document.body.className === 'horizontal') {
alert('It exists');
};
})();
But this is just not working. The `alert` not popping up. I would like to prefer a pure javascript solution, to not include Jquery because of this. | <javascript> | 2016-02-17 19:13:42 | LQ_EDIT |
35,465,851 | Define function in unix/linux command line (e.g. BASH) | <p>Sometimes I have a one-liner that I am repeating many times for a particular task, but will likely never use again in the exact same form. It includes a file name that I am pasting in from a directory listing. Somewhere in between and creating a bash script I thought maybe I could just create a one-liner function at the command line like:</p>
<pre><code>numresults(){ ls "$1"/RealignerTargetCreator | wc -l }
</code></pre>
<p>I've tried a few things like using eval, using <code>numresults=function...</code>, but haven't stumbled on the right syntax, and haven't found anything on the web so far. (Everything coming up is just tutorials on bash functions).</p>
| <linux><bash><shell><unix> | 2016-02-17 19:24:21 | HQ |
35,467,524 | Using a loop to find greatest integer in array using Ruby | <p>I need to find the greatest integer in an array using a loop in Ruby</p>
<p>ex: numbers = [10, 20, 30, 40, 50, 60]</p>
<p><em>note</em> I can't use the .max function. HAS TO BE A LOOP.</p>
| <arrays><ruby><loops><integer> | 2016-02-17 20:54:04 | LQ_CLOSE |
35,467,605 | Schema Builder : Create Table if not exists | <p>I am using below code in Schema Builder to create table.</p>
<pre><code>Schema::create('tblCategory', function (Blueprint $table) {
$table->increments('CategoryID');
$table->string('Category', 40);
$table->unique('Category', 'tblCategory_UK_Category');
$table->timestamps();
});
</code></pre>
<p>Here is the problem is, if I have to create the new table, all old scripts runs and show error that table already exists. </p>
<p>is there any way to create table if not exists using Schema builder ?</p>
| <php><laravel-5.1><laravel-5.2> | 2016-02-17 20:58:21 | HQ |
35,468,372 | Using Boto3 to interact with amazon Aurora on RDS | <p>I have set up a database in Amazon RDS using Amazon Aurora and would like to interact with the database using Python - the obvious choice is to use Boto.</p>
<p>However, their documentation is awful and does nopt cover ways in which I can interact with the databse to:</p>
<ul>
<li>Run queries with SQL statements</li>
<li>Interact with the tables in the database</li>
<li>etc</li>
</ul>
<p>Does anyone have an links to some examples/tutorials, or know how to do these tasks?</p>
| <python><mysql><amazon-web-services><boto3> | 2016-02-17 21:42:35 | HQ |
35,468,388 | AWS security group inbound rule. allow lambda function | <p>I run a service on my EC2 instance and I want to setup an inbound rule that only allows my lambda function to access it. The security group allows me to restrict access by a specific IP, but I don't think that lambda functions have a specific IP assigned. Is there a way to do what I want?</p>
| <amazon-web-services><aws-lambda> | 2016-02-17 21:43:20 | HQ |
35,468,855 | Multiple schema references in single schema array - mongoose | <p>Can you populate an array in a mongoose schema with references to a few different schema options?</p>
<p>To clarify the question a bit, say I have the following schemas:</p>
<pre><code>var scenarioSchema = Schema({
_id : Number,
name : String,
guns : []
});
var ak47 = Schema({
_id : Number
//Bunch of AK specific parameters
});
var m16 = Schema({
_id : Number
//Bunch of M16 specific parameters
});
</code></pre>
<p>Can I populate the guns array with a bunch of ak47 <strong>OR</strong> m16? Can I put <strong>BOTH</strong> in the same guns array? Or does it require a populate ref in the assets array, like this, which limits it to a single specific type?</p>
<pre><code>guns: [{ type: Schema.Types.ObjectId, ref: 'm16' }]
</code></pre>
<p>I know I could just have separate arrays for different gun types but that will create an insane amount of extra fields in the schema as the project scales, most of which would be left empty depending on the loaded scenario.</p>
<pre><code>var scenarioSchema = Schema({
_id : Number,
name : String,
ak47s : [{ type: Schema.Types.ObjectId, ref: 'ak47' }],
m16s: [{ type: Schema.Types.ObjectId, ref: 'm16' }]
});
</code></pre>
<p>So back to the question, can I stick multiple schema references in a single array?</p>
| <javascript><mongodb><mongoose><mongoose-populate> | 2016-02-17 22:15:39 | HQ |
35,469,050 | why im getting attempt to index 'pac' global (a nil value) (the | THIS CODE IS NOT MINE, My friend sent me this the error i get is this
[ERROR] gamemodes/santosrp/gamemode/sh_pacmodels.lua:137: attempt to index global 'pac' (a nil value)
1. PlayerSwitchWeapon - gamemodes/santosrp/gamemode/sh_pacmodels.lua:137
2. UpdatePlayers - gamemodes/santosrp/gamemode/sh_pacmodels.lua:169
3. unknown - gamemodes/santosrp/gamemode/cl_init.lua:105
sh_pacmodels 137 is this
function GM.PacModels:PlayerSwitchWeapon( pPlayer, entOldWep, entNewWep )
if not pPlayer.AttachPACPart then
pac.SetupENT( pPlayer ) --line 137
pPlayer:SetPACDrawDistance( GetConVarNumber("srp_pac_drawrange") )
end
local invalid
for slotName, _ in pairs( GAMEMODE.Inv.m_tblEquipmentSlots ) do
item = GAMEMODE.Inv:GetItem( GAMEMODE.Player:GetSharedGameVar(pPlayer, "eq_slot_".. slotName, "") )
if not item or not item.PacOutfit then continue end
if not IsValid( entOldWep ) or not IsValid( entNewWep ) then continue end
if item.EquipGiveClass == entOldWep:GetClass() or item.EquipGiveClass == entNewWep:GetClass() then
invalid = true
break
end
end
sh_pacmodels 169 is this
function GM.PacModels:UpdatePlayers()
if not self.m_intLastThink then self.m_intLastThink = CurTime() +0.1 end
if self.m_intLastThink > CurTime() then return end
self.m_intLastThink = CurTime() +0.1
local ragdoll, item
for k, v in pairs( player.GetAll() ) do
--Track active weapon
if not v.m_entLastActiveWeapon then
v.m_entLastActiveWeapon = v:GetActiveWeapon()
else
if v:GetActiveWeapon() ~= v.m_entLastActiveWeapon then
self:PlayerSwitchWeapon( v, v.m_entLastActiveWeapon, v:GetActiveWeapon() ) -- line 169
v.m_entLastActiveWeapon = v:GetActiveWeapon()
end
end
thank you guyss
| <lua><null><global-variables><global> | 2016-02-17 22:28:27 | LQ_EDIT |
35,469,253 | Silence PyLint warning about unused variables for string interpolation | <p>The <code>say</code> module brings string interpolation to Python, like this:</p>
<pre><code>import say
def f(a):
return say.fmt("The value of 'a' is {a}")
</code></pre>
<p>However, PyLint complains that the variable 'a' is never used. This is a problem because my code uses <code>say.fmt</code> extensively. How can I silence this warning?</p>
| <python><pylint><unused-variables> | 2016-02-17 22:43:31 | HQ |
35,469,437 | How to get (without vba) the last available data on a row in Excel | <p>I have a question regarding a simple formula: Gn=Fn-En, but if En is an empty cell, then search on the same row (n), all the n-1 values in order to find the first non empty cell.
Is it possible to make such formula but without having any vba code?</p>
<p>Regards,</p>
| <excel> | 2016-02-17 22:56:06 | LQ_CLOSE |
35,469,537 | Is it better to delete files from a folder over 30 days old using a C# program, or some sort of Batch script? | <p>I'm unfamiliar with creating batch files. I really don't get how they work or what they can do. What I do know is how to write a c# program. </p>
<p>If I want to have an automated process that runs probably once a day to delete files older than 30 days, would it be better to make a batch script, or some sort of task that runs the c# program?</p>
<p>Should the program keep track of files it knows will expire tomorrow and just delete by name? Or should it scan the whole folder every day? Seems like a waste to do that, but it makes it very simple.</p>
<p>I know it can be done both ways and there's a lot of material on both, but what I really want to know is what's the difference?</p>
| <c#><batch-file><file-management> | 2016-02-17 23:03:41 | LQ_CLOSE |
35,469,733 | htmlagilitypack getting a value from a specific child node | I have an html and using htmlagilitypack with c#. I need to get a specific child node value. I need to get the text of the child "strong/em" in the html. how can i get it?
<!-- begin snippet: js hide: false -->
<!-- language: lang-html -->
<div id="top3">
<li> February 1, 2016:
<a target="_blank" href="test1.html">
<strong>
<em>test1</em></strong>
</a>
<br><strong>desc1</strong></li>
<li> February 2, 2016:
<a target="_blank" href="test2.html">
<strong>
<em>test2</em></strong>
</a>
<br><strong>desc2</strong></li>
</div>
<!-- end snippet -->
foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//div[@id='top3']//li"))
{
sb.Append("<p'>" + node.SelectSingleNode("a[1]/preceding-sibling::text()[1]").InnerText + "</p>");
linkNode = node.SelectSingleNode("a[1]");
sb.Append("<p class='event'><a href='" + linkNode.Attributes["href"].Value + "'>" +
//**********Need to have text from /strong/em/ here *********
+ "</a></p>");
} | <c#><xpath><html-agility-pack> | 2016-02-17 23:19:54 | LQ_EDIT |
35,470,450 | Included files, all or nothing? | <p>I have been writing code for a while, but I am not classically trained in computer science, so if this question is ridiculous, please go easy on me.</p>
<p>Something I have been trying to find a definitive answer on for a while is, if I #include a file in C, do I get the ENTIRE contents of the file linked in, or just the parts I use? If it has 10 functions in it, and I only use 1 of the functions, does the code for the other 9 functions get included in my executable? This is especially relevant for me right now as I am working on a micro-controller and memory is precious.</p>
<p>Thanks for any help with this question.</p>
| <c><microcontroller><microchip> | 2016-02-18 00:20:51 | HQ |
35,470,511 | Setting up tsconfig with spec/test folder | <p>Say I put my code under <code>src</code> and tests under <code>spec</code>:</p>
<pre><code>+ spec
+ --- classA.spec.ts
+ src
+ --- classA.ts
+ --- classB.ts
+ --- index.ts
+ tsconfig.json
</code></pre>
<p>I want to only transpile <code>src</code> to the <code>dist</code> folder. Since <code>index.ts</code> is the entry point of my package, my <code>tsconfig.json</code> look like this:</p>
<pre><code>{
"compileOptions": {
"module": "commonjs"
"outDir": "dist"
},
"files": {
"src/index.ts",
"typings/main.d.ts"
}
}
</code></pre>
<p>However, this <code>tsconfig.json</code> does not include the test files so I could not resolve dependencies in them.</p>
<p>On the other hand, if I include the test files into <code>tsconfig.json</code> then they are also transpiled to <code>dist</code> folder.</p>
<p>How do I solve this problem?</p>
| <typescript><visual-studio-code><tsconfig> | 2016-02-18 00:28:02 | HQ |
35,470,844 | How to run python function after completed other function | my purpose is, when I run "list.py" first step, script will read a target_list.txt and it will create a domain list as "http://testsites.com".
if this process when completed, it means finish the target_list, other function must run. Here's code
example:
import Queue
#!/usr/bin/python
import Queue
targetsite="target_list.txt"
def domaincreate(targetsitelist):
for i in targetsite.readlines():
i = i.strip()
Url="http://"+i
DomainList=open("LiveSite.txt","rb")
DomainList.write(Url)
DomainList.close()
def SiteBrowser():
TargetSite="LiveSite.txt"
Tar=open(TargetSite,"rb")
for Links in Tar.readlines():
Links=Links.strip()
UrlSites="http://www."+Links
browser = webdriver.Firefox()
browser.get(UrlSites)
browser.save_screenshot(Links+".png")
browser.quit()
domaincreate(targetsite)
SiteBrowser()
| <python> | 2016-02-18 01:00:12 | LQ_EDIT |
35,471,848 | Django: Do you recommend using LTS or always keep upgrading versions? | <p>Im looking for opinions with good arguments.</p>
<p>Django Framework now is at it's 1.9.2 version being 1.8.9 the LTS package.</p>
<p>I'm going to write a new project template and Im asking myself if it should be good to use the LTS for this particular idea or keep up with the latest version as they ship.</p>
<p>This last approach may lead to inconsistency and having to re check my code on every Django release, instead of making a project template every LTS version.</p>
<p>What do you think?</p>
| <python><django><templates><project><lts> | 2016-02-18 02:45:34 | LQ_CLOSE |
35,472,370 | Ruby's alias_method is method. but how about alias? | i know that Ruby's alias_method is method. but how about the alias?
i checked on [ruby-doc](http://ruby-doc.com).
when i search the "alias_method", there're results like `Class: Module (Ruby 2.x.x)`
but in alias, there's no result like `Class: Module (Ruby 2.x.x)`
i know the differences between them, in usage-level. i just want to know whether` alias` is method or not
| <ruby><types><alias> | 2016-02-18 03:38:24 | LQ_EDIT |
35,472,547 | Grouping 2D arrays & transforming to hash | I have a two dimensional array and I wanted to group it by one of the attributes within the array. The values in the attributes stored in the array are sales_user, user_id, month, and amount.
array = [[8765, 105191, 2.0, 1582.1],
[4321, 62770, 2.0, 603.24],
[4321, 105191, 2.0, 1900.8],
[1234, 62770, 2.0, 603.24]]
Index[0] in each array is the sales_user and I wanted to group by that.
I need to get it to:
[[8765, [105191, 2.0, 1582.1]]
[[4321, [[62770, 2.0, 603.24]],[[105191, 2.0, 1900.8]]]
[1234, [[62770, 2.0, 603.24]]]]
I tried doing this:
array.group_by(&:first).map { |c, xs| [c, xs] }
[[8765, [[8765, 105191, 2.0, 1582.1]]],
[4321, [[4321, 62770, 2.0, 603.24], ][4321, 105191, 2.0, 1900.8]]],
[1234, [[1234, 62770, 2.0, 603.24]]]]
It almost gave me what I wanted but it included the sales_user inner array as well :/
I would like to transform the grouped array to a hash as well. Is this easily possible in ruby? I'm fairly new to it ^^" Or maybe I need to conver the original array to a hash and then do the group by sales_user? | <arrays><ruby><hash> | 2016-02-18 03:57:13 | LQ_EDIT |
35,473,054 | switch case two is generated after case one | //this is my java code
public static void main(String[] args) {
try {
FirefoxDriver driver = new FirefoxDriver();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
BufferedReader reader1 = new BufferedReader(new InputStreamReader(System.in));
Login module = new Login(driver, "http://180.211.114.147:97/Account/Login");
module.doLogin("devrana","dev123");
Demat_Account dmat = new Demat_Account();
Will_Mgmt wmgt = new Will_Mgmt();
System.out.println("-----Select Module-----");
System.out.println("1. Demat Account");
System.out.println("2. Will Management");
System.out.println("Select Module :");
try{
int role = Integer.parseInt(reader.readLine());
switch (role)
{
case 1:
System.out.println("you have selected Demat Account ");
dmat.gotoDemat();
System.out.println("-----Select Operation-----");
System.out.println("1. Add Demat Account");
System.out.println("2. Edit Demat Account");
System.out.println("3. Delete Demat Account");
int operation = Integer.parseInt(reader.readLine());
switch (operation)
{
case 1:
System.out.println("1. you have selected Add Demat Account");
dmat.AddDemat();
break;
case 2:
{
System.out.println("2. you have selected Edit Demat Account");
break;
}
case 3 :
{
System.out.println("3.you have selected Delete Demat Account");
dmat.deleteDemat();
break;
}
}
case 2:
System.out.println("you have selected Will Management ");
wmgt.gotoWillmgt();
System.out.println("-----Select Operation-----");
System.out.println("11. Edit will Template");
System.out.println("22. Proceed to will Distribution");
int will_operation=Integer.parseInt(reader1.readLine());
switch(will_operation)
{
case 11 :
break;
case 22:
wmgt.AddWill();
break;
}
} }catch(NumberFormatException nfe)
{
System.err.println("Invalid Format!");
}
} catch (Exception ex) {
}
}
//Out put of console
Login success!!
-----Select Module-----
1. Demat Account
2. Will Management
Select Module :
1
you have selected Demat Account
gotoDemat method
-----Select Operation-----
1. Add Demat Account
2. Edit Demat Account
3. Delete Demat Account
1
1. you have selected Add Demat Account
Success!!
you have selected Will Management
Will Mgt method
Success 1 !!
-----Select Operation-----
11. Edit will Template
22. Proceed to will Distribution | <java><selenium-webdriver> | 2016-02-18 04:45:26 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.