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 |
|---|---|---|---|---|---|
37,169,892 | What are the most important updated points from django since 1.5.8? | <p>I've an application that still uses Django 1.5.8, there's a lot of work to do in an update, I need to figure what are the most important changes since that version. Like major bugfixes, new tools, new libraries, new scallable contents.
That's a lot of info, I'm aware of that. If there's a link where I can find It, I just havenát found it yet.
Thanks in advance!
Cheers!!!</p>
| <python><django> | 2016-05-11 17:46:29 | LQ_CLOSE |
37,171,058 | Matlab - Hide a 1MB file in an Image's invaluable bits (Watermarking) | <p>I have to store a 1MByte word file into a 512x512 pixels image using Matlab and extract it again. The only thing that I know is that we have to remove the invaluable bits of the image (the ones that are all noise) and store our fie there.
Unfortunately I know nothing about both Matlab and Image Processing.</p>
<p>Thanks All.</p>
| <matlab><image-processing><video-watermarking> | 2016-05-11 18:50:59 | LQ_CLOSE |
37,171,142 | List 'target' of 'links' (powershell) | I need to get the 'target' inside of a shortcut.
But... when i use -Recurse, it follows the links, instead of simply just getting the shortcut target
Here is code that I found online that I edited to serve my purpose ... but it recurses into the links:
#Created By Scott
$varLogFile = "E:\Server\GetBriefsTargets.log"
$varCSVFile = "E:\Server\GetBriefsTargets.csv"
function Get-StartMenuShortcuts
{
$Shortcuts = Get-ChildItem -Recurse "F:\Connect" -Include *.lnk
#$Shortcuts = Get-ChildItem -Recurse "D:\Scripts\scott_testing" -Include *.lnk
$Shell = New-Object -ComObject WScript.Shell
foreach ($Shortcut in $Shortcuts)
{
$Properties = @{
ShortcutName = $Shortcut.Name;
ShortcutFull = $Shortcut.FullName;
ShortcutPath = $shortcut.DirectoryName
Target = $Shell.CreateShortcut($Shortcut).targetpath
}
New-Object PSObject -Property $Properties
}
[Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | Out-Null
}
$Output = Get-StartMenuShortcuts
$Output
ECHO "$Output" >> $varLogFile
ECHO "$Output" >> $varCSVFile
Could someone please offer advice on what I can change so that it still finds all of the shortcuts into all of the folders?
ie:
F:\Connect\CLIENTA\shortcut.lnk
F:\Connect\CLIENTB\shortcut.lnk
etc
There's about 100 clients that I have to get their links and I don't want to do it manually (each month) | <powershell><shortcut> | 2016-05-11 18:55:31 | LQ_EDIT |
37,171,701 | parsing a string looking at multiple delimiters | <p>I am trying to parse a string into:</p>
<ul>
<li>Remove initial "lunch" word</li>
<li>Split the rest into days of week and their associated food item</li>
</ul>
<p>The input comes in just as a string in this format:</p>
<p><code>var s = 'lunch monday: chicken and waffles, tuesday: mac and cheese, wednesday: salad';</code></p>
<p>And my goal is to split into:</p>
<p><code>[monday, chicken and waffles, tuesday, mac and cheese, wednesday, salad]</code></p>
<p>I am using <code>s = s.split(' ').splice(1, s.length-1).join(' ').split(':');</code></p>
<p>Which gets me:</p>
<p><code>["monday", " chicken and waffles, tuesday", " mac and cheese, wednesday", " salad"]</code></p>
<p>Obviously it's splitting on the <code>:</code> only, keeping the <code>,</code> there. I've tried using regex <code>split(":|\\,");</code> to split on <code>:</code> OR <code>,</code> but this does not work.</p>
<p>Any thoughts?</p>
| <javascript><string><split> | 2016-05-11 19:28:11 | LQ_CLOSE |
37,173,194 | Maximum Throughput of this system | Given this System, and assuming we pipelined it with the minimum number of registers:
[Click me for the picture][1]
How can I calculate the maximum throughput without even knowing what's the minimum number of the registers needed to pipeline this?
[1]: http://i.stack.imgur.com/kMkFC.jpg | <hardware><cpu-architecture> | 2016-05-11 20:59:43 | LQ_EDIT |
37,173,415 | compile c program on windows with assembleur code | hi i use dev cpp to compil the above code but a problem accure
#include<stdio.h>
int main(){
char s;
__asm(
"mov %ah, 1"
"int 21h"
"mov %ah,2"
"mov %dl,%al"
"int 21h"
);
return 0;
}
the errer is
> Error: junk `int 21hmov %ah' after expression Error: too many memory
> references for `mov'
so how to solve this peoblem and thank you
| <c><gcc><x86><inline-assembly> | 2016-05-11 21:15:05 | LQ_EDIT |
37,173,601 | Error: invalid use of 'void' (using vectors) | <p>I am trying to create a code using vectors and other c++11 utilities. The above mentioned(on the title) error occurs in my code and despite I looked for a solution to this error on the internet I did not find something that works into my code. I tried to make some type castings but did not work. I present you the contentious part of code below:</p>
<pre><code>#include <iostream>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <map>
#include <algorithm>
#include <list>
//#include <Winbase.h>
using namespace std;
// A struct describing a product.
typedef struct Products
{
string category;
string name;
float price;
} Product;
inline void scenario1(int num_cashiers)
{
vector<Product> products; // It is a vector(a pseudo-second dimension) of products which will be used for each customer
vector<vector<Product>> customers; // A vector containing all customers
vector<vector<vector<Product>>> cashiers(num_cashiers); // A vector describing the supermarket cashiers declaring a queue of customers for each cashier
double start = GetTickCount(); // It will be used for counting 10 secs until next update
vector<int> total_products(num_cashiers); // A vector keeping the total number of products of each queue
list<string> categories; // A list containing all the categories of the products
list<float> categories_prices(categories.unique().size()); // A list containing all category prices
//THE ABOVE LINE - THE LAST ONE IN THIS PART OF CODE - IS THE LINE I GET THE ERROR!!!
....
}
</code></pre>
<p>What is wrong with the code?</p>
<p>Thank you everyone in advance!</p>
| <c++><c++11> | 2016-05-11 21:29:24 | LQ_CLOSE |
37,174,012 | Some font styles are the same after I changed it | <p>OK, I'm gonna be the most specific as possible. I have an Alcatel One Touch 7042A, black color. This cellphone doesn't include the feature of changing the system font, as it isn't Samsung or LG. I wanted to change it, so I rooted my phone with an app which name is "Kingoroot superuser". The root was a success, then I downloaded a font changer app: "iFont: expert of fonts". There was a big list of fonts, I chose and downloaded "chococooky" which size is of 2.14 MB. I remember that, before applying the font, I had to select a change font mode, which are the next: "Auto (smart match), System mode (need root), Recovery mode, samsung mode, install mode, miui mode and huawei mode". I selected AUTO (SMART MATCH). My phone rebooted and the font applying was a success.
Now comes the problem: Every letter changed, but letters in bold, italic and serif kept the default font. I don't know how to change it, I selected SYSTEM MODE in iFont again but the same. Can you help me? I hope I didn't confuse you with so many details :/</p>
| <android><fonts><bold><italic> | 2016-05-11 22:02:14 | LQ_CLOSE |
37,174,340 | how to add where clause with two values android | i want to check password also on where
public Cursor signincheck(String email,String Password)
{
SQLiteDatabase db=this.getWritableDatabase();
String query="SELECT * FROM " + TABLE_NAME + " WHERE EMAIL = '" + email + "'";
Cursor cursor=db.rawQuery(query, null);
return cursor;
} | <android><sqlite> | 2016-05-11 22:30:43 | LQ_EDIT |
37,174,477 | what is the best responsive method for HTML template | <p>mostly we use bootstrap for responsive but there have many peoples need responsive without bootstrap framework. I know about LESS. is that any other way to do my web site responsive perfectly </p>
| <html><responsive-design> | 2016-05-11 22:43:49 | LQ_CLOSE |
37,174,793 | where do I select the terminal in Github? | <p>First time working in GitHub, and I am not sure how to access to the "terminal". Any idea? Do I need to install it?</p>
| <github><terminal> | 2016-05-11 23:18:32 | LQ_CLOSE |
37,175,117 | :focus:active together not working on firefox. | I want outline should not come on "a" tag on click. it should only come when focus is on link by Tabbing on by jQuery focus event.
Now outline comes on focus and doesnt go out till we not click anywhere else.
| <javascript><jquery><css> | 2016-05-11 23:58:15 | LQ_EDIT |
37,175,898 | How do I send a hexadecimal code through powershell | I'm trying to send a command line through powershell so I can power on a projector via serial port. I'm using a NEC projector and the command for turn on and turn off the projector are these:
Power On:
02H 00H 00H 00H 00H 02H
Power Off:
02H 01H 00H 00H 00H 03H
I use the manufacture's software and I did monitor what it sent and for turn it on it use the following:
Open COM port
wrote:
00 bf 00 00 01 00 c0
read:
20 bf 01 20 10 00 ff 22 4d 33 35 33 57 53 00 00
00 08 12 00 00 dd
wrote:
00 bf 00 00 01 02 c2
read:
20 bf 01 20 10 02 0f ff ff ff ff 00 00 00 00 00
00 00 00 00 00 1d
Wrote(this is the command line I identified in the manual):
02 00 00 00 00 02
and then it close the open COM port.
I'm trying to figure out how to send the command.
I did some digging and found out the command
$port.WriteLine
but it doesnt send hex, it sends this:
30 30 20 62 66 20 30 30 20 30 30 20 30 31 20 30 00 bf 00 00 01 0
30 20 63 30 0a 0 c0.
any help is well appreciated!! | <powershell> | 2016-05-12 01:42:51 | LQ_EDIT |
37,177,936 | calculate balance sheet with fastest algorithem | I am implementing accounting software,
in calculating balance sheet of the Hirarchical self referenced topics please let me know the fastest algorithem , in following is my tables:
--Topics table
TopicID nvarchar(50) -- is Parent Field
ParentID nvarchar(50) -- is Child Field
Description nvarchar(512)
------------DocumentDetal table
DocumentNumber nvarchar(50)
TopicFK nvarchar(50)
Debit decimal(18,0)
Credit decimal(18,0)
------------
two table are related with TopicID and TopicFK columns , please let me know how I can calculate balance sheet by sql stored proc ??? | <sql><performance><tree><sql-server-2008-r2> | 2016-05-12 05:24:12 | LQ_EDIT |
37,179,328 | How can I create method for passing values from Activity to other components | <p>I need the <code>chapterId</code> and <code>lessonId</code> value in <code>Tablayout</code> fragments .</p>
<p>one of the solution to send data from activity to fragment is sending value with public method in activity and create a new instance in fragment and give the value in fragments .</p>
<p>I have This activity where i get bundle in that .</p>
<pre><code> public class DetailActivity extends AppCompatActivity {
private String chapterId;
private String lessonId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
getBundle();
}
private void getBundle() {
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
chapterId = bundle.getString("CHAPTERID");
lessonId = bundle.getString("LESSONID");
}
}
======== Method for sending data to other Activities and Fragments=====
public String getId(){
}
}
</code></pre>
<p>Now my question is how can i write this method . Thanks</p>
| <java><android><android-fragments> | 2016-05-12 06:52:33 | LQ_CLOSE |
37,180,955 | How to use SED command to get below output in desc? | My input is "INTC_KEY,ABC1|OBJID,ABC2".
And I want to send the output to the file like
DDS.INTC_KEY = REPL.OBJID AND DDS.ABC1 = REPL.ABC2
Thanks,
Eshan | <sed> | 2016-05-12 08:10:35 | LQ_EDIT |
37,181,368 | Java trying to get values from HashMap | I want to print the object values.
I cant get access to it and dont know how to do it.
i cant acess it with value()
here is my code
public class txtdatei {
private String pickerName;
private String language;
private float volumeGain;
private long pickerId;
private static Map<Long,txtdatei> mapp=new HashMap<Long,txtdatei>();
public txtdatei(String username, String language, float volume){
this.pickerName=username;
this.language=language;
this.volumeGain=volume;
}
public static void main(String[] args){
File file=new File("test.txt");
try{
file.createNewFile();
FileWriter writer =new FileWriter(file);
writer.write("username\tbenni\tlanguage\tgerman\n");
writer.flush();
writer.close();
FileReader fr =new FileReader("test.txt");
BufferedReader reader= new BufferedReader(fr);
String zeile=reader.readLine();
String [] data=zeile.split("\t");
int i=0;
for(i=0;i<data.length;i++)
{
if(data[i].equals("Username"))
{
mapp.put((long)(1),new txtdatei(data[2],data[4],Float.parseFloat(data[6])));
}
}
System.out.println(mapp.get(1)); //dont know how to read the
}catch(IOException ioe){ioe.printStackTrace();}
}
hope someone can help me thanks
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh | <java> | 2016-05-12 08:30:02 | LQ_EDIT |
37,181,924 | opening a file gives not expexted return value | could someone please explain me, why file opening is not successful? why printing "file" will give -1? Is it a problem with char *source ?
int opf(char *source){
int file;
file=open(source,O_RWR);
printf("%d",file);
}
And is it possible to do something like this:
file is in another directory, so
int opf(char *source){
int file;
file=open("some_directory/ %s",source,O_RWR);
printf("%d",file);
}
here I get the "makes integer from pointer without a cast" error. I tried many different things but i guess the problem lies with me not grasping correctly the concept of pointers.
I am making some basic mistakes here . So, sorry if I do offend someone with this bad coding.
with best regards | <c><file><file-io><errno> | 2016-05-12 08:54:29 | LQ_EDIT |
37,182,191 | compareTo Java - What is this doing? | <p>Could anyone tell me the logic behind this piece of code?</p>
<pre><code>public int compareTo(Holder o) {
if(o == null) return -1;
return this.value.compareTo(o.value);
}
</code></pre>
| <java><comparable> | 2016-05-12 09:06:32 | LQ_CLOSE |
37,182,392 | c# I can not Parse JSON to string | I have problem with my code. I don't know how to fix. I just want to get all title from json.
It showed error at: var obj = JObject.Parse(jsons);
"Unexpected character encountered while parsing value: . Path '', line 0, position 0."
public void getTitle()
{
ArrayList myTitle = new ArrayList();
string url = "https://www.fiverr.com/gigs/endless_page_as_json?host=subcategory&type=endless_auto&category_id=3&sub_category_id=154&limit=48&filter=auto&use_single_query=true&page=1&instart_disable_injection=true";
using (var webClient = new System.Net.WebClient())
{
var jsons = webClient.DownloadString(url);
if (jsons != null)
{
var obj = JObject.Parse(jsons);
var urll = (string)obj["gigs"]["title"];
myNode1.Add(urll);
}
else
{
MessageBox.Show("nothing");
}
} | <c#><json><string><parsing><url> | 2016-05-12 09:14:56 | LQ_EDIT |
37,182,919 | how to know the depth of a git's shallow clone? | <p>If I retrieve a shallow clone, e.g.</p>
<pre><code>git clone --depth 10 http://foo.bar/baz.git
</code></pre>
<p>Does <code>git</code> have any command to retrieve the depth of this clone? (e.g. a command that simply prints <code>10</code>).</p>
| <git><git-clone> | 2016-05-12 09:35:01 | HQ |
37,183,787 | Write a sequence without having 0 at any place in javascript | <!doctype html>
<html>
<body>
<script>
//this will be real amount rows i need to generate member id for
//var quantity =13000;
// for testing we can use 20
var quantity =20;
var perpackcards = 99;
//this is how much total member ids should be
var totalrows = quantity * perpackcards;
var memberIdprefix = 'M';
var alphaStart = '';
var memberIdStart = 2111111;
// i have to achieve sevral other goals, so that i need to run loop this way, loop inside loop.
for (i = 0; i < quantity; i++) {
for(j = 0; j < perpackcards; j++) {
var result = parseInt(memberIdStart) + j;
//console.log(memberIdStart+'--'+j);
console.log(result);
}
memberIdStart += 100;
}
</script>
</body>
</html>
I am trying to generate a sequence using member id, so this code outputs the member is like this :
Output i am getting :
2111111
2111112
2111113
2111114
2111115
2111116
2111117
2111118
2111119
2111120
2111121
2111122
2111123
2111124
2111125
2111126
2111127
2111128
2111129
2111130
2111131
2111132
2111133
2111134
2111135
2111136
2111137
2111138
2111139
2111140
2111141
2111142
2111143
2111144
2111145
2111146
2111147
2111148
2111149
2111150
2111151
2111152
2111153
2111154
2111155
2111156
2111157
2111158
2111159
2111160
2111161
2111162
2111163
2111164
2111165
2111166
2111167
2111168
2111169
2111170
2111171
2111172
2111173
2111174
2111175
2111176
2111177
2111178
2111179
2111180
2111181
2111182
2111183
2111184
2111185
2111186
2111187
2111188
2111189
2111190
2111191
2111192
2111193
2111194
2111195
2111196
2111197
2111198
2111199
2111200
2111201
2111202
2111203
2111204
2111205
2111206
2111207
2111208
2111209
2111211
2111212
2111213
2111214
2111215
2111216
2111217
2111218
2111219
2111220
2111221
2111222
2111223
2111224
2111225
2111226
2111227
2111228
2111229
2111230
2111231
2111232
2111233
2111234
2111235
2111236
2111237
2111238
2111239
2111240
2111241
2111242
2111243
2111244
2111245
2111246
2111247
2111248
2111249
2111250
2111251
2111252
2111253
2111254
2111255
2111256
2111257
2111258
2111259
2111260
2111261
2111262
2111263
2111264
2111265
2111266
2111267
2111268
2111269
2111270
2111271
2111272
2111273
2111274
2111275
2111276
2111277
2111278
2111279
2111280
2111281
2111282
2111283
2111284
2111285
2111286
2111287
2111288
2111289
2111290
2111291
2111292
2111293
2111294
2111295
2111296
2111297
2111298
2111299
2111300
2111301
2111302
2111303
2111304
2111305
2111306
2111307
2111308
2111309
2111311
2111312
2111313
2111314
2111315
2111316
2111317
2111318
2111319
2111320
2111321
2111322
2111323
2111324
2111325
2111326
2111327
2111328
2111329
2111330
2111331
2111332
2111333
2111334
2111335
2111336
2111337
2111338
2111339
2111340
2111341
2111342
2111343
2111344
2111345
2111346
2111347
2111348
2111349
2111350
2111351
2111352
2111353
2111354
2111355
2111356
2111357
2111358
2111359
2111360
2111361
2111362
2111363
2111364
2111365
2111366
2111367
2111368
2111369
2111370
2111371
2111372
2111373
2111374
2111375
2111376
2111377
2111378
2111379
2111380
2111381
2111382
2111383
2111384
2111385
2111386
2111387
2111388
2111389
2111390
2111391
2111392
2111393
2111394
2111395
2111396
2111397
2111398
2111399
2111400
2111401
2111402
2111403
2111404
2111405
2111406
2111407
2111408
2111409
2111411
2111412
2111413
2111414
2111415
2111416
2111417
2111418
2111419
2111420
2111421
2111422
2111423
2111424
2111425
2111426
2111427
2111428
2111429
2111430
2111431
2111432
2111433
2111434
2111435
2111436
2111437
2111438
2111439
2111440
2111441
2111442
2111443
2111444
2111445
2111446
2111447
2111448
2111449
2111450
2111451
2111452
2111453
2111454
2111455
2111456
so as you can see this is all in sequence, but now i want to achieve all trimmed zeros, like if this number got any zero, it should move to next sequence which is not having zero.
Like if it after moving ahead of 9, it shouldn't show 10 instead it should show 11,
1,2,3......8,9,11.....19,21....59,61.....99,111.... because 101, 102 again including zeros, so it should be having 111 directly.
then 198,199...211.... as can't keep 201,202. go gaps are undefined. not an fixed interval. tried a lots things. getting closer but not correct at all.
**Output i want :**
2111111
2111112
2111113
2111114
2111115
2111116
2111117
2111118
2111119
2111121
2111122
2111123
2111124
2111125
2111126
2111127
2111128
2111129
2111131
2111132
2111133
2111134
2111135
2111136
2111137
2111138
2111139
2111141
2111142
2111143
2111144
2111145
2111146
2111147
2111148
2111149
2111151
2111152
2111153
2111154
2111155
2111156
2111157
2111158
2111159
2111161
2111162
2111163
2111164
2111165
2111166
2111167
2111168
2111169
2111171
2111172
2111173
2111174
2111175
2111176
2111177
2111178
2111179
2111181
2111182
2111183
2111184
2111185
2111186
2111187
2111188
2111189
2111191
2111192
2111193
2111194
2111195
2111196
2111197
2111198
2111199
2111211
2111212
2111213
2111214
2111215
2111216
2111217
2111218
2111219
2111221
2111222
2111223
2111224
2111225
2111226
2111227
2111228
2111229
2111231
2111232
2111233
2111234
2111235
2111236
2111237
2111238
2111239
2111241
2111242
2111243
2111244
2111245
2111246
2111247
2111248
2111249
2111251
2111252
2111253
2111254
2111255
2111256
2111257
2111258
2111259
2111261
2111262
2111263
2111264
2111265
2111266
2111267
2111268
2111269
2111271
2111272
2111273
2111274
2111275
2111276
2111277
2111278
2111279
2111281
2111282
2111283
2111284
2111285
2111286
2111287
2111288
2111289
2111291
2111292
2111293
2111294
2111295
2111296
2111297
2111298
2111299
2111311
2111312
2111313
2111314
2111315
2111316
2111317
2111318
2111319
2111321
2111322
2111323
2111324
2111325
2111326
2111327
2111328
2111329
2111331
2111332
2111333
2111334
2111335
2111336
2111337
2111338
2111339
2111341
2111342
2111343
2111344
2111345
2111346
2111347
2111348
2111349
2111351
2111352
2111353
2111354
2111355
2111356
2111357
2111358
2111359
2111361
2111362
2111363
2111364
2111365
2111366
2111367
2111368
2111369
2111371
2111372
2111373
2111374
2111375
2111376
2111377
2111378
2111379
2111381
2111382
2111383
2111384
2111385
2111386
2111387
2111388
2111389
2111391
2111392
2111393
2111394
2111395
2111396
2111397
2111398
2111399
2111411
2111412
2111413
2111414
2111415
2111416
2111417
2111418
2111419
2111421
2111422
2111423
2111424
2111425
2111426
2111427
2111428
2111429
2111431
2111432
2111433
2111434
2111435
2111436
2111437
2111438
2111439
2111441
2111442
2111443
2111444
2111445
2111446
2111447
2111448
2111449
2111451
2111452
2111453
2111454
2111455
2111456
It shouldn't have any zeros, and once skipped any zero, it should move to the next sequence which is not having any zero too.
| <javascript><for-loop><iteration> | 2016-05-12 10:10:55 | LQ_EDIT |
37,183,799 | Remove nTh record from array using loop | <p>I'm writing a program that reads a .csv file, and then loops through it removing every 10th record it encounters before outputting it.</p>
<p>I've been stuck on what I believe is a syntax issue for a while now and just can't seem to nail it. Anyone mind having a look? </p>
<pre><code>lines = []
i = 0
elements = []
element2 = []
output = []
file = File.open("./properties.csv", "r")
while (line = file.gets)
i += 1
# use split to break array up using commas
arr = line.split(',')
elements.push({ id: arr[0], streetAddress: arr[1], town: arr[2], valuationDate: arr[3], value: arr[4] })
end
file.close
# filter out blanks and nill rows
x = elements.select { |elements| elements[:id].to_i >= 0.1}
# Loop to remove every 10th record
e = 0
d = 1
loop do x.length
if e == (10 * d)
d ++
e ++
else
x = elements.select[e]
e ++
end
puts x
puts "#{x.length} house in list, #{d} records skipped."
CSV FILE
ID,Street address,Town,Valuation date,Value
1,1 Northburn RD,WANAKA,1/1/2015,280000
2,1 Mount Ida PL,WANAKA,1/1/2015,280000
3,1 Mount Linton AVE,WANAKA,1/1/2015,780000
4,1 Kamahi ST,WANAKA,1/1/2015,155000
5,1 Kapuka LANE,WANAKA,1/1/2015,149000
6,1 Mohua MEWS,WANAKA,1/1/2015,560000
7,1 Kakapo CT,WANAKA,1/1/2015,430000
8,1 Mt Gold PL,WANAKA,1/1/2015,1260000
9,1 Penrith Park DR,WANAKA,1/1/2015,1250000
10,1 ATHERTON PL,WANAKA,1/1/2015,650000
11,1 WAIMANA PL,WANAKA,1/1/2015,780000
12,1 ROTO PL,WANAKA,1/1/2015,1470000
13,1 Toms WAY,WANAKA,1/1/2015,2230000
14,1 MULBERRY LANE,WANAKA,1/1/2015,415000
15,1 Range View PL,WANAKA,1/1/2015,300000
16,1 Clearview ST,WANAKA,1/1/2015,1230000
17,1 Clutha PL,WANAKA,1/1/2015,700000
18,1 Centre CRES,WANAKA,1/1/2015,295000
19,1 Valley CRES,WANAKA,1/1/2015,790000
20,1 Edgewood PL,WANAKA,1/1/2015,365000
21,1 HUNTER CRES,WANAKA,1/1/2015,335000
22,1 KOWHAI DR,WANAKA,1/1/2015,480000
23,1 RIMU LANE,WANAKA,1/1/2015,465000
24,1 CHERRY CT,WANAKA,1/1/2015,495000
25,1 COLLINS ST,WANAKA,1/1/2015,520000
26,1 AUBREY RD,WANAKA,1/1/2015,985000
27,1 EELY POINT RD,WANAKA,1/1/2015,560000
28,1 LINDSAY PL,WANAKA,1/1/2015,385000
29,1 WINDERS ST,WANAKA,1/1/2015,760000
30,1 Manuka CRES,WANAKA,1/1/2015,510000
31,1 WILEY RD,WANAKA,1/1/2015,420000
32,1 Baker GR,WANAKA,1/1/2015,820000
33,1 Briar Bank DR,WANAKA,1/1/2015,1260000
34,1 LAKESIDE RD,WANAKA,1/1/2015,440000
35,1 PLANTATION RD,WANAKA,1/1/2015,345000
36,1 Allenby PL,WANAKA,1/1/2015,640000
37,1 ROB ROY LANE,WANAKA,1/1/2015,380000
38,1 Ansted PL,WANAKA,1/1/2015,590000
39,1 Fastness CRES,WANAKA,1/1/2015,640000
40,1 APOLLO PL,WANAKA,1/1/2015,385000
41,1 AEOLUS PL,WANAKA,1/1/2015,370000
42,1 Peak View RDGE,WANAKA,1/1/2015,1750000
43,1 Moncrieff PL,WANAKA,1/1/2015,530000
44,1 Islington PL,WANAKA,1/1/2015,190000
45,1 Hidden Hills DR,WANAKA,1/1/2015,1280000
46,1 Weatherall CL,WANAKA,1/1/2015,425000
47,1 Terranova PL,WANAKA,1/1/2015,900000
48,1 Cliff Wilson ST,WANAKA,1/1/2015,1200000
49,1 TOTARA TCE,WANAKA,1/1/2015,460000
50,1 Koru WAY,WANAKA,1/1/2015,570000
51,1 Bovett PL,Wanaka,1/1/2015,495000
52,1 Pearce PL,Wanaka,1/1/2015,675000
53,1 Ironside DR,WANAKA,1/1/2015,570000
54,1 Bob Lee PL,WANAKA,1/1/2015,610000
55,1 Hogan LANE,WANAKA,1/1/2015,395000
56,1 ARDMORE ST,WANAKA,1/1/2015,1190000
57,1 Bullock Creek LANE,WANAKA,1/1/2015,11125000
58,1 DUNMORE ST,WANAKA,1/1/2015,1300000
59,1 Primary LANE,WANAKA,1/1/2015,430000
60,1 SYCAMORE PL,WANAKA,1/1/2015,720000
61,1 FAULKS TCE,WANAKA,1/1/2015,780000
62,1 Alpha CL,WANAKA,1/1/2015,500000
63,1 Coromandel ST,WANAKA,1/1/2015,530000
64,1 Niger ST,WANAKA,1/1/2015,475000
65,1 Maggies Way,WANAKA,1/1/2015,375000
66,1 Hollyhock LANE,QUEENSTOWN,1/1/2015,1080000
67,1 ELDERBERRY CRES,WANAKA,1/1/2015,1340000
68,1 Foxglove HTS,WANAKA,1/1/2015,2520000
69,1 MEADOWSTONE DR,WANAKA,1/1/2015,650000
70,1 OAKWOOD PL,WANAKA,1/1/2015,580000
71,1 MEADOWBROOK PL,WANAKA,1/1/2015,645000
72,1 Jessies CRES,WANAKA,1/1/2015,320000
73,1 Lansdown ST,WANAKA,1/1/2015,700000
74,1 Stonebrook DR,WANAKA,1/1/2015,640000
75,1 Hyland ST,WANAKA,1/1/2015,500000
76,1 TAPLEY PADDOCK,WANAKA,1/1/2015,720000
77,1 Homestead CL,WANAKA,1/1/2015,1750000
78,1 NORMAN TCE,WANAKA,1/1/2015,620000
79,1 Sunrise Bay DR,WANAKA,1/1/2015,3000000
80,1 LARCH PL,WANAKA,1/1/2015,570000
81,1 MILL END,WANAKA,1/1/2015,600000
82,1 Bills WAY,WANAKA,1/1/2015,750000
83,1 Heuchan LANE,WANAKA,1/1/2015,610000
84,1 SARGOOD DR,WANAKA,1/1/2015,455000
85,1 Frederick ST,WANAKA,1/1/2015,455000
86,1 Connell TCE,WANAKA,1/1/2015,600000
87,1 Soho ST,QUEENSTOWN,1/1/2015,320000
88,1 Hikuwai DR,ALBERT TOWN,1/1/2015,280000
89,1 Harrier LANE,WANAKA,1/1/2015,1000000
90,1 Ewing PL,WANAKA,1/1/2015,780000
91,1 Sherwin AVE,ALBERT TOWN,1/1/2015,440000
92,1 Hardie PL,WANAKA,1/1/2015,830000
93,1 Finch ST,ALBERT TOWN,1/1/2015,540000
94,1 Poppy LANE,ALBERT TOWN,1/1/2015,395000
95,1 Warbler LANE,ALBERT TOWN,1/1/2015,410000
96,1 Balneaves LANE,WANAKA,1/1/2015,250000
97,1 Mill Green,Arrowtown,1/1/2015,800000
</code></pre>
| <ruby><loops> | 2016-05-12 10:11:29 | LQ_CLOSE |
37,183,884 | Adding url into <a href=""> with Emmet | <p>Has Emmet a syntax for adding <code>URL</code> into <code><a href=""></code> tag?</p>
<p>E.g.:</p>
<p>Syntax:</p>
<pre><code>a:www.google.com
</code></pre>
<p>Result:</p>
<pre><code><a href="www.google.com"></a>
</code></pre>
| <html><emmet> | 2016-05-12 10:14:29 | HQ |
37,183,943 | Django - How to filter by date with Django Rest Framework? | <p>I have some model with a timestamp field:</p>
<p>models.py</p>
<pre><code>class Event(models.Model):
event_type = models.CharField(
max_length=100,
choices=EVENT_TYPE_CHOICES,
verbose_name=_("Event Type")
)
event_model = models.CharField(
max_length=100,
choices=EVENT_MODEL_CHOICES,
verbose_name=_("Event Model")
)
timestamp = models.DateTimeField(auto_now=True, verbose_name=_("Timestamp"))
</code></pre>
<p>I'm then using Django-rest-framework to create an API endpoint for this class, with django-filter providing a filtering functionality as follows:</p>
<pre><code>from .models import Event
from .serializers import EventSerializer
from rest_framework import viewsets, filters
from rest_framework import renderers
from rest_framework_csv import renderers as csv_renderers
class EventsView(viewsets.ReadOnlyModelViewSet):
"""
A read only view that returns all audit events in JSON or CSV.
"""
queryset = Event.objects.all()
renderer_classes = (csv_renderers.CSVRenderer, renderers.JSONRenderer)
serializer_class = EventSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_fields = ('event_type', 'event_model', 'timestamp')
</code></pre>
<p>with the following settings:</p>
<pre><code>REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',),
}
</code></pre>
<p>I'm able to filter by <code>event_type</code> and <code>event_model</code>, but am having trouble filtering by the timestamp field. Essentially, I want to make an API call that equates to the following:</p>
<pre><code>AuditEvent.objects.filter(timestamp__gte='2016-01-02 00:00+0000')
</code></pre>
<p>which I would expect I could do as follows:</p>
<pre><code>response = self.client.get("/api/v1/events/?timestamp=2016-01-02 00:00+0000", **{'HTTP_ACCEPT': 'application/json'})
</code></pre>
<p>though that is incorect. How do I make an API call that returns all objects with a timestamp greater than or equal to a certain value?</p>
| <python><django><rest><django-rest-framework><django-filter> | 2016-05-12 10:17:03 | HQ |
37,184,582 | Is there a way to edit css of new google forms? | <p>Before I used to be able to just copy the source code of the form and paste the part between <code><form></form></code> into the page and add my own styling. But this doesn't seem to work anymore.
Has anyone found a way to still be able to customize google forms?</p>
| <css><google-forms> | 2016-05-12 10:43:15 | HQ |
37,185,016 | How do i post data using Angularjs | I am new in Angularjs.I tried to post the form data.but it couldnot works.
My code is given below.
var app = angular.module('myApp', []);
// Controller function and passing $http service and $scope var.
app.controller('myCtrl', function($scope, $http) {
// create a blank object to handle form data.
$scope.user = {};
// calling our submit function.
$scope.submitForm = function() {
// Posting data to file
$http({
method : 'POST',
url : '/tokken/d/',
data : $scope.user, //forms user object
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
})
.success(function(data) {
if (data.errors) {
// Showing errors.
$scope.errorName = data.errors.name;
$scope.erroPassword = data.errors.password;
} else {
$scope.message = data.message;
}
});
};
});
please help me.. | <angularjs> | 2016-05-12 11:02:36 | LQ_EDIT |
37,185,735 | Sample program for GDbus signals | <p>I am new to GDbus programming. I need to implement a simple Dbus send-receive message (Signals) using Dbus Glib. I tried to google some sample programs, but couldn't find.</p>
<p>Can anyone post any such sample program or point me to some sample program tutorial?</p>
<p>Thanks in advance...</p>
<p>Thanks,
SB</p>
| <gdbus> | 2016-05-12 11:36:40 | HQ |
37,185,894 | Meteor is stuck at downloading meteor-tool@1.3.2_4 | <p>I have been using meteor framework for the past few days. Now, when i create a new project it downloads meteor-tool@1.3.2_4. But it does not complete download. It seems to be stuck at downloading and shows only following line:</p>
<pre><code>Downloading meteor-tool@1.3.2_4...
</code></pre>
<p>How can i troubleshoot this issue.</p>
| <meteor> | 2016-05-12 11:44:45 | HQ |
37,186,197 | Error:could not create the Java Virtual Machine Error:A fatal exception has occured.Program will exit | <p>I have just installed Java SE Development Kit 8u91 on my 64 bit Windows-10 OS. I set my <em>path</em> variables . I tried <strong>java --version</strong> in my command prompt it gave me an error.</p>
<pre><code>c:\Users\Onlymanu>java --version
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
</code></pre>
<p>But when i tried <strong>java -version</strong> it worked. </p>
<p>I tried initializing <em>_JAVA_OPTIONS</em> environment variable and ever tried re-installation none of them worked. Can any one help me please?</p>
| <java><java-8> | 2016-05-12 11:57:41 | HQ |
37,186,417 | Resolving entity URI in custom controller (Spring HATEOAS) | <p>I have a project based on spring-data-rest and also it has some custom endpoints.</p>
<p>For sending POST data I'm using json like </p>
<pre><code>{
"action": "REMOVE",
"customer": "http://localhost:8080/api/rest/customers/7"
}
</code></pre>
<p>That is fine for spring-data-rest, but does not work with a custom controller. </p>
<p>for example: </p>
<pre><code>public class Action {
public ActionType action;
public Customer customer;
}
@RestController
public class ActionController(){
@Autowired
private ActionService actionService;
@RestController
public class ActionController {
@Autowired
private ActionService actionService;
@RequestMapping(value = "/customer/action", method = RequestMethod.POST)
public ResponseEntity<ActionResult> doAction(@RequestBody Action action){
ActionType actionType = action.action;
Customer customer = action.customer;//<------There is a problem
ActionResult result = actionService.doCustomerAction(actionType, customer);
return ResponseEntity.ok(result);
}
}
</code></pre>
<p>When I call </p>
<pre><code>curl -v -X POST -H "Content-Type: application/json" -d '{"action": "REMOVE","customer": "http://localhost:8080/api/rest/customers/7"}' http://localhost:8080/customer/action
</code></pre>
<p>I have an answer</p>
<pre><code>{
"timestamp" : "2016-05-12T11:55:41.237+0000",
"status" : 400,
"error" : "Bad Request",
"exception" : "org.springframework.http.converter.HttpMessageNotReadableException",
"message" : "Could not read document: Can not instantiate value of type [simple type, class model.user.Customer] from String value ('http://localhost:8080/api/rest/customers/7'); no single-String constructor/factory method\n at [Source: java.io.PushbackInputStream@73af10c6; line: 1, column: 33] (through reference chain: api.controller.Action[\"customer\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class logic.model.user.Customer] from String value ('http://localhost:8080/api/rest/customers/7'); no single-String constructor/factory method\n at [Source: java.io.PushbackInputStream@73af10c6; line: 1, column: 33] (through reference chain: api.controller.Action[\"customer\"])",
"path" : "/customer/action"
* Closing connection 0
}
</code></pre>
<p>bacause case spring can not convert a URI to a Customer entity.</p>
<p>Is there any way to use spring-data-rest mechanism for resolving entities by their URIs?</p>
<p>I have only one idea - to use custom JsonDeserializer with parsing URI for extracting entityId and making a request to a repository. But this strategy does not help me if I have URI like "<a href="http://localhost:8080/api/rest/customers/8/product" rel="noreferrer">http://localhost:8080/api/rest/customers/8/product</a>" in that case I do not have <strong>product.Id</strong> value.</p>
| <java><spring><rest><spring-data-rest><spring-hateoas> | 2016-05-12 12:07:16 | HQ |
37,186,438 | How can i find longest substring without number in a string of alphanumerical characters in C# | <p>How can i find longest substring without number in a string of alphanumerical characters in C#. for example, if a string is a1bcd2, how can i extract bcd?</p>
| <c#><string> | 2016-05-12 12:08:15 | LQ_CLOSE |
37,186,448 | Add down arrow to hover dropdown menu | I'm implementing this dropdown menu: http://www.w3schools.com/howto/howto_css_dropdown.asp
I want to add an arrow to the dropdown to indicate it's a hover item. How do I do this? I've tried adding
> content: ' ▾';
to the .dropbtn class but it did not work. | <css> | 2016-05-12 12:08:45 | LQ_EDIT |
37,186,532 | Write a function that accepts a list of integer values as a parameter. Replace all even numbers with a 0 and all odd numbers with a 1 | <p>currently studying for a final exam and I stumbled upon this practice problem. I understand how to find all the even and odd numbers within a list but I have 0 idea on how to change them. My book and class notes have proven to be zero help so any insight someone could provide would be greatly appreciated </p>
| <python><list> | 2016-05-12 12:11:56 | LQ_CLOSE |
37,186,967 | Undefined symbols for architecture x86_64: "std::terminate()", referenced from | <p>I got the error when i run <code>react-native run-ios</code> after upgraded RN to 0.26.0-rc. </p>
<pre><code>Undefined symbols for architecture x86_64:
"std::terminate()", referenced from:
___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
"___cxa_begin_catch", referenced from:
___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
"___gxx_personality_v0", referenced from:
-[RCTJavaScriptContext initWithJSContext:onThread:] in libReact.a(RCTJSCExecutor.o)
-[RCTJavaScriptContext init] in libReact.a(RCTJSCExecutor.o)
-[RCTJavaScriptContext invalidate] in libReact.a(RCTJSCExecutor.o)
_RCTNSErrorFromJSError in libReact.a(RCTJSCExecutor.o)
+[RCTJSCExecutor runRunLoopThread] in libReact.a(RCTJSCExecutor.o)
-[RCTJSCExecutor init] in libReact.a(RCTJSCExecutor.o)
-[RCTJSCExecutor context] in libReact.a(RCTJSCExecutor.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</code></pre>
<p>How can i fix it?</p>
| <objective-c><react-native> | 2016-05-12 12:31:31 | HQ |
37,187,014 | How to create a 3rd column based on 2 columns from two tables [inner and outer join] | <ul>
<li>I have a lot of rows in 'table alpha' where some of these rows occurs in 'table beta' as well.</li>
<li>Both row alpha and beta have a date column.
<ul>
<li>However, when i select both date columns the rows from table alpha <strong>that do not occur</strong> in row B will have a null-value assigned to them.</li>
</ul></li>
</ul>
<blockquote>
<p>My problem is that I want to make a third date-column that will use the dates from table <em>beta</em> <strong>if they are not null</strong>. If they are null, it should use the dates from table alpha.</p>
</blockquote>
| <mysql><sql><if-statement><inner-join><outer-join> | 2016-05-12 12:33:10 | LQ_CLOSE |
37,187,519 | about spring boot how to disable web environment correctly | <p>Spring boot non-web application, when start it has below error</p>
<pre><code>Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:185) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
</code></pre>
<p>Then I tried below manner </p>
<pre><code>new SpringApplication().setWebEnvironment(false);
</code></pre>
<p>then start it still have above error.</p>
<p>Then tried </p>
<pre><code>@SpringBootApplication(exclude={SpringDataWebAutoConfiguration.class})
</code></pre>
<p>but still have the same error.</p>
<p>At last I tried add below configuration in <code>application.properties</code></p>
<pre><code>spring.main.web-environment=false
</code></pre>
<p>this time it works.</p>
<p>Why the first two manner cannot work?</p>
| <spring-boot> | 2016-05-12 12:53:21 | HQ |
37,187,758 | Chage value in R | Have ped1.txt and ped2.txt. sep= tab or space
ped1.txt
222 333 444
333 458 458
458 774 556
500K lines...
ped2.txt
222 -12006
333 -11998
I need to recode numbers in file 1 using key from file 2, for all data.
Result should be like:
-12006 -11998 444
-11998 458 458
458 774 556
500K lines...
How to do it?
Thanks.
| <r><recode> | 2016-05-12 13:02:08 | LQ_EDIT |
37,187,899 | Change Gitlab CI Runner user | <p>Currently when I start a build in GitlabCI it is running under gitlab-runner user. I want to change it the company's internal user. I didn't find any parameter to the /etc/gitlab-runner/config.toml which is solve that.</p>
<p>My current configuration: </p>
<pre><code>concurrent = 1
[[runners]]
name = "deploy"
url = ""
token = ""
executor = "shell"
</code></pre>
| <gitlab><gitlab-ci><gitlab-ci-runner> | 2016-05-12 13:07:43 | HQ |
37,188,216 | Accessing `selector` from within an Angular 2 component | <p>I'm trying to figure out how I can access the <code>selector</code> that we pass into the <code>@Component</code> decorator.</p>
<p>For example </p>
<pre><code>@Component({
selector: 'my-component'
})
class MyComponent {
constructor() {
// I was hoping for something like the following but it doesn't exist
this.component.selector // my-component
}
}
</code></pre>
<p>Ultimately, I would like to use this to create a directive that automatically adds an attribute <code>data-tag-name="{this.component.selector}"</code> so that I can use Selenium queries to reliably find my angular elements by their selector.</p>
<p>I am not using protractor</p>
| <angular><angular2-directives><angular2-components><angular2-decorators> | 2016-05-12 13:21:37 | HQ |
37,188,263 | Difference between `yield from $generator` and `return $generator`? | <p>I have a function that gives back a generator. At the moment it uses <code>yield from</code>:</p>
<pre><code>function foo()
{
$generator = getGenerator();
// some other stuff (no yields!)
yield from $generator;
}
</code></pre>
<p>If I replace that <code>yield from</code> with a simple <code>return</code>, does that change anything in this case? Maybe in the execution? Or performance? Does <code>yield from</code> produces a new 'outer' iterator?</p>
<p>I know, in other cases <code>yield from</code> can be more flexible because I can use it several times and even mix it with simple <code>yield</code>s, however that doesn't matter for my case.</p>
| <php><return><generator><yield-from> | 2016-05-12 13:23:19 | HQ |
37,188,734 | Can I show modal window only if it is not registered with jquery? | This is for show the modal window: <br/>
$('.overlay').show();<br/>
setTimeout(function() { <br/>
$(".overlay").fadeOut(); </br>
}, 5000); | <php><jquery><ajax> | 2016-05-12 13:41:17 | LQ_EDIT |
37,189,058 | arguement exception as Fill:excepted non empty string Parameter src table | private void Window1_Loaded(object sender, RoutedEventArgs e)
{
con.Open();
string testTable = StudentPage.testTable;
adp = new SqlDataAdapter("SELECT TOP 5 * FROM " + testTable + " ORDER BY NEWID()", con);
ds.Clear();
adp.Fill(ds, testTable);
alltables = ds.Tables;
MyTable = alltables[testTable];
AllRows = MyTable.Rows;
MyRow = AllRows[0];
GetData();
rowPointer = 0;
currentPage = 0;
crtAnswer = 0;
ViewStatus = new bool[] { true, false, false, false, false };
isBookmarked = new bool[] { false, false, false, false, false };
SelectedOption = new int[] { -1, -1, -1, -1, -1 };
MyTimer.Interval = System.TimeSpan.FromSeconds(1);
MyTimer.Start();
btnFirst.IsEnabled = false;
btnPrevious.IsEnabled = false;
lblQuesInfo.Content = "Question 1/5";
WindowState = WindowState.Maximized;
}
i am currently developing online examination system using c# windows application
while i run this code i am getting arguement exception as Fill:excepted non empty string Parameter src table | <c#> | 2016-05-12 13:54:29 | LQ_EDIT |
37,189,406 | Can obfuscated code be useful sometimes? | <p>While creating a custom 3D <code>Point</code> class with single-precision coordinate values in C#, I had to write a method to calculate the distance between two points. Then I thought about the <code>A -> B</code> graph notation meaning "from A to B", and I thought about overloading the <code>></code> operator, as it has no sense thinking about a point A being "greater" than a point B (besides, the <code>-></code> operator cannot be overloaded).</p>
<p>So I created the following methods:</p>
<pre><code>/// <summary>
/// Calculates the Manhattan distance between the two points.
/// </summary>
public static float operator>(Point p1, Point p2)
{
return Math.Abs(p1.X - p2.X) +
Math.Abs(p1.Y - p2.Y) +
Math.Abs(p1.Z - p2.Z);
}
/// <summary>
/// Calculates the euclidean distance between the two points.
/// </summary>
public static double operator>=(Point p1, Point p2)
{
return Math.Sqrt(Math.Pow(p1.X - p2.X, 2) +
Math.Pow(p1.Y - p2.Y, 2) +
Math.Pow(p1.Z - p2.Z, 2));
}
</code></pre>
<p>This results in code like this:</p>
<pre><code>var manhattan = A > B;
var euclidean = A >= B;
</code></pre>
<p>The code seems to be obfuscated but once you get the grasp of it, it is quite simple to read, and shorter than using <code>A.DistanceTo(B)</code>. </p>
<p>The question is, should I completely avoid this kind of code? If so, what's the reason why? I am quite concerned with Clean Code, and I'm not sure this could be considered <em>clean</em> or not. If you think such code is sometimes allowed, could you provide examples?</p>
| <c#><obfuscation> | 2016-05-12 14:07:17 | LQ_CLOSE |
37,189,640 | String Object with fixed length C# | <p>I have a class wherein I want to use Strings with a fixed size.
The reason for the fixed size is that the class "serializes" into a textfile
with values with a fixed length. I want to avoid to write foreach value a guard clause and instead have the class handle this.</p>
<p>So I have round about 30 properties which would look like this</p>
<pre><code> public String CompanyNumber
{
get
{
return m_CompanyNumber.PadLeft(5, ' ');
}
set
{
if (value.Length > 5)
{
throw new StringToLongException("The CompanyNumber may only have 5 characters", "CompanyNumber");
}
m_CompanyNumber = value;
}
}
</code></pre>
<p>I would like to have a String that handles this by itself. Currently I have the following:</p>
<pre><code>public class FixedString
{
String m_FixedString;
public FixedString(String value)
{
if (value.Length > 5)
{
throw new StringToLongException("The FixedString value may consist of 5 characters", "value");
}
m_FixedString= value;
}
public static implicit operator FixedString(String value)
{
FixedString fsv = new FixedString(value);
return fsv;
}
public override string ToString()
{
return m_FixedString.PadLeft(5,' ');
}
}
</code></pre>
<p>The problem I have with this solution is that I can't set the String length at "compile time".</p>
<p>It would be ideal if it would look something like this in the end</p>
<pre><code>public FixedString<5> CompanyNumber { get; set; }
</code></pre>
| <c#><.net> | 2016-05-12 14:16:36 | HQ |
37,189,872 | NFC Integeration in ios application | <p>Is there any Documentation or API Available that will help in creating NFC based Application for IPhone 6 and 6s Device in IOS. </p>
| <ios><swift><nfc><iphone-6> | 2016-05-12 14:25:19 | LQ_CLOSE |
37,190,248 | How to get button groups that span the full width of a parent in Bootstrap? | <p>In Bootstrap, how can I get a button group like the following that span the full width of a parent element? (like with the ".btn-block" class, but applied to a group <a href="http://getbootstrap.com/css/#buttons-sizes" rel="noreferrer">http://getbootstrap.com/css/#buttons-sizes</a> )</p>
<pre><code><div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-default">Left</button>
<button type="button" class="btn btn-default">Middle</button>
<button type="button" class="btn btn-default">Right</button>
</div>
</code></pre>
| <html><css><twitter-bootstrap><class><buttongroup> | 2016-05-12 14:41:16 | HQ |
37,190,398 | Converting variable name into a string then printing it? Python | <p>Im wondering if there is a way to take a variable's name and convert it into a string to print it?</p>
<p>for example:</p>
<pre><code>myVariable = 1
</code></pre>
<p>i want to convert "myVariable" like the name of the variable itself not the value of it into a string and then print that string to a console, is this possible?</p>
| <python> | 2016-05-12 14:47:26 | LQ_CLOSE |
37,190,748 | can someone explain load average in flower? | <p>I use flower to monitor my rabbitmq queues, I am not able to understand how load average is calculated, if someone can explain then that would be of great help.<br>
I've a quad core processor .<br>
Thank You.</p>
| <rabbitmq><celery><flower> | 2016-05-12 15:01:17 | HQ |
37,191,319 | How can i display pdf file in my ASP.net web application? | <p>I want to click my linkbutton and open my pdf file that project has.
How can i do this? </p>
<p>in aspx page:
</p>
<p>in cs page:
private void pdfShow_Click(){</p>
<p>///Please help this.
}</p>
| <c#><asp.net><.net><web> | 2016-05-12 15:25:45 | LQ_CLOSE |
37,191,966 | Can I detect element visibility using only CSS? | <p>I checked the API for some pseudo-selector such as <code>:visible</code> or <code>:hidden</code>, but was disappointed to find no such selector exists. Since jQuery has supported these selectors for a while now, I was hoping they'd be implemented. The idea is, that I'd like to show a certain element only when the element next to it is hidden, but I don't want to use JavaScript to do so. Any options?</p>
| <css><sass> | 2016-05-12 15:57:21 | HQ |
37,192,606 | Python regex, how to delete all matches from a string | <p>I have a list of regex patterns.</p>
<pre><code>rgx_list = ['pattern_1', 'pattern_2', 'pattern_3']
</code></pre>
<p>And I am using a function to loop through the list, compile the regex's, and apply a <code>findall</code> to grab the matched terms and then I would like a way of deleting said terms from the text.</p>
<pre><code>def clean_text(rgx_list, text):
matches = []
for r in rgx_list:
rgx = re.compile(r)
found_matches = re.findall(rgx, text)
matches.append(found_matches)
</code></pre>
<p>I want to do something like <code>text.delete(matches)</code> so that all of the matches will be deleted from the text and then I can return the <em>cleansed</em> text. </p>
<p>Does anyone know how to do this? My current code will only work for one match of each pattern, but the text may have more than <strong>one</strong> occurence of the same pattern and I would like to eliminate all matches.</p>
| <python><regex> | 2016-05-12 16:29:24 | HQ |
37,192,670 | stop a java program within a java program | I wanted to stop a java program that has been run with command prompt in windows.
How is it possible to shutdown it provided that there are some other running java programs. This should be with a java program not manually.
p.s: I searched a lot for answer and I did not find an answer even here and my question is clear. please do not add unrelated comments. | <java><process><kill-process> | 2016-05-12 16:32:14 | LQ_EDIT |
37,193,157 | Apply GZIP compression to a CSV in Python Pandas | <p>I am trying to write a dataframe to a gzipped csv in python pandas, using the following:</p>
<pre><code>import pandas as pd
import datetime
import csv
import gzip
# Get data (with previous connection and script variables)
df = pd.read_sql_query(script, conn)
# Create today's date, to append to file
todaysdatestring = str(datetime.datetime.today().strftime('%Y%m%d'))
print todaysdatestring
# Create csv with gzip compression
df.to_csv('foo-%s.csv.gz' % todaysdatestring,
sep='|',
header=True,
index=False,
quoting=csv.QUOTE_ALL,
compression='gzip',
quotechar='"',
doublequote=True,
line_terminator='\n')
</code></pre>
<p>This just creates a csv called 'foo-YYYYMMDD.csv.gz', not an actual gzip archive.</p>
<p>I've also tried adding this:</p>
<pre><code>#Turn to_csv statement into a variable
d = df.to_csv('foo-%s.csv.gz' % todaysdatestring,
sep='|',
header=True,
index=False,
quoting=csv.QUOTE_ALL,
compression='gzip',
quotechar='"',
doublequote=True,
line_terminator='\n')
# Write above variable to gzip
with gzip.open('foo-%s.csv.gz' % todaysdatestring, 'wb') as output:
output.write(d)
</code></pre>
<p>Which fails as well. Any ideas? </p>
| <python><csv><pandas><gzip><export-to-csv> | 2016-05-12 16:57:49 | HQ |
37,193,670 | ValueError: Attempted relative import in non-package not for tests package | <p>I know this has been asked many times but somehow I am not able to get over this error. Here is my directory structure-</p>
<pre><code>project/
pkg/
__init__.py
subpackage1/
script1.py
__init__.py
subpackage2/
script2.py
__init__.py
</code></pre>
<p>script2.py has:</p>
<pre><code>class myclass:
def myfunction:
</code></pre>
<p>script1.py has</p>
<pre><code> from ..subpackage2 import script2
</code></pre>
<p>I also tried</p>
<pre><code>from ..subpackage2 import myclass
</code></pre>
<p>And this gives me : ValueError: Attempted relative import in non-package</p>
<p>Any help would be really appreciated. </p>
| <python> | 2016-05-12 17:25:11 | HQ |
37,193,868 | Add tap gesture to UIStackView | <p>Im attempting to add a <code>UITapGesture</code> to a <code>UIStackView</code> within a collectionView cell but each time I do my app crashes. (All <code>IBOutlets</code> are connected) This there something I'm doing wrong here?</p>
<pre><code> let fGuesture = UITapGestureRecognizer(target: self, action: #selector(self.showF(_:)))
cell.fstackView.addGestureRecognizer(fGuesture)
func showF(sender: AnyObject){
print(111)
}
</code></pre>
| <ios><swift><uistackview> | 2016-05-12 17:35:30 | HQ |
37,193,992 | How do I import the pytest monkeypatch plugin? | <p>I want to use the <a href="https://pytest.org/latest/monkeypatch.html" rel="noreferrer">pytest monkeypatch</a> plugin, but I can't figure out how to import it. I've tried:</p>
<ul>
<li><code>import monkeypath</code></li>
<li><code>import pytest.monkeypatch</code></li>
<li><code>from pytest import monkeypatch</code></li>
</ul>
| <python><pytest><monkeypatching> | 2016-05-12 17:42:39 | HQ |
37,194,202 | IE11 gives SCRIPT1002 error when defining class in javascript | <p>I have some trouble with IE11 and a static javascript class I wrote.</p>
<p>The error I get is:</p>
<blockquote>
<p>SCRIPT1002: Syntax error
rgmui.box.js (6,1)</p>
</blockquote>
<p>Which points to: </p>
<pre><code>// ===========================================
// RGMUI BOX
// Static class
class RgMuiBox {
^
</code></pre>
<p>So I'm guessing I'm defining this class in the wrong way? What's the correct way of doing this?</p>
<p>I found a post on SO that seems to point out that the issue is ES5 vs ES6 - and I figure IE11 doesn't support ES6?</p>
<p>Just to be complete, this is what I have (simplified):</p>
<pre><code>class RgMuiBox {
static method1() {
// .. code ..
}
}
</code></pre>
<p>Thanks!</p>
| <javascript><internet-explorer> | 2016-05-12 17:54:01 | HQ |
37,194,953 | Unrecognized Selector swift | <p>I've perused the previous posts on SO regarding this topic and I've ensured my code doesn't contain the same bugs, but I keep getting the error "Unrecognized selector sent to instance" when I try tap my UIButton. Can anyone figure out what the issue is? I've made sure that both my action name and signature are identical to the function I'm connecting to my button. I've tried restarting XCode and it still doesn't work. Any input is appreciated. </p>
<pre><code>import UIKit
import MapKit
class MapViewController: UIViewController {
var mapView: MKMapView!
override func loadView() {
//create an instance of the MkMapView class and set it as the view controllers view
mapView = MKMapView ()
view = mapView
//create a set of segmented controls to the map interface to give the user some options regarding their map
let segmentedControls = UISegmentedControl(items: ["Satellite", "Standard", "Hybrid"])
//set the color of the segemented controls and set which index they default to on launch
segmentedControls.backgroundColor = UIColor.whiteColor().colorWithAlphaComponent(0.5)
segmentedControls.selectedSegmentIndex = 0
//how auto-layout used to work was each view would have an auto-resizing mask that iOS would look at and add constraints onto the view based on its mask. The problem is now that we can manually add constraints ourselves, we run into conflicts in the layout between the constraints we set out and those iOS sets up itself through the mask. The best way to avoid this is to simply set the translatesAutoreszing... property to "false" so that iOS doesn't create its own constraints and only ours get set in the project
segmentedControls.translatesAutoresizingMaskIntoConstraints = false
//add the segmentedControl to the main view
view.addSubview(segmentedControls)
//use the view margins to set the insets of the segmented controls- that way they'll adapt to the margins of whatever screen the ap loads on
let margins = view.layoutMarginsGuide
//create a set of constraints for the segmented controls
let topConstraint = segmentedControls.topAnchor.constraintEqualToAnchor(topLayoutGuide.bottomAnchor, constant: 8)
let leadConstraint = segmentedControls.leadingAnchor.constraintEqualToAnchor(margins.leadingAnchor)
let traiConstraint = segmentedControls.trailingAnchor.constraintEqualToAnchor(margins.trailingAnchor)
//activate the constraints
topConstraint.active = true
leadConstraint.active = true
trailConstraint.active = true
//create a UIButton, set its label, and add it to the view hierarchy
let button = UIButton(type: .System)
button.setTitle("Show Location", forState: .Normal)
button.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(button)
//create constraints and set them to active
let buttonBottomConstraint = button.bottomAnchor.constraintEqualToAnchor(bottomLayoutGuide.topAnchor)
let buttonLeadConstraint = button.leadingAnchor.constraintEqualToAnchor(margins.leadingAnchor)
let buttonTrailConstraint = button.trailingAnchor.constraintEqualToAnchor(margins.trailingAnchor);
buttonBottomConstraint.active = true
buttonLeadConstraint.active = true
buttonTrailConstraint.active = true
//set the action-target connection
button.addTarget(self, action: "zoomToUser:", forControlEvents: UIControlEvents.TouchUpInside)
func zoomToUser(sender: UIButton!) {
mapView.showsUserLocation = true
}
}
override func viewDidLoad() {
super.viewDidLoad()
print("Loaded map view")
}
}
</code></pre>
| <ios><swift> | 2016-05-12 18:37:45 | LQ_CLOSE |
37,194,992 | Dynamic struct array in function in C | <p>I'm trying to create adjacency list to represent a graph from a list of edges in file "input.txt". I know the basics of how pointers work but I have problem with dynamic struct array which consists of singly linked lists.</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
struct list {
int vertex;
struct list *next;
};
void create_list(int v, struct list* **array);
int main()
{
int i, v = 5;
struct list *ptr, **array = (struct list **)malloc(sizeof(struct list *) * v);
for (i = 0; i < v; i++)
array[i] = NULL;
array[i] = NULL;
create_list(v, &array);
for(i = 0; i < v; i++) {
ptr = array[i];
printf("%d: ", i);
while(ptr != NULL) {
printf(" ->%d", ptr->vertex);
ptr = ptr->next;
}
printf("\n");
}
return 0;
}
void create_list(int v, struct list* **array)
{
int m, n;
struct list *ptr, *tmp;
FILE *luki;
luki = fopen("input.txt", "r");
while(fscanf(luki, "%d %d\n", &m, &n) == 2) {
tmp = (struct lista*)malloc(sizeof(struct list));
tmp->vertex = n;
tmp->next = NULL;
if (*array[m] == NULL) //Here my program crashes when m changes from 0 to 1
*array[m] = tmp;
else {
ptr = array[m];
while(ptr->next != NULL)
ptr = ptr->next;
ptr->next = tmp;
}
}
fclose(luki);
}
</code></pre>
<p>Could you please help me figure out how it should look like?</p>
<p>Also, at first I made the function without using pointer to array:</p>
<pre><code>void create_list(int v, struct list **array)
create_list(v, array);
</code></pre>
<p>And it worked really good when debugging and (I'm using CodeBlocks):</p>
<pre><code>0: 4 ->3 ->1
1: 2
2: 3
3:
4:
</code></pre>
<p>but while running the program normally I got this:</p>
<pre><code>0:
1:
2:
3:
4:
</code></pre>
<p>Why the output while debugging was right if passing array to function create_list was wrong?</p>
| <c><arrays><adjacency-list> | 2016-05-12 18:39:38 | LQ_CLOSE |
37,195,222 | How to view log output using docker-compose run? | <p>When I use <code>docker-compose up</code> I can see logs for all containers in my <code>docker-compose.yml</code> file.</p>
<p>However, when I use <code>docker-compose run app</code> I only see console output for <code>app</code> but none of the services that <code>app</code> depends on. How can see log output for the other services?</p>
| <docker><docker-compose> | 2016-05-12 18:51:59 | HQ |
37,195,872 | Unused parameters passed to Capybara::Queries::SelectorQuery | <p>I have spec like this:</p>
<pre><code> it 'contains Delete link' do
expect(page).to have_link('Delete', admin_disease_path(disease))
end
</code></pre>
<p>when I run specs it returns warning in the console:</p>
<pre><code>Unused parameters passed to Capybara::Queries::SelectorQuery : ["/admin/diseases/913"]
</code></pre>
<p>How can I fix this?</p>
| <ruby-on-rails><ruby><rspec><capybara> | 2016-05-12 19:30:10 | HQ |
37,197,732 | Powershell Script Active Directory | <p>need some pointers on how to construct a Powershell script that does the following things : asks for active directory username, gives a menu to enable these active directory actions given for username :Reset password, Disable user account, Enable user account, Unlock user account, Delete user account?</p>
| <powershell> | 2016-05-12 21:29:28 | LQ_CLOSE |
37,197,799 | TableView get next row | <p>I have table of Audio(My type)
<a href="http://i.stack.imgur.com/kJBOG.png" rel="nofollow">table</a></p>
<p>I not understand how get next row after selected</p>
| <java><javafx> | 2016-05-12 21:33:56 | LQ_CLOSE |
37,198,539 | Because it curve does not work with histogram? | <p>I have no idea why this simple command does not work?</p>
<pre><code> set.seed(12345)
x<-rnorm(1000,0,10)
hist(x)
curve(dnorm(x,0, 10), add=TRUE, yaxt="n", col="red", log=FALSE)
</code></pre>
| <r><histogram> | 2016-05-12 22:33:47 | LQ_CLOSE |
37,198,681 | What is a purpose of Zap Functor and zap function in Haskell? | <p>I came across <a href="https://hackage.haskell.org/package/category-extras-0.53.5/docs/Control-Functor-Zap.html">this construction</a> in Haskell. I couldn't find any examples or explanations of how can I use <code>zap</code>/<code>zapWith</code> and <code>bizap</code>/<code>bizapWith</code> in real code. Do they in some way related to standard <code>zip</code>/<code>zipWith</code> functions? How can I use <code>Zap</code>/<code>Bizap</code> functors in Haskell code? What are the benefits of them?</p>
| <haskell><functional-programming><functor><higher-order-functions><category-theory> | 2016-05-12 22:48:02 | HQ |
37,198,940 | How to create T4 text templates(.tt) in ASP.NET core on Visual Studio 2015 | <p>I want to create T4 text templates to achieve code generation. All the tutorials I found on msdn suggest following to add a new text template: <code>Add > New Item > Text Template</code>, (eg <a href="https://msdn.microsoft.com/en-us/library/dd820620.aspx">https://msdn.microsoft.com/en-us/library/dd820620.aspx</a>) but I don't see that option(<code>Text Template</code>) there. I am using ASP.NET core 1.0.</p>
<p>Is this issue related to VS2015 or ASP.NET core? If T4 templating is not supported in any of them, what's the best solution/alternative to achieve this? </p>
<p>(I want to generate typescript code from C# code), similar to this tutorial <a href="http://dotnetspeak.com/2015/02/typescript-models-creation-via-t4-templates">http://dotnetspeak.com/2015/02/typescript-models-creation-via-t4-templates</a></p>
| <c#><asp.net-mvc><visual-studio-2015><asp.net-core><asp.net-core-mvc> | 2016-05-12 23:16:53 | HQ |
37,200,025 | How to import custom module in julia | <p>I have a module I wrote here:</p>
<pre><code># Hello.jl
module Hello
function foo
return 1
end
end
</code></pre>
<p>and</p>
<pre><code># Main.jl
using Hello
foo()
</code></pre>
<p>When I run the <code>Main</code> module:</p>
<pre><code>$ julia ./Main.jl
</code></pre>
<p>I get this error:</p>
<pre><code>ERROR: LoadError: ArgumentError: Hello not found in path
in require at ./loading.jl:249
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:320
in process_options at ./client.jl:280
in _start at ./client.jl:378
while loading /Main.jl, in expression starting on line 1
</code></pre>
| <julia> | 2016-05-13 01:51:58 | HQ |
37,200,388 | How to exit spark-submit after the submission | <p>When submitting spark streaming program using spark-submit(YARN mode)
it keep polling the status and never exit</p>
<p>Is there any option in spark-submit to exit after the submission?</p>
<p>===why this trouble me===</p>
<p>The streaming program will run forever and i don't need the status update</p>
<p>I can ctrl+c to stop it if i start it manually
but i have lots of streaming context to start and i need to start them using script</p>
<p>I can put the spark-submit program in background,
but after lots of background java process created, the user corresponding to, will not able to run any other java process because JVM cannot create GC thread</p>
| <apache-spark><yarn> | 2016-05-13 02:39:07 | HQ |
37,200,465 | WebClient DownloadString UTF-8 not displaying international characters | <p>I attempt to save the html of a website in a string. The website has international characters (ę, ś, ć, ...) and they are not being saved to the string even though I set the encoding to be UTF-8 which corresponds to the websites charset.</p>
<p>Here is my code:</p>
<pre><code>using (WebClient client = new WebClient())
{
client.Encoding = Encoding.UTF8;
string htmlCode = client.DownloadString(http://www.filmweb.pl/Mroczne.Widmo);
}
</code></pre>
<p>When I print "htmlCode" to the console, the international characters are not shown correctly even though in the original HTML they are shown correctly. </p>
<p>Any help is appreciated. </p>
| <c#><html><encoding><utf-8><webclient> | 2016-05-13 02:50:35 | HQ |
37,201,084 | jquery - change input text to hidden field using button click event | <p>I want to change the current input text field to hidden when i click on the submit button, but I don't know how to do this in jquery. If anyone know how to do it, please answer below. Thank you so much.</p>
| <javascript><jquery><html> | 2016-05-13 04:08:54 | LQ_CLOSE |
37,201,168 | Can't solve the Javascript error | <p>I am writing a code in which if we hover over the pictures they will be seen in the div tag and also their alt text instead of the tag in div.
The HTML code is:</p>
<pre><code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Photo Gallery</title>
<link rel="stylesheet" href="css/gallery.css">
<script src = "js/gallery.js"></script>
</head>
<body>
<div id = "image">
Hover over an image below to display here.
</div>
<img class = "preview" alt = "Styling with a Bandana" src = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/389177/bacon.jpg" onmouseover = "upDate(this)" onmouseout = "unDo()">
<img class = "preview" alt = "With My Boy" src = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/389177/bacon2.JPG" onmouseover = "upDate(this)" onmouseout = "unDo()">
<img class = "preview" src = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/389177/bacon3.jpg" alt = "Young Puppy" onmouseover = "upDate(this)" onmouseout = "unDo()">
</body>
</html>
</code></pre>
<blockquote>
<p>Here is the CSS code:</p>
</blockquote>
<pre><code>body{
margin: 2%;
border: 1px solid black;
background-color: #b3b3b3;
}
#image{
line-height:650px;
width: 575px;
height: 650px;
border:5px solid black;
margin:0 auto;
background-color: #8e68ff;
background-image: url('');
background-repeat: no-repeat;
color:#FFFFFF;
text-align: center;
background-size: 100%;
margin-bottom:25px;
font-size: 150%;
}
.preview{
width:10%;
margin-left:17%;
border: 10px solid black;
}
img{
width:95%;
}
</code></pre>
<blockquote>
<p>The Javascript code is:</p>
</blockquote>
<pre><code>function upDate(previewPic){
/* In this function you should
1) change the url for the background image of the div with the id = "image"
to the source file of the preview image
2) Change the text of the div with the id = "image"
to the alt text of the preview image
*/
var urlString = 'url(previewPic.src)';
document.getElementById("image").style.backgroundImage = urlString;
document.getElementById("image").innerHTML = previewPic.alt;
}
function unDo(){
/* In this function you should
1) Update the url for the background image of the div with the id = "image"
back to the orginal-image. You can use the css code to see what that original URL was
2) Change the text of the div with the id = "image"
back to the original text. You can use the html code to see what that original text was
*/
var urlString = 'url(image)';
document.getElementById("image").style.backgroundImage = urlString;
document.getElementById("image").innerHTML = image.div;
}
</code></pre>
<p>I have to only know what's wrong with my Javascript code.I have used the debugger already and it's showing errors yet I cannot understand how to solve them.</p>
<p>All the things that need to be done has been given in the comments.When I hover over the picture the text inside the div is updated but it doesn't get undone when I hover outside the picture.And the picture doesn't get updated and undone.So if I could get any help.</p>
| <javascript><html><css> | 2016-05-13 04:17:45 | LQ_CLOSE |
37,201,506 | First row occurrence of each value | <p>I have two varaibles a and amount sorted by a</p>
<pre><code>a amount
112 12000
112 15000
113 14000
114 18000
114 17000
115 19000
115 17000
</code></pre>
<p>I want the first row occurrence of each value in a variable</p>
<pre><code>output
a amount
112 12000
113 14000
114 18000
115 19000
</code></pre>
| <r> | 2016-05-13 04:52:03 | LQ_CLOSE |
37,201,947 | i can't understand this piece of code. kindly any one help me for meaning of this piece of code. what is done bye this code | public static function is_isegment_nz_nc($string)
{
return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
}
| <wordpress><wordpress-theming><wordpress-thesis-theme> | 2016-05-13 05:36:19 | LQ_EDIT |
37,202,914 | Unit Testing on a c code which writes on files in a particular directory | <p>I've written a C code which takes a path to a directory and a string s.
After opening the directory, the code looks for files with a particular extension and write the string given as a second argument to the last line of these files and a \n after it.
This is all my function does (finding files with a particular extension and writing something at the end of the file).
The C code for the function is done but I need to write some tests for the function using Cunit and I don't have any Idea how to write them. I've just written down what I want to test (below) but I don't know how to write them using Cunit.
Can anyone help me with that?
Thanks</p>
<ul>
<li>check if the user checks if the string 's' is nULL => segmentation fault</li>
<li>check if bad address is given to the path argument of the function
when there is no ".extension" file </li>
<li>check if strcmp compares ".extension" and not "extension" </li>
<li>check if the user uses == instead of strcmp to compare the extension</li>
<li>check if the string 's' is written on a new line </li>
<li>check the size of the string 's' sent to write => sent without \0 by strlen and the type is size_t</li>
<li>check if the file is opened for writing (and not read only)</li>
<li>check if string 's' is converted to void* before giving it to write function </li>
<li>check if the return value of open ("fd") is checked </li>
<li>check if the return value of opening a directory is checked (null or not)</li>
<li>check if the return value of reading a directory is checked (null or not)</li>
<li>check if the extension is checked (the string 's' is not added to all the files with other extensions</li>
<li>check if the function ignores the '.' et '..' directories => DT_REG </li>
<li>check if the file is closed after being opened</li>
<li>check the return value of close </li>
<li>check if the directory is closed after being opened</li>
<li>check the return value of the directory</li>
</ul>
| <c><file><unit-testing><directory><cunit> | 2016-05-13 06:40:30 | LQ_CLOSE |
37,202,931 | php mysqli insert on dublicate | Greetings out there on the outerweb ;-)
Trying to make my life a little more easy, I descided to do a function for updating my tables with data.
I would like to have it done eg. like this:
$table = "ticket_stati";
$fields = array(`ticket_stati_id`, `locked_record`, `ticket_stati_name`, `ticket_stati_description`, `ticket_stati_color`);
$data = array(1, 1, 'Open', 'The ticket is marked as open and not assigned or acked.', '#130a5a');
// Call function
func_update_table($table, $fields, $data);
$data = array(2, 1, 'Assigned', 'The ticket has been assigned to a user or group', '#11a916');
func_update_table($table, $fields, $data);
But I am having trouble figuring out how the _INSERT INTO_ should be created to make sure that on dublicate (ON DUBLICATE) only the fields with **updateable data** are updated.
Any one. | <php><mysqli><sql-insert> | 2016-05-13 06:42:12 | LQ_EDIT |
37,202,951 | Corn Jobs not working | Corn Job dose not work, what m I doing wrong, my config.xml is below, I have 2 methods in my 'Kodework_Ongoing_Model_Observer' class.
The first method works perfectly on checkout, the cornjob method dose not produce any entry to my log, please help me out.
<!-- begin snippet: js hide: false -->
<!-- language: lang-html -->
<?xml version="1.0"?>
<config>
<modules>
<kodework_ongoing>
<version>0.1.0</version>
</kodework_ongoing>
</modules>
<frontend>
<routers>
<mymodule>
<use>standard</use>
<args>
<module>kodework_ongoing</module>
<frontName>ongoing</frontName>
</args>
</mymodule>
</routers>
<events>
<sales_order_place_before>
<observers>
<Kodework_Ongoing_Observer>
<type>singleton</type>
<class>Kodework_Ongoing_Model_Observer</class>
<method>ProcessOrder</method>
</Kodework_Ongoing_Observer>
</observers>
</sales_order_place_before>
</events>
<crontab>
<jobs>
<Kodework_Ongoing_corn>
<schedule><cron_expr>0 1 * * *</cron_expr></schedule>
<run><model>Ongoing/observer::DoSomething</model></run>
</Kodework_Ongoing_corn>
</jobs>
</crontab>
</frontend>
</config>
<!-- end snippet --> | <xml><magento> | 2016-05-13 06:43:32 | LQ_EDIT |
37,203,603 | how can i use perl to calculate the frequency of | PASS AC=0;AF=0.048;AN=2;ASP;BaseQRankSum=0.572;CAF=[0.9605,.,0.03949];CLNACC=RCV000111759.1,RCV000034730
I'm a newer.I want to know how to match CAF = [0.9605,.,0.03949] using regular expression,thank you | <perl> | 2016-05-13 07:17:53 | LQ_EDIT |
37,203,878 | JpaSpecificationExecutor JOIN + ORDER BY in Specification | <p>I have a query using a JOIN and ORDER BY and want to use it within my repository using the Criteria Api.</p>
<p>Here I found, how to wrap such a query into a CriteriaQuery (<a href="http://docs.oracle.com/javaee/6/tutorial/doc/gjivm.html" rel="noreferrer">Link</a>).</p>
<pre><code>CriteriaQuery<Pet> cq = cb.createQuery(Pet.class);
Root<Pet> pet = cq.from(Pet.class);
Join<Pet, Owner> owner = cq.join(Pet_.owners);
cq.select(pet);
cq.orderBy(cb.asc(owner.get(Owner_.lastName),owner.get(Owner_.firstName)));
</code></pre>
<p>On the other side, I found some examples to use the Criteria Api in Combination with a JpaRepository (<a href="http://www.cubrid.org/wiki_ngrinder/entry/how-to-create-dynamic-queries-in-springdata" rel="noreferrer">example</a>).</p>
<p>The Problem is that all methods in the repository expect a Specification:</p>
<pre><code>T findOne(Specification<T> spec);
</code></pre>
<p>which is always build like this:</p>
<pre><code>public static Specification<PerfTest> statusSetEqual(final Status... statuses) {
return new Specification<PerfTest>() {
@Override
public Predicate toPredicate(Root<PerfTest> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
return cb.not(root.get("status").in((Object[]) statuses));
}
};
}
</code></pre>
<p>So at one side I know how to create a CriteriaQuery, and on the other side I need a Specification which is build from a Predicate, and I can not figure out how to parse the CriteriaQuery into a Specification/Predicate.</p>
| <java><mysql><jpa><spring-data-jpa><criteria-api> | 2016-05-13 07:31:00 | HQ |
37,204,551 | Lldb : Setting conditional breakpoint with string equality as condition | <p>I would like to set a conditional breakpoint with lldb. This is usually done using <code>-c</code> option :</p>
<pre><code>breakpoint set -f myFile.cpp -l 123 -c 'a==3'
</code></pre>
<p>However, in my case I want to test if a <code>std::string</code> object is equal to a certain string value but doing this</p>
<pre><code>breakpoint set -f myFile.cpp -l 123 -c 'a=="hello"'
</code></pre>
<p>does not work… Lldb does not complain (while gdb would return an error) but it ignores the condition string upon reaching the breakpoint and breaks too early…</p>
<p>This question is similar to <a href="https://stackoverflow.com/questions/4183871/how-do-i-set-a-conditional-breakpoint-in-gdb-when-char-x-points-to-a-string-wh">this one</a> but with lldb instead of gdb. The solution presented there</p>
<pre><code>breakpoint set -f myFile.cpp -l 123 if strcmp(a, "hello")==0
</code></pre>
<p>does not seem to be valid with lldb</p>
<p>Lldb version used : 3.4</p>
| <breakpoints><lldb><conditional-breakpoint> | 2016-05-13 08:04:42 | HQ |
37,204,680 | ReactJS SetState not rerendering | <p>I have:</p>
<p>JobScreen</p>
<pre><code>handleSetView(mode, e) {
this.setState({
view: mode
});
console.log(this.state.view)
}
render() {
return (
<div className="jobs-screen">
<div className="col-xs-12 col-sm-10 job-list"><JobList view={this.state.view} /></div>
<div className="col-xs-12 col-sm-2 panel-container">
<div className="right-panel pull-right"><RightPanel handleSetView={this.handleSetView} /></div>
...
)
}
</code></pre>
<p>RightPanel</p>
<pre><code>render() {
return (
<div>
<div className="controls">
<span className="title">Views <img src="images\ajax-loader-bar.gif" width="24" id="loader" className={this.state.loading ? "pull-right fadeIn" : "pull-right fadeOut"}/></span>
<button onClick={this.props.handleSetView.bind(this, 'expanded')}><img src="/images/icons/32px/libreoffice.png" /></button>
<button onClick={this.props.handleSetView.bind(this, 'condensed')}><img src="/images/icons/32px/stack.png" /></button>
</div>
...
)}
</code></pre>
<p>JobList</p>
<pre><code>render() {
var jobs = [];
this.state.jobs.forEach((job) => {
jobs.push(
<Job key={job.id} job={job} view={this.props.view} loading={this.state.loading} toggleTraderModal={this.props.toggleTraderModal} toggleOFTModal={this.props.toggleOFTModal}/>
);
});
return (
<div>
{jobs}
</div>
);
};
</code></pre>
<p>The problem is, is that the changing of the view state does not rerender any of the child elements.</p>
<p>How can I get this to work?</p>
| <javascript><reactjs><fluxible> | 2016-05-13 08:12:04 | HQ |
37,204,749 | serial in postgres is being increased even though I added on conflict do nothing | <p>I'm using Postgres 9.5 and seeing some wired things here.</p>
<p>I've a cron job running ever 5 mins firing a sql statement that is adding a list of records if not existing.</p>
<pre><code>INSERT INTO
sometable (customer, balance)
VALUES
(:customer, :balance)
ON CONFLICT (customer) DO NOTHING
</code></pre>
<p>sometable.customer is a primary key (text)</p>
<p><strong><em>sometable structure is:</em></strong><br>
id: serial<br>
customer: text<br>
balance: bigint </p>
<p>Now it seems like everytime this job runs, the id field is silently incremented +1. So next time, I really add a field, it is thousands of numbers above my last value. I thought this query checks for conflicts and if so, do nothing but currently it seems like it tries to insert the record, increased the id and then stops.</p>
<p>Any suggestions?</p>
| <database><postgresql> | 2016-05-13 08:15:03 | HQ |
37,205,106 | How do I avoid that my App enters optimization on Samsung devices | <p>Smart manager kills an app that hasn't been used for 3 days. My app does some background work and hence, the user doesn't need to open it.</p>
<p>What can I do so that it doesn't enter app optimization mode ( Android OS 5.0.2, 5.1.1)</p>
| <android><android-5.0-lollipop><android-powermanager> | 2016-05-13 08:32:53 | HQ |
37,205,962 | IntelliJ: activate Maven profile when running Junit tests | <p>I have declared some properties that are specific to Maven profiles. A part of my pom.xml:</p>
<pre><code><profiles>
<profile>
<id>release</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<my.properties.file>foo.xml</my.properties.file>
</properties>
</profile>
<profile>
<id>ci</id>
<properties>
<my.properties.file>bar.xml</my.properties.file>
</properties>
</profile>
</profiles>
</code></pre>
<p>I encounter some problem to use the "ci" Maven profile when I start Junit tests via IntelliJ IDEA 2016.<br>
I activate my profile via the "Maven Projects" panel, then I start tests. The problem is the "my.properties.file" property value is equal to "foo.xml", not "bar.xml".</p>
<p>I have no problem with command-line (I can use the "-Pci" flag). How can I tell IntelliJ to use the "ci" profile? Thx.</p>
| <java><maven><intellij-idea><junit> | 2016-05-13 09:14:51 | HQ |
37,205,997 | NestedScrollView could not scroll with match_parent height child | <p>I implement NonSwipeableViewPager with a fragment has NestedScrollView like this, what I expect is that the scrollview can scroll up and show 2 textviews:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
layout="@layout/header" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_up" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 2" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</code></pre>
<p>But it could not scroll, I tried many ways but still did not get any solution</p>
| <android><android-nestedscrollview> | 2016-05-13 09:16:15 | HQ |
37,206,421 | jsonArray concatenate not working | Hi Friends I am trying to merge two json arrays i have tried concat and merge method but it's not giving the correct output please suggest something...
var set_image=[{"id":"aerobics"},{"id":"kick boxing"}]
var item_json=[{"id":"net ball"},{"id":"floor ball"}]
Merged Array
var finalArray =[{"id":"aerobics"},{"id":"kick boxing"},{"id":"net ball"},{"id":"floor ball"}]
Here is my javascript
var item = JSON.parse(localStorage.getItem("test"));
var item_json = JSON.stringify(item) ;
var page= <?php echo $json_value; ?>;
var set_image=JSON.stringify(page) ;
//var image=set_image.concat(item_json);
var image= $.concat(set_image, item_json)
window.location.href = "modal.php?ids=" + image;
| <javascript><jquery><json> | 2016-05-13 09:35:39 | LQ_EDIT |
37,207,170 | How to get the print as PDF result using jquery | <p>I would like to get the HTML page in the PDF.</p>
<p>After some studies I found the pdfJS plugin, it has some problem with bootstrap , the layout will be messy</p>
<p><a href="http://jsfiddle.net/5ud8jkvf/" rel="noreferrer">http://jsfiddle.net/5ud8jkvf/</a></p>
<p>here is the fiddle</p>
<p>I found the default print as PDF result is great </p>
<p><a href="https://i.stack.imgur.com/4rl3r.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4rl3r.png" alt="enter image description here"></a></p>
<pre><code>var doc = new jsPDF();
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
$('#cmd').click(function () {
doc.fromHTML($('#content').html(), 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});
doc.save('sample-file.pdf');
});
</code></pre>
<p>So , instead of fixing the problem for pdfJS, I wonder are there html / jquery way to get the pdf from the print as pdf.</p>
<p>The HTML need to convert to PDF is one page application form only, thanks a lot</p>
| <javascript><jquery><html><css><pdf> | 2016-05-13 10:07:04 | HQ |
37,207,475 | interpolation on shell script bash | I have a data file containing values of longitudes and latitudes (displayed on two columns) measured by a GPS along a profile at regular intervals. at a certain point on my profile, the GPS stopped working, hence in my data i have zeros instead of values of longitudes and latitudes. I want to interpolate between this fields to get values of longitudes and latitudes instead of zeros.
to be more clear here is a simple example of how my file looks like.
12 7
14 8
0 0
0 0
20 11
22 12
i want to interpolate where i got zeros. i am working on bash and i have no idea on how to do it | <bash><shell> | 2016-05-13 10:21:07 | LQ_EDIT |
37,207,762 | NSAttributedString tail truncation in UILabel | <p>I'm using <a href="https://github.com/michaelloistl/ContextLabel" rel="noreferrer">ContextLabel</a> to parse @ , # and URL's. This is the best solution i found, cause it sizes correctly and dont affect performance. It firstly parses string at input and than converts it to <code>NSAttributedString</code> and after this assigns it to <code>attributedText</code> property of <code>UILabel</code>. Everything works as expected, except tail truncation - it's very incorrect ( see pic below ) </p>
<p><a href="https://i.stack.imgur.com/w6rT0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/w6rT0.png" alt="enter image description here"></a></p>
<p>Where shall i start digging - is it wrong attributes on attributed string? Or label layout issue? Thanks! </p>
| <ios><swift><uilabel><nsattributedstring><hashtag> | 2016-05-13 10:34:32 | HQ |
37,208,043 | How to set OkHttpClient for glide | <p>I am using Glide to load images, the issue I'm facing is that when i run app on slow internet connection I'm getting <code>SocketTimeOutException</code>. So to solve this issue i want to use a custom <code>OkHttpClient</code> so that I can change the timeout of HttpClient this is the code i have. </p>
<pre><code>public class MyGlideModule implements GlideModule {
@Override
public void applyOptions(Context context, GlideBuilder builder) {
}
@Override
public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(15, TimeUnit.SECONDS);
client.setReadTimeout(15,TimeUnit.SECONDS);
OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory(client);
glide.register(GlideUrl.class, InputStream.class, factory);
}
}
</code></pre>
<p>but <code>OkHttpUrlLoader</code> is not there any more in Glide API. So i was wondering how can set the OkHttpClient for Glide </p>
| <android><android-glide> | 2016-05-13 10:47:41 | HQ |
37,208,587 | Fetch API - using response.json() throws an unexpected end of input error | <p>When using the Fetch API to fetch some JSON from a REST API on my local server and trying to parse the response with <code>response.json()</code>, I am receiving an <code>unexpected end of input</code> error.</p>
<p>The error is easily reproducible on my local server with the following one-liner:</p>
<pre><code>fetch(new Request('http://localhost:9950/RestService/v2/search/find/1', {mode: 'no-cors'})).then(function(response) { response.json(); });
// Output from Chrome console:
// Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}
// VM424:1 Uncaught (in promise) SyntaxError: Unexpected end of input
// at SyntaxError (native)
// at <anonymous>:1:128
</code></pre>
<p>If I view the Network tab, I can see that my request was fulfilled by the server, and if I preview the response I can see that there is valid JSON available there (I double-checked this by copying and pasting the JSON from the Network Response tab in to jsonlint.com). Here is a sample of the response I am getting from the server:</p>
<pre><code>{
"SearchMatches": [{
"Extracts": ["<b>1<\/b>.txt...", "<b>1<\/b>"],
"Title": "1.txt",
"Url": "C:\\TestShare4\\500Docs\\1.txt"
}]
}
</code></pre>
<p>If I try to use <code>response.text()</code> instead of <code>response.json()</code> I get an empty string.</p>
<p>Any thoughts on where I could be going wrong with this?</p>
<p>Note that I have a requirement to not depend on any other frameworks or libraries other than what is natively supported by the browser.</p>
| <json><fetch> | 2016-05-13 11:13:16 | HQ |
37,208,630 | sql connections | **
> Query 1: Results in 87 rows:
**
SELECT MIN(LEFT(Date_Last_Updated, 4)) AS Year_of_Transfer, MIN(RIGHT(LEFT(Date_Last_Updated, 6), 2)) AS Month_of_Transfer,
MIN(RIGHT(LEFT(Date_Last_Updated, 8), 2)) AS Day_of_Transfer, CRS, Loan_Code, MIN(Date_Last_Updated) AS Min_Date_Last_Updated
FROM dbo.Transfer_Final_Accounts_CO_SH
WHERE (LEFT(Date_Last_Updated, 4) >= '2016') AND (Subcategory = 'Transfer to Workout')
GROUP BY CRS, Loan_Code
ORDER BY Loan_Code
**
> Query two: Results in 3400000 rows:
**
SELECT Date_Last_Updated, SUM(NPL_Amount_Last_Quarter) AS NPL_Amount_Last_Quarter, Loan_Code, SUM([Total_Balance_€]) AS Total_Balance,
SUM(On_Balance_Amount_Last_Quarter) AS On_Balance_Last_Q, SUM([Off_Balance_Amount_€]) AS Off_Balance_Last_Q, CRS, [On_Balance_Amount_€],
[Off_Balance_Amount_€], [Total_Balance_€], NPL_Amount_Last_Quarter AS NPL_Amount_Last_Q, [NPL_Amount_€], On_Balance_Amount_Last_Quarter,
Material_Bucket, Material_Bucket_Last_Quarter
FROM dbo.Transfer_Final_Accounts_COM_WORK
GROUP BY CRS, Date_Last_Updated, Loan_Code, [On_Balance_Amount_€], [Off_Balance_Amount_€], [Total_Balance_€], NPL_Amount_Last_Quarter, [NPL_Amount_€],
On_Balance_Amount_Last_Quarter, Material_Bucket, Material_Bucket_Last_Quarter
**
> Query three: Connects the 2 above and results in 0 rows:
**
SELECT dbo.Transfer_to_Workout_Total_Balances.Total_Balance, dbo.Transfer_to_Workout_Total_Balances.On_Balance_Last_Q,
dbo.Transfer_to_Workout_Total_Balances.Off_Balance_Last_Q, dbo.Transfer_to_Workout_Total_Balances.NPL_Amount_Last_Quarter,
dbo.Transfer_to_workout_min_dates.Year_of_Transfer, dbo.Transfer_to_workout_min_dates.Month_of_Transfer,
dbo.Transfer_to_workout_min_dates.Day_of_Transfer, dbo.Transfer_to_workout_min_dates.CRS AS Expr1,
dbo.Transfer_to_workout_min_dates.Loan_Code AS Expr2, dbo.Transfer_to_workout_min_dates.Min_Date_Last_Updated,
dbo.Transfer_to_Workout_Total_Balances.[On_Balance_Amount_€], dbo.Transfer_to_Workout_Total_Balances.[Off_Balance_Amount_€],
dbo.Transfer_to_Workout_Total_Balances.[Total_Balance_€], dbo.Transfer_to_Workout_Total_Balances.[NPL_Amount_€],
dbo.Transfer_to_Workout_Total_Balances.NPL_Amount_Last_Q, dbo.Transfer_to_Workout_Total_Balances.On_Balance_Amount_Last_Quarter,
dbo.Transfer_to_Workout_Total_Balances.Material_Bucket, dbo.Transfer_to_Workout_Total_Balances.Material_Bucket_Last_Quarter
FROM dbo.Transfer_to_workout_min_dates INNER JOIN
dbo.Transfer_to_Workout_Total_Balances ON dbo.Transfer_to_workout_min_dates.Loan_Code = dbo.Transfer_to_Workout_Total_Balances.Loan_Code AND
dbo.Transfer_to_workout_min_dates.Min_Date_Last_Updated = dbo.Transfer_to_Workout_Total_Balances.Date_Last_Updated
What is wrong with the connections why am I not taking the results from the above?
| <sql><sql-server><tsql> | 2016-05-13 11:15:15 | LQ_EDIT |
37,209,270 | Unit test SparseArray using JUnit (using JVM) | <p>I have an implementation which is using a Integer as key in HashMap. It is already unit tested using JUnit. But I want to change it to SparseArray which is more optimised version from Android. I am not sure how will it be unit tested using JUnit. Does anyone have a better way to do this?</p>
| <android><unit-testing><junit> | 2016-05-13 11:45:49 | HQ |
37,209,271 | Error in Swift code | first time playing about with Xcode.
I get an error when trying to run my project, the error is as follows.
Type CGFLoat has no member "random"
var randomPosition = CGFloat.random (min: -200, max: 200)
wallPair.position.y = wallPair.position.y + randomPosition
wallPair.addChild(scoreNode)
thanks in advanced | <swift> | 2016-05-13 11:45:51 | LQ_EDIT |
37,209,375 | How to set a form as pristine? | <ul>
<li>The form that represents entity state is being edited (turns dirty)</li>
<li>The form is being submitted and entity state is now aligned with the form state which means that the form should now be set as pristine.</li>
</ul>
<p>How do we do that?
There was <code>$setPristine()</code> in ng1.
Btw, I'm talking about <code>ControlGroup</code> type of form.</p>
| <angular><angular2-forms> | 2016-05-13 11:51:34 | HQ |
37,209,686 | Doctrine - How to bind array to the SQL? | <p>My SQL looks something like this:</p>
<pre><code>$sql = "select * from user where id in (:userId) and status = :status";
$em = $this->getEntityManager();
$stmt = $em->getConnection()->prepare($sql);
$stmt->bindValue(':userId', $accounts, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
$stmt->bindValue(':status', 'declined');
$stmt->execute();
$result = $stmt->fetchAll();
</code></pre>
<p>But it returns:</p>
<blockquote>
<p>An exception occurred while executing (...) </p>
<p>with params
[[1,2,3,4,5,6,7,8,11,12,13,14], "declined"]</p>
<p>Notice: Array to string conversion</p>
</blockquote>
<p>I cannot user <code>queryBuilder</code> because my real SQL is more complicated (ex. contains joined select, unions and so on)</p>
| <php><pdo><doctrine-orm><symfony> | 2016-05-13 12:07:28 | HQ |
37,209,735 | Color picker in angular js | <p>I want to implement color picker in angular JS and below is the sample,</p>
<p><a href="http://screencast.com/t/A7q6rTN5e" rel="nofollow">http://screencast.com/t/A7q6rTN5e</a></p>
<p>Can anyone suggest how to implement this in angular js?</p>
| <angularjs> | 2016-05-13 12:10:08 | LQ_CLOSE |
37,209,879 | Using the class type of an object to create a new instance | <p>I call a method with the signature <code>save(Object o)</code> this way:</p>
<pre><code>EntityManager em = new EntityManager(); // My own EntityManager
User user = new User(); // Constructor provides values
em.save(user);
</code></pre>
<p>In the save-method I need to instantiate a new object, in this case it would be of type <code>User</code> this way: <code>User user = (User) o;</code></p>
<p>Well, so far I can extract the class of the object with <code>o.getClass()</code>, which delivers <code>class org.example.User</code>, which is <code>User.class</code> I guess. But I can't figure out how I could realize the line <code>User user = (User) o;</code> with that.</p>
| <java> | 2016-05-13 12:18:35 | LQ_CLOSE |
37,209,913 | How does `alias sudo="sudo "` work? | <p>Looking at ways to pass current user's aliases to a <code>sudo</code> command, I found the following <a href="https://wiki.archlinux.org/index.php/Sudo#Passing_aliases" rel="noreferrer">on ArchWiki</a>:</p>
<blockquote>
<h3>Passing aliases</h3>
<p>If you use a lot of aliases, you might have noticed that they do not
carry over to the root account when using sudo. However, there is an
easy way to make them work. Simply add the following to your
<code>~/.bashrc</code> or <code>/etc/bash.bashrc</code>:</p>
<p><code>alias sudo='sudo '</code></p>
</blockquote>
<p>I don't get why this works. If the shell does not care how many spaces are between two commands, how can this have any effect?</p>
<p>When manually adding a space, I see no difference:</p>
<pre><code>$ alias e=echo
$ sudo e foo
sudo: e: command not found
$ sudo e foo # Manual space addition
sudo: e: command not found # Fail
$ alias sudo="sudo " # Now with alias
$ sudo e foo
foo # Succeeds, but why?
</code></pre>
<p>Visibly aliasing sudo to sudo + space somehow allows passing aliases. This works on <code>zsh</code>, <code>bash</code> and <code>sh</code>, so it is not a shell-specific behavior. </p>
<h2>How does this alias work?</h2>
| <shell><sh><alias><sudo> | 2016-05-13 12:20:31 | HQ |
37,210,059 | How to add a typescript definition file to a npm package? | <p>Is there a way to add typescript definitions (<code>.d.ts</code> files) to a pure javascript project directly (e.g. in <code>package.json</code>). I can't find any documentation on that.</p>
| <typescript><npm> | 2016-05-13 12:26:46 | HQ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.