_id
stringlengths
2
6
partition
stringclasses
3 values
text
stringlengths
4
46k
language
stringclasses
1 value
title
stringclasses
1 value
d3701
train
This works without requiring an import: default_address = relationship('Address', secondary=ACC_ADD_TABLE, primaryjoin="acc.c.id==acc_add_rel.c.acc_id", secondaryjoin="and_(address.c.id==acc_add_rel.c.add_id, address.c.type=='default')", #uselist = True, ) If you are certain that there is only one default address, you might use uselist=True for convenience. Sometimes I prefer the other structure for such situations though: add a column to the Account table: default_address_id and build 1-[0..1] relationship based on this column, still checking that the referenced Address is also part of Account.addresses M-N relationship. On the side note, a typo: in your (commented) code you should use == instead of = in "Address.type='default'". This does not solve the problem though.
unknown
d3702
train
You cannot use multiple pattern characters in pattern rules. You can use a single pattern which will stand for the entire middle portion, then strip out the part you want like this: /data/%_output.txt : process.py data/%_input.txt python process.py $(*F)
unknown
d3703
train
#plus { /* change this value to the desired width */ --width: 40px; /* setting the background color */ background-color: black; /* setting height and width with the value of css variable */ width: var(--width); height: var(--width); /* perfect circle */ border-radius: var(--width); /* centrering */ display: grid; place-items: center; /* don't delete this, is important for the ::before and ::after pseudoelements */ position: relative; } #plus::before, #plus::after { content: ""; /* using css calc() https://developer.mozilla.org/en-US/docs/Web/CSS/calc */ /* height and width relative to css variable, change to what you feel is good */ height: calc(var(--width) / 1.5); width: calc(var(--width) / 5); /* coloring the pseudoelements */ background-color: white; /* here the TRICK, using calc() we easily canculate the rotation, without hardcoding this value */ transform: rotate(calc(var(--i) * 90deg)); /* important don't delete */ position: absolute; } #plus::before { --i: 1; } #plus::after { --i: 2; } <div id="plus"></div> this code is relative to the width of the element, so just change the width and all the elements inside will be changed automatically! #plus { --width: 5rem; /* change this value if you need */ } or here directly on your element (if you have multiple same buttons) <div id="plus" style="--width: 100px;"></div> for this I am using CSS variables, make sure to see this before https://developer.mozilla.org/en-US/docs/Web/CSS/var Example: * *smaller value *higher value: so now you can see, the div remain always the same as with big values the code: #plus { /* change this value to the desired width */ --width: 5rem; /* setting the background color */ background-color: black; /* setting height and width with the value of css variable */ width: var(--width); height: var(--width); /* perfect circle */ border-radius: var(--width); /* centrering */ display: grid; place-items: center; /* don't delete this, is important for the ::before and ::after pseudoelements */ position: relative; } #plus::before, #plus::after { content: ""; /* using css calc() https://developer.mozilla.org/en-US/docs/Web/CSS/calc */ /* height and width relative to css variable, change to what you feel is good */ height: calc(var(--width) / 1.5); width: calc(var(--width) / 5); /* coloring the pseudoelements */ background-color: white; /* here the TRICK, using calc() we easily canculate the rotation, without hardcoding this value */ transform: rotate(calc(var(--i) * 90deg)); /* important don't delete */ position: absolute; } #plus::before { --i: 1; } #plus::after { --i: 2; } <div id="plus"></div>
unknown
d3704
train
Since Android 10 my fake location app has the same issue and the app is crashing with: java.lang.IllegalArgumentException: Provider "gps" unknown But on older Android versions same code is working. I tested it on 6,7,8 and 9. My temporary solution for it is to catch the exception (until I find a better way). The mock should still work. try { mLocationManager.removeTestProvider(getBestProvider()); } catch (IllegalArgumentException e) { // handle the error e.getMessage() } Druing debugging I can see the provider gps inside the locationManager list like mLocationManager.getProvider(getBestProvider())
unknown
d3705
train
Following @Gagravarr suggestion, I realised the problem was from mixing two versions of the Apache POI library. There seems to be comflict while trying to build the project. After some digging around the web, I came across a far more simple solution https://github.com/SUPERCILEX/poi-android (written in Kotlin). I just added the maven repository, dependencies and System.setProperties. Then, android studio downloaded the need libraries.
unknown
d3706
train
After long list of ideas I finally found the reason of that strange behavior. It might help anybody with similar problem. In this project I subclass UITableViewCell. Since all cells could be of different size, I provide correct height in tableView: heightForRowAtIndexPath: method. HOWEVER, in my custom cell init method I didn't set proper autoresizing mask. That lead to UITableViewCellContenView view had constant height of 44pt. And this view is a superview for all cell content. I don't know why despite of it all cell content was displayed correctly and with proper sizes, but all gestures reached imageView only within this 44pt height area. Setting self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; in custom UITableViewCell init method I solved this issue.
unknown
d3707
train
I figured out the issue - the deep link events were getting fired, but the problem was the value of result.screenId changes for each screen every time the tabs are reloaded. So, in my deeplink handlers, instead of checking statically for a particular ID, I checked if the event.payload was == this.props.navigator.screenInstanceID, both variables which will of course match even if the ID's change, which is all that matters. Hope this is useful for others trying to use React Native Navigation to create a side-drawer tab based app.
unknown
d3708
train
How can I find all instances of the function Replace( in my application, but not the extension method .Replace(? You need to use a regex with a negative lookbehind: (?<!\.)Replace\( ^^^^^^^ The (?<!\.) lookbehind will invalidate all matches of Replace( that are immediately preceded with a .. If you want to match Replace( that are only preceded with whitespace, use (?<!\S)Replace\(, the (?<!\S) will require either a whitespace or start of string before Replace(. Since the ( and . are special regex metacharacters, they must be escaped with \. See the regex demo.
unknown
d3709
train
The specific issue is that thread->create is failing to create a thread and so it is returning undef. You should check the value of thr before calling detach if you want your code to be more robust.
unknown
d3710
train
run the command through command prompt maybe and then pipe your results out to read them? something like dir /s /b /o:gn Gives you all sub files etc in a root directory you can use that to pipe your answer into something readable or stdout it direct into a variable in your code if you can. A: Zip Parent folder by using 7z commands or simply by Blueprism Zip Folder action and Use 7z Commands to extract recursive and relocate to single outputpath folder. 7zip tool is free of cost and usually every other organisation has these Tools. Use recursive commands (X) of extraction and set the output path to a single location. 7z will do all the recursive fetching. https://7ziphelp.com/7zip-command-line
unknown
d3711
train
I created a Custom View class that will do what you want. There are four custom attributes that can be set in your layout xml: * *fillColor, color - Sets the color of the fill area. Default is Color.WHITE. *strokeColor, color - Sets the color of the bounding circle. Default is Color.BLACK. *strokeWidth, float - Sets the thickness of the bounding circle. Default is 1.0. *value, integer: 0-100 - Sets the value for the fill area. Default is 0. Please note that these attributes must have the custom prefix in lieu of the android prefix in your layout xml. The root View should also contain the custom xml namespace. (See the example below.) The other standard View attributes - such as layout_width, background, etc. - are available. First, the CircleFillView class: public class CircleFillView extends View { public static final int MIN_VALUE = 0; public static final int MAX_VALUE = 100; private PointF center = new PointF(); private RectF circleRect = new RectF(); private Path segment = new Path(); private Paint strokePaint = new Paint(); private Paint fillPaint = new Paint(); private int radius; private int fillColor; private int strokeColor; private float strokeWidth; private int value; public CircleFillView(Context context) { this(context, null); } public CircleFillView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.getTheme().obtainStyledAttributes( attrs, R.styleable.CircleFillView, 0, 0); try { fillColor = a.getColor(R.styleable.CircleFillView_fillColor, Color.WHITE); strokeColor = a.getColor(R.styleable.CircleFillView_strokeColor, Color.BLACK); strokeWidth = a.getFloat(R.styleable.CircleFillView_strokeWidth, 1f); value = a.getInteger(R.styleable.CircleFillView_value, 0); adjustValue(value); } finally { a.recycle(); } fillPaint.setColor(fillColor); strokePaint.setColor(strokeColor); strokePaint.setStrokeWidth(strokeWidth); strokePaint.setStyle(Paint.Style.STROKE); } public void setFillColor(int fillColor) { this.fillColor = fillColor; fillPaint.setColor(fillColor); invalidate(); } public int getFillColor() { return fillColor; } public void setStrokeColor(int strokeColor) { this.strokeColor = strokeColor; strokePaint.setColor(strokeColor); invalidate(); } public int getStrokeColor() { return strokeColor; } public void setStrokeWidth(float strokeWidth) { this.strokeWidth = strokeWidth; strokePaint.setStrokeWidth(strokeWidth); invalidate(); } public float getStrokeWidth() { return strokeWidth; } public void setValue(int value) { adjustValue(value); setPaths(); invalidate(); } public int getValue() { return value; } private void adjustValue(int value) { this.value = Math.min(MAX_VALUE, Math.max(MIN_VALUE, value)); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); center.x = getWidth() / 2; center.y = getHeight() / 2; radius = Math.min(getWidth(), getHeight()) / 2 - (int) strokeWidth; circleRect.set(center.x - radius, center.y - radius, center.x + radius, center.y + radius); setPaths(); } private void setPaths() { float y = center.y + radius - (2 * radius * value / 100 - 1); float x = center.x - (float) Math.sqrt(Math.pow(radius, 2) - Math.pow(y - center.y, 2)); float angle = (float) Math.toDegrees(Math.atan((center.y - y) / (x - center.x))); float startAngle = 180 - angle; float sweepAngle = 2 * angle - 180; segment.rewind(); segment.addArc(circleRect, startAngle, sweepAngle); segment.close(); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawPath(segment, fillPaint); canvas.drawCircle(center.x, center.y, radius, strokePaint); } } Now, for the custom xml attributes to work, you will need to put the following file in the /res/values folder of your project. attrs.xml: <resources> <declare-styleable name="CircleFillView" > <attr name="fillColor" format="color" /> <attr name="strokeColor" format="color" /> <attr name="strokeWidth" format="float" /> <attr name="value" format="integer" /> </declare-styleable> </resources> Following are the files for a simple demonstration app, where the CircleFillView's value is controlled with a SeekBar. The layout file for our Activity, main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res/com.example.circlefill" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" > <com.example.circlefill.CircleFillView android:id="@+id/circleFillView" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#ffffff" custom:fillColor="#6bcae2" custom:strokeColor="#75b0d0" custom:strokeWidth="20" custom:value="65" /> <SeekBar android:id="@+id/seekBar" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> And, the MainActivity class: public class MainActivity extends Activity { CircleFillView circleFill; SeekBar seekBar; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); circleFill = (CircleFillView) findViewById(R.id.circleFillView); seekBar = (SeekBar) findViewById(R.id.seekBar); seekBar.setProgress(circleFill.getValue()); seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) circleFill.setValue(progress); } @Override public void onStartTrackingTouch(SeekBar seekBar) {} @Override public void onStopTrackingTouch(SeekBar seekBar) {} } ); } } And a screenshot of the demo app:
unknown
d3712
train
Here are my findings :- * *I went through the advice of Amos M. Carpenter and searched for the source code of the plugin that I have written. *After that, I did a debug (Plugin Debug) and searched for the methods that are called when we create a project from the Eclipse menu. *I took a note of all those class files and their methods that are called and the information/parameters they need for further processing. *I initiated the same call through ANT and was able to do what I wanted. Thank you for the support. P.S - I can't share my Plugin details as it is written for an organisation.
unknown
d3713
train
You can use the 'url.exists' function from `RCurl` require(RCurl) u <- paste('http://en.wikipedia.org/wiki/', sep = '', towns[,'name'], ',_', towns[,'state']) > sapply(u, url.exists) http://en.wikipedia.org/wiki/Balgal_Beach,_Queensland TRUE http://en.wikipedia.org/wiki/Balhannah,_South_Australia TRUE http://en.wikipedia.org/wiki/Ballan,_Victoria TRUE http://en.wikipedia.org/wiki/Yunderup,_Western_Australia TRUE A: Here's another option that uses the httr package. (BTW: you don't need RJSONIO). Replace your wiki.tables(...) function with this: wiki.tables <- function(towns) { require(httr) require(XML) get.HTML<- function(url){ resp <- GET(url) if (resp$status_code==200) return(htmlParse(content(resp,type="text"))) } u <- paste('http://en.wikipedia.org/wiki/', sep = '', towns[,1], ',_', towns[,2]) res <- lapply(u, get.HTML) res <- res[sapply(res,function(x)!is.null(x))] # remove NULLs tabs <- lapply(sapply(res, getNodeSet, path = '//*[@class="infobox vcard"]') , readHTMLTable) return(tabs) } This runs one GET request and tests the status code. The disadvantage of url.exists(...) is that you have to query every url twice: once to see if it exists, and again to get the data. Incidentally, when I tried your code the Yunderup url does in fact exist ??
unknown
d3714
train
I don't think there is a gem to do that, but it should be pretty simple to code: * *Add remaining_visits to your User model and table. *Do current_user.update(remaining_visits: current_user.remaining_visits+10) when a ticket is purchased. *Copy Devise sessions controller into app/controllers/devise/sessions_controller.rb. *Inside this controller, add this kind of code to create (where the user logs in): current_user.update(remaining_visits: current_user.remaining_visits-1). Note: Instead of copying Devise sessions controller you can just overwrite the create action.
unknown
d3715
train
Here is a link to the countries and currencies supported by the PayPal REST Payment API: https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/
unknown
d3716
train
There isn't a great solution at the moment, but I hope to have one in the next major release. What you can do, is create your own math using the Susy functions (really the most powerful part of Susy). Something like this: .left-column { @include box-sizing(border-box); float: left; width: columns(2) + gutter()/2; padding-right: gutter()/2; margin-right: gutter()/2; border-right: 1px solid; }
unknown
d3717
train
it doesn't, C "strings" are just an assumption about arrays ( that they have a 0 somewhere indicating the end of the string) There is no type "string" in C, just libraries which deal with char arrays with the above assumption. It is completely up to the library functions to manage the arrays and work out when to terminate them if needed. Quite often these functions don't respect what memory was actually allocated for the array, it will assume there's enough allocated space for whatever it's doing It would be entirely possible to use pascal type strings in C and write a string library using that convention if one wished. A: C doesn't know the difference between a char[] or char* which is a string and a char[] or char* which isn't a string. The only place where C will add a nul terminator is when you use a string literal. const char x[] = "Hello, world!"; // ^ plus terminator, sizeof=14 const char *y = "Hello, world!"; // ^ plus terminator You can just as easily create an array without a terminator: const char x[] = {'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!'}; // ^ NO terminator // sizeof=13 Okay, maybe not "just as easily", it's a fair bit of extra typing. But you can see the point: it's the fact that you used double quotes "..." that added the nul terminator. Certain library functions will also give you nul terminators, like strcpy or snprintf.
unknown
d3718
train
Try this- it('some text', async(async() => { spyOn(component, 'onBLCChanged'); // first round of change detection fixture.detectChanges(); // get ahold of the input let input = debugElement.query(By.css('#blc')); let inputElement = input.nativeElement; //set input value inputElement.value = 'test'; // save event object so that you can do comparison. const event = new Event('change'); inputElement.dispatchEvent(event); expect(component.onBLCChanged).toHaveBeenCalledWith(event); })); A: Try this: it('some text', async(async() => { const spyOnFunction = spyOn(component, 'onBLCChanged'); // first round of change detection fixture.detectChanges(); // get ahold of the input let input = debugElement.query(By.css('#blc')); let inputElement = input.nativeElement; //set input value inputElement.value = 'test'; inputElement.dispatchEvent(new Event('change')); expect(spyOnFunction).toHaveBeenCalled(); }));
unknown
d3719
train
You could use Boost.Foreach: //Using Xeo's example: BOOST_FOREACH (auto& e, values) { std::cout << e << " "; } A: One way would be to replace them with std::for_each and lambdas, where possible. GCC 4.6 and MSVC10 both support lambda expressions. // before: for(auto& e : values){ std::cout << e << " "; } // after: std::for_each(values.begin(), values.end(), [](a_type& e){ std::cout << e << " "; }); The only caveat is that you need to actually type the element name (a_type here), and that you can't use control flow structures (break, continue, return). Another way would be, when you need those control flow structures, to use old-style for-loops. Nothing wrong with them, especially with auto to infer the iterator type. Yet another way might be to use the Visual Studio 11 beta when it's out, it supports range-based for loops IIRC. :) A: You don't have to use boost. Here's a simple macro for backwards compatibility with vs2010: // 1600 is VS2010 #if _MSC_VER == 1600 #define FOR_EACH(var , range) for each(var in range) #else #define FOR_EACH(var , range) for (var : range) #endif Use it like this: FOR_EACH(auto& e, values) { std::cout << e << " "; } A: You can use for each itself for each (auto value in values) { std::cout << value << endl; }
unknown
d3720
train
EDIT: This code jumps around to a lot of places when we could just make it very linear. function SearchText(query) { return new Promise((resolve, reject) => { MongoClient.connect(url, (err, db) => { if (err) throw err; var dbo = db.db("FunLibsTest"); dbo.collection("texts").find(query).toArray((err, result) => { if (err) reject(err); db.close(); resolve(result); }); }); }) } Then to use the function app.get("/search/:query", (req, res, next) => { SearchText(req.params.query).then((results) => { res.status(200); res.json(results); }); });
unknown
d3721
train
No. You're limited to using the .NET Compact Framework on the XBOX 360. This will not include WPF. In fact, you're limited to the XBOX 360's implementation of the Compact Framework, which is built off the .NET 2.0 Compact Framework. This means that any .NET 3.0/3.5 specific classes will not work. MSDN lists the entire collection of the supported namespaces, types, and members for the XBOX 360.
unknown
d3722
train
Another possibility would be to call it Proxy. Decorator and Proxy are technically very similar - the difference is - in most cases - not a technical one but based on the intention. Your example is a little bit minimal and therefore it is hard to guess the intention correctly. Edit At the detailed level: Screen and SubScreen do not share any code. If you start adding methods to both implementations and the common interface AddComponents you might find * *that you must duplicate code both in Screen and SubScreen (or delegate to Screen) and *that you must add methods to AddComponents which make this interface badly named. If both screen classes are similar both on the abstract logical level and at the implementation level, then a an class AbstractScreen with two derived classed would be better. To bring back pattern speak: Use a Factory Method in AbstractScreen to specialize the behaviour regarding the different buttons. On your current code there is one strange thing: Why is there a method addButton defined anyway? Simply add the buttons in the appropriate constructor, since the user has to call addButtons in any case and the method does not have arguments. Another point not explained is this: SubScreen has a reference to Screen which is not used. Why? Will there be more method in all involved classes Screen, SubScreen and AddComponents? Will each method be a in SubScreen delegate to Screen or only half of them? You see - there are many possibilities we do not know and are not shown in the example code but are very important. I'm sure that your head contains a lot of details saying "This proposed stuff will not work because I want to do this and that one way or the other in the near future." Sadly we cannot get the content of your head into this site without more writing. :-)
unknown
d3723
train
First check if the column names of the table exist in the matrix Check this link If it exists, just set the value as usual.
unknown
d3724
train
https://wordpress.org/support/article/resetting-your-password/ This article will probably be your best bet. While it holds all the information. I highly recommend either going down the route of wp-cli or direct to the database. For MySQL this will effectively change the password for you UPDATE wp_options SET user_pass=MD5('newpass') WHERE user_login = <username>; However, for wp-cli you can run this wp-cli user update <username> --user_pass=<newpass> Overall wp-cli is the best option because it has tooling to solve so many other problems too! Good luck out there. A: Below article will set a resetting your password, and you can go to wp_users and edit your account pass https://wordpress.org/support/article/resetting-your-password/
unknown
d3725
train
FastReport cannot display records only where SHIP_DATE is NULL, because your query shouldn't be returning them based on your WHERE clause if Date1 and Date2 are properly assigned. This means that either your dataset and the FastReport aren't connected properly or that something in your code assigning the date values for the BETWEEN clause is wrong, and the dates aren't being provided to the query correctly. The first place to start looking is to make sure that all of the report columns are correctly assigned the proper TfrxDataSet and the proper database column. (Click on the report item (text object or whatever it might be), and check its DataSet and DataField properties to ensure they are correct.) If that's not the problem, it may be the way you're building your query, which probably isn't correctly formatting the dates for ADO. (You're just using whatever format happens to pass the StrToDate calls without raising an exception.) The way you're setting up your SQL is really unadviseable. It's unreadable and unmaintainable when you try to manage quoting yourself in code. You should use parameters, which first and foremost protects you against SQL injection, but also allows the database driver to properly format quoted values and dates for you and keeps things readable. (You can also use readable names for the parameters, so that when you see them six months from now you'll know what they mean.) var // Your other variable declarations here StartDate, EndDate: TDateTime; begin Date1 := InputBox(Whatever); try StartDate := StrToDate(Date1); except // Handle EConvertError end; Date2 := InputBox(Whatever); try EndDate := StrToDate(Date2); except // Handle EConvertError end; sql_str := 'SELECT * FROM JOB_DATA J'#13 + 'INNER JOIN CUSTOMER C'#13 + 'ON J.CUST_CODE = C.CUST_CODE'#13 + 'WHERE J.SHIP_DATE BETWEEN :StartDate AND :EndDate'; with ADOQuery5 do begin Close; // No need to clear. If you're using the same query more than once, // move the SQL assignment and the Parameter.DataType somewhere // else, and don't set them here. // The query can be reused just by closing, changing parameter values, // and reopening. SQL.Text := sql_str; with Parameters.ParamByName('StartDate') do begin DataType := ftDate; Value := StartDate; end; with Parameters.ParamByName('EndDate') do begin DataType := ftDate; Value := EndDate; end; Open; end; frxReport2.ShowReport; end; A: When I start having problems with ADO, I log the information. You'll need to create your own logger...but here's the jest of it...Note it will log the parameter values that are being passed to the query, including the SQL. procedure TLogger.SetUpConnectionLogging(aParent: TComponent); var a_Index: integer; begin for a_Index := 0 to aParent.ComponentCount - 1 do if aParent.Components[a_Index] is TAdoConnection then begin TAdoConnection(aParent.Components[a_Index]).OnWillExecute := WillExecute; TAdoConnection(aParent.Components[a_Index]).OnExecuteComplete := ExecuteComplete; end; end; procedure TLogger.ExecuteComplete(Connection: TADOConnection; RecordsAffected: Integer; const Error: Error; var EventStatus: TEventStatus; const Command: _Command; const Recordset: _Recordset); var a_Index: integer; begin AddLog('AdoConnection ExecuteComplete', True); AddLog('Execution In MilliSeconds', IntToStr(MilliSecondsBetween(Time, FDif))); AddLog('Execution In Seconds', IntToStr(SecondsBetween (Time, FDif))); AddLog('Execution In Minutes', IntToStr(MinutesBetween (Time, FDif))); AddLog('CommandText', Command.CommandText); if Assigned(Command) then begin AddLog('Param Count', IntToStr(Command.Parameters.Count)); for a_Index := 0 to Command.Parameters.Count - 1 do begin AddLog(Command.Parameters.Item[a_Index].Name, VarToWideStr(Command.Parameters.Item[a_Index].Value)); end; AddLog('CommandType', GetEnumName(TypeInfo(TCommandType),Integer(Command.CommandType))); end; AddLog('EventStatus', GetEnumName(TypeInfo(TEventStatus),Integer(EventStatus))); if Assigned(RecordSet) then begin AddLog('CursorType', GetEnumName(TypeInfo(TCursorType),Integer(Recordset.CursorType))); AddLog('LockType', GetEnumName(TypeInfo(TADOLockType),Integer(Recordset.LockType))); end; AddLog('RecordsAffected', IntToStr(RecordsAffected)); AddLog('AdoConnection ExecuteComplete', False); end; procedure TLogger.WillExecute(Connection: TADOConnection; var CommandText: WideString; var CursorType: TCursorType; var LockType: TADOLockType; var CommandType: TCommandType; var ExecuteOptions: TExecuteOptions; var EventStatus: TEventStatus; const Command: _Command; const Recordset: _Recordset); begin AddLog('Connection WillExecute', True); AddLog('Connection Name', Connection.Name); AddLog('CommandText', CommandText); AddLog('CommandType', GetEnumName(TypeInfo(TCommandType),Integer(CommandType))); AddLog('EventStatus', GetEnumName(TypeInfo(TEventStatus),Integer(EventStatus))); AddLog('CursorType', GetEnumName(TypeInfo(TCursorType),Integer(CursorType))); AddLog('Connection WillExecute', False); FDif := Time; end;
unknown
d3726
train
You should instead use: textInputLayout.setEndIconMode(TextInputLayout.END_ICON_PASSWORD_TOGGLE) Docs for setEndIconMode Docs for END_ICON_PASSWORD_TOGGLE A: https://developer.android.com/reference/com/google/android/material/textfield/TextInputLayout#getEndIconMode() Here you can see the information about the new method for hiding / showing text
unknown
d3727
train
Like CORBA, Thrift has developped a neutral language. As shown in this tutorial, you have to compile the .thrift file with thrift -r --gen java YourFile.Thrift After that you have to implement the client calls.
unknown
d3728
train
for dynamic key and value: my_dict = {'Folder': ['2021-03-12_020000', '2021-03-12_020000', '2021-03-12_020000'], 'Filename': ['2021-03-12_020000-frame79.jpg', '2021-03-12_020000-frame1.jpg', '2021-03- 12_020000-frame39.jpg'], 'Labeler': ['Labeler 2', 'Labeler 2', 'Labeler 1']} new_dict = {} for key in my_dict: for idx, value in enumerate(my_dict[key]): if idx not in new_dict: new_dict[idx] = [(key,value)] else: new_dict[idx].append((key,value)) new_list = [] for key,value in new_dict.items(): new_list.append(dict(value)) print(new_list) output [{'Folder': '2021-03-12_020000', 'Filename': '2021-03-12_020000-frame79.jpg', 'Labeler': 'Labeler 2'}, {'Folder': '2021-03-12_020000', 'Filename': '2021-03-12_020000-frame1.jpg', 'Labeler': 'Labeler 2'}, {'Folder': '2021-03-12_020000', 'Filename': '2021-03- 12_020000-frame39.jpg', 'Labeler': 'Labeler 1'}] A: You can use zip for the task: my_dict = { "Folder": ["2021-03-12_020000", "2021-03-12_020000", "2021-03-12_020000"], "Filename": [ "2021-03-12_020000-frame79.jpg", "2021-03-12_020000-frame1.jpg", "2021-03-12_020000-frame39.jpg", ], "Labeler": ["Labeler 2", "Labeler 2", "Labeler 1"], } final_list = [ {"Folder": a, "Filename": b, "Labeler": c} for a, b, c in zip( my_dict["Folder"], my_dict["Filename"], my_dict["Labeler"] ) ] print(final_list) Prints: [ { "Folder": "2021-03-12_020000", "Filename": "2021-03-12_020000-frame79.jpg", "Labeler": "Labeler 2", }, { "Folder": "2021-03-12_020000", "Filename": "2021-03-12_020000-frame1.jpg", "Labeler": "Labeler 2", }, { "Folder": "2021-03-12_020000", "Filename": "2021-03-12_020000-frame39.jpg", "Labeler": "Labeler 1", }, ] A: Here is code assuming all items are inter related. my_dict = {'Folder': ['2021-03-12_020000', '2021-03-12_020000', '2021-03-12_020000'], 'Filename': ['2021-03-12_020000-frame79.jpg', '2021-03-12_020000-frame1.jpg', '2021-03- 12_020000-frame39.jpg'], 'Labeler': ['Labeler 2', 'Labeler 2', 'Labeler 1']} result_dict = [] for i, (folder, filename, labler) in enumerate(zip(my_dict['Folder'], my_dict['Filename'], my_dict['Labeler'])): result_dict.append({"Folder":folder,'Filename':filename,"Labeler":labler }) print(result_dict) output: [ { "Folder": "2021-03-12_020000", "Filename": "2021-03-12_020000-frame79.jpg", "Labeler": "Labeler 2" }, { "Folder": "2021-03-12_020000", "Filename": "2021-03-12_020000-frame1.jpg", "Labeler": "Labeler 2" }, { "Folder": "2021-03-12_020000", "Filename": "2021-03- 12_020000-frame39.jpg", "Labeler": "Labeler 1" } ]
unknown
d3729
train
I think it makes sense to focus on DSLs following a Software Product Line approach. If you define the DSL correctly, it will essentially define a framework for creating applications within in a domain and an operating environment in which they execute in. By operating environment, I mean the OS, hardware, and database, as well as the code that implements the semantics or run time environment of the DSL. The framework and operating environment will be the artifacts that get reused across product lines. You may have to create an operating environment that consists of run time environments for multiple DSLs to support multiple product lines. A: Our DMS Software Reengineering Toolkit is exactly this idea. DMS provides generic parsing, tree building, analyzes (name resolution, control flow anlaysis, data flow analyis, call graphs and points-to analysis, custom analyzers, arbitrary transformations). It has a variety of legacy language front ends, as well as some DSLs (e.g., HTML, XML, temporal logic equations, industrial controller languages, ...) off-the-shelf, but has very good support for defining other DSLs. We use DMS both to build custom analyzers and transformation tools, but also as product-line generator. For example, we provide test coverage, profilers, smart differencers, and clone detections for a wide variety of languages... because DMS makes this possible. Yes, this lowers our dev and maintenance costs because each of these tool types uses DMS directly as a foundation. Fundamentally, it allows the amortization of language parsers, analyzers and transformers not only across specific languages, but across dialects of those languages and even different languages.
unknown
d3730
train
You can create .xml layouts for when the phone is placed horizontal or vertical. To create a horizontal layout, simply create a new .xml file and check that you would like the layout to be horizontal.
unknown
d3731
train
Zend Framework 1 doesn't use psr-4 autoloading, it uses psr-0: "autoload": { "psr-0": { "Zend_": "vendor/zendframework/zendframework1/library" } }
unknown
d3732
train
You're just lucky :) Compiling with clang++ my output is not always 500: 500 425 470 500 500 500 500 500 432 440 A: Note Using g++ with -fsanitize=thread -static-libtsan: WARNING: ThreadSanitizer: data race (pid=13871) Read of size 4 at 0x7ffd1037a9c0 by thread T2: #0 Counter::increment() <null> (Test+0x000000509c02) #1 main::{lambda()#1}::operator()() const <null> (Test+0x000000507ed1) #2 _M_invoke<> /usr/include/c++/5/functional:1531 (Test+0x0000005097d7) #3 operator() /usr/include/c++/5/functional:1520 (Test+0x0000005096b2) #4 _M_run /usr/include/c++/5/thread:115 (Test+0x0000005095ea) #5 <null> <null> (libstdc++.so.6+0x0000000b8c7f) Previous write of size 4 at 0x7ffd1037a9c0 by thread T1: #0 Counter::increment() <null> (Test+0x000000509c17) #1 main::{lambda()#1}::operator()() const <null> (Test+0x000000507ed1) #2 _M_invoke<> /usr/include/c++/5/functional:1531 (Test+0x0000005097d7) #3 operator() /usr/include/c++/5/functional:1520 (Test+0x0000005096b2) #4 _M_run /usr/include/c++/5/thread:115 (Test+0x0000005095ea) #5 <null> <null> (libstdc++.so.6+0x0000000b8c7f) shows the race condition. (Also, on my system the output shows results different than 500). The options for g++ are explained in the documentage for g++ (e.g.: man g++). See also: https://github.com/google/sanitizers/wiki#threadsanitizer. A: Just because your code has race conditions does not mean they occur. That is the hard part about them. A lot of times they only occur when something else changes and timing is different. here are several issues: incrementing to 100 can be done really fast. So your threads may be already halfway done before the second one is started. Same for the next thread etc. So you never know you have really 5 in parallel. You should create a barrier at the beginning of each thread to make sure they start all at the same time. Also maybe try a bit more than "100" and only 5 threads. But it all depends on the system / load / timing. etc. A: to increase probability of race condition i increased the loop count but still couldn't see any varying output Strictly speaking you have data race in this code which is Undefined Behavior and therefore you cannot reliably reproduce it. But you can rewrite Counter to some "equivalent" code with artificial delays in increment: struct Counter { int value; Counter() : value(0){} void increment(){ int val=value; std::this_thread::sleep_for(std::chrono::milliseconds(1)); ++val; value=val; } }; I've got the following output with this counter which is far less than 500: 100 100 100 100 100 101 100 100 101 100
unknown
d3733
train
I try and stick to rule, keep your member variables private, if you need to change them or access them once the object is created, use a public get / set function. e.g: int complex::GetReal() const { return m_real; } void complex::SetReal(const int i) { m_real = i; }
unknown
d3734
train
Maybe in the initialize function within your view you can have a listenTo with the render. Something like that: var view = Backbone.View.extend({ className: 'list-container', template: _.template($('#my-template').html()), initialize: function () { this.listenTo(this, 'render', function () { console.info('actions'); }); }, render: function() { this.$el.html(this.template(this)); return this; }, }); And then: var myView = new view(); myView.render(); myView.trigger('render'); $('#container').html(myView.el); A: var View = Backbone.View.extend({ events: { 'render .myselector': 'playerRendered' }, playerRendered: function( e ) { console.log("arguments"); var playerValue = e.currentTarget.getAttribute( 'value' ); // HERE: e.currentTarget I've particular player }, render:function(){ console.log("render"); this.$el.html("<div class='myselector'></div>"); } }); var view = new View(); view.render(); and you can trigger with Jquery trigger this.$(".myselector").trigger("render"); or outside your view view.$(".myselector").trigger("render");
unknown
d3735
train
After looking at Content Security Policy allow inline style without unsafe-inline it appears this isn't supported, perhaps because the spec seems to imply that it is referring only to inline styles in a <style> tag, similar how the spec refers to inline scripts in a <script> tag. Assuming that is correct, it looks like I'll have to go the hash route or add 'unsafe-inline' just for style-src.
unknown
d3736
train
This is because when a UIScrollView (UITableView's superclass) is scrolling, it changes its runloop in order to prioritize the scrollView over whatever the application was doing. This is happening to make sure scrolling is as smooth as it can be. try using this version of delayed method: - (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay inModes:(NSArray *)modes; for the modes, I'd suggest starting with an array that contains the following: [[NSRunloop currentRunLoop] currentMode], NSDefaultRunLoopMode
unknown
d3737
train
if you want to autosubmit say button 2 then you would want to use following selector: $('div[tabindex=2]').click(); try around here: http://jsfiddle.net/85h3gtnj/1/ actually to make sure you hit no other divs you should add the class selector $('div.dp[tabindex=2]').click(); as fiddled here: http://jsfiddle.net/85h3gtnj/3/ A: If the tabindex is the attribute that is set reliably on the page, you can use that to call the click() event: $.each('div', function() { if ($(this).attr('tablindex') == 4) { $(this).click(); //makes it submit } }); you can also call the div using the nth-child selector: $('#container div:nth-child(4)').click(); Info on nth-child can be found here: https://api.jquery.com/nth-child-selector/ Hope that helps! A: is that what u need? FIddle: https://jsfiddle.net/288er5td/ CODE: <div tabindex="1" class="dp" > <img class="largeIcon float" alt="Node..." src="/images/local.png?id=3B194F1192F038FFF32BF9C4AFF16AA1859EC1D2462FB845BC9813C490A994BB" /> <div class="Description float"> <input data-input-field='' type='text' val ='val1' /> <span class="largeTextNoWrap indentNonCollapsible">Node..</span> </div> </div> <div tabindex="2" class="dp"> <img class="largeIcon float" alt="Node2..." src="/images/dp.png?id=D29E7325C0DB2C8C6DE5B6632374C52A6975B90CA5FCB6F05F801496191334AF" /> <div class="dpDescription float"> <input data-input-field='' type='text' val ='val2' /> <span class="largeTextNoWrap indentNonCollapsible">Node2...</span> </div> </div> <div tabindex="3" class="dp"> <img class="largeIcon float" alt="Node3..." src="/images/dp.png?id=D29E7325C0DB2C8C6DE5B6632374C52A6975B90CA5FCB6F05F801496191334AF" /> <div class="dpDescription float"> <input data-input-field='' type='text' val ='val3' /> <span class="largeTextNoWrap indentNonCollapsible">Node3...</span> </div> </div> $(document).ready(function(){ t = function(elem){ var $this = elem; var $tab = $this.closest('.dp'); var tabindex = $tab.attr('tabindex'); var i_val = $this.val(); alert(tabindex); alert(i_val); } $(document).on('click', '[data-input-field]', function(){ t($(this)); }); $(document).on('keypress', '[data-input-field]', function(event){ if ((event.keyCode == 32) || (event.keyCode == 13)){ t($(this)); } }); });
unknown
d3738
train
you need to cast your usercontrol as the actual class SquareEUA to access that class's properties SquareEUA userControl = (SquareEUA)(Page.LoadControl("~/UserControl/SquareEUA.ascx")); that should do the trick (you should add some error handling, null check, etc.) edit: seems I missed a parenthesis around (Page...
unknown
d3739
train
Encrypting the data also makes it look a great deal like randomized bit strings. This precludes any operations the shortcut searching via an index. For some encrypted data, e.g. Social security number, you can store a hash of the number in a separate column, then index this hash field and search for the hash. This has limited utility obviously, and is of no value in searches name like 'ROB%' If your database is secured properly may sound nice, but it is very difficult to achieve if the bad guys can break in and steal your servers or backups. And if it is truly as requirement (not just a negotiable marketing driven item), you are forced to comply. You may be able to negotiate storing partial data in unencrypted, e.g., first 3 character of last name or such like so that you can still have useful (if not perfect) indexing. ADDED I should have added that you might be allowed to hash part of a name field, and search on that hash -- assuming you are not allowed to store partial name unencrypted -- you lose usefulness again, but it may still be better than no index at all. For this hashing to be useful, it cannot be seeded -- i.e., all records must hash based on the same seed (or no seed), or you will be stuck performing a table scan. You could also create a covering index, still encrypted of course, but a table scan could be considerable quicker due to the reduced I/O & memory required. A: I'll try to write about this simply because often the crypto community can be tough to understand (I resisted the urge to insert a pun here). A specific solution I have used which works nicely for names is to create index tables for things you wish to index and search quickly like last names, and then encrypt these index column(s) only. For example, you could create a table where the key column contains one entry for every possible combination of characters A-Z in a 3-letter string (and include spaces for all but the first character). Like this: A__ AA_ AAA AAB AAC AAD .. .. .. ZZY ZZZ Then when you add a person to your database, you add their index to a second column which is just a list of person ID's. Example: In your patients table, you would have an entry for smith like this: 231 Smith John A 1/1/2016 .... etc and this entry would be encrypted, perhaps all columns but the ID 231. You would then add this person to the index table: SMH [342, 2342, 562, 12] SMI [123, 175, 11, 231] Now you encrypt this second column (the list of ID's). So when you search for a last name, you can type in 'smi' and quickly retrieve all of the last names that start with this letter combination. If you don't have the key, you will just see a cyphertext. You can actually create two columns in such a table, one for first name and one for last name. This method is just as quick as a plaintext index and uses some of the same underlying principles. You can do the same thing with a soundex ('sounds like') by constructing a table with all possible soundex patterns as your left column, and person (patient?) Id's as another column. By creating multiple such indices you can develop a nice way to hone in on the name you are looking for. You can also extend to more characters if you like but obviously this lengthens your table by more than an order of magnitude for each letter. It does have the advantage of making your index more specific (not always what you want). Truthfully any type of histogram where you can bin the persons using their names will work. I have seen this done with date of birth as well. anything you need to search on. A table like this suffers from some vulnerabilities, particularly that because the number of entries for certain buckets may be very short, it would be possible for an attacker to determine which names have no entries in the system. However, using a sort of random 'salt' in your index list can help with this. Other problems include the need to constantly update all of your indices every time values get updated. But even so, this method creates a nicely encrypted system that goes beyond data-at-rest. Data-at-rest only protects you from attackers who cannot gain authorization to your systems, but this system provides a layer of protection against DBA's and other personnel who may need to work in the database but do not need (or want) to see the personal data contained within. They will just see ciphertext. So, an additional key is needed by the users or systems that actually need/want to access this information. Ashley Madison would have been wise to employ such a tactic. Hope this helps. A: Sometimes, "encrypt the data" really means "encrypt the data at rest". Which is to say that you can use Transparent Data Encryption to protect your database files, backups, and the like but the data is plainly viewable through querying. Find out if this would be sufficient to meet whatever regulations you're trying to satisfy and that will make your job a whole lot easier.
unknown
d3740
train
As you are already keep track of the depth, make use of it. E.g. $indent = ''; for($i = 0; $i < $depth; $i++) { $indent .= "&nbsp;"; } $tempTree .= $indent . "- " . $child['name'] . "<br>"; To make it look the way you want it you might have to initialize $depth with 0. Also note that executing SQL queries in a nested for loop is not the best approach. If possible, try to reduce the number of queries. You could for example use classes and, get all the entries at once and then build the tree structure with objects and arrays.
unknown
d3741
train
There are know issues with the way homebrew and npm play together. From this article by Dan Herbert There's an NPM bug for this exact problem. The bug has been "fixed" by Homebrew installing npm in a way that allows it to manage itself once the install is complete. However, this is error-prone and still seems to cause problems for some people. The root of the the issue is really that npm is its own package manager and it is therefore better to have npm manage itself and its packages completely on its own instead of letting Homebrew do it. Aside from that your node version is out of date. If you can upgrade you should do so to Node v4.1.2. Follow the instructions on the node.js site.
unknown
d3742
train
What it means is that you have to add the libraries you mention in the "link binary with libraries" row of the Build Phases section. You can arrive to that section by: - clicking in the project file in the project navigator view - clicking in the target of the project where you want to use the library in the targets column - clicking in the Build Phases section you will see the Link Binary With Libraries row. Just click on the + button and add libAsyncDisplayKit.a, Photos.framework and the AssetsLibrary.framework. A: A convenient way of adding external libs is to use cocoa pods as employeed here. (A collectionsview implementation a tableView should be somewhat similar) (I am not the writer of that article)
unknown
d3743
train
You need to have a list containing a reference to all threads and accessible by all threads. This list of threads should be ready before you start the threads. The thread that finds a solution first can kill the others using the list, taking care of not commiting suicide. You might face a racing condition in case one of the threads dies before you call join. As such you might be calling join on a already dead thread. A quick and dirty workaround is to let each thread wait few milliseconds fot the main thread to call join for all threads. An other cleaner solution is to use a flag that is checked by all threads while they look for a solution. If they find it to be true, they should immediately terminate by returning. The thread that finds a solution can set the flag to true and return. Now all threads will nicely join the main thread.
unknown
d3744
train
you want NOT LIKE SELECT * FROM $tablename WHERE `Info3` NOT LIKE '#DONE#%' LIMIT 0,30 EDIT: if #DONE# is not always at the beginning, use %#DONE#% SELECT * FROM $tablename WHERE `Info3` NOT LIKE '%#DONE#%' LIMIT 0,30 A: Try this - SELECT * FROM $tablename WHERE `Info3` not like '#DONE#%' LIMIT 0,30
unknown
d3745
train
I would strongly advocate using the more sophisticated, flexible solution even with great browsers support, the flexbox. You could have used align-self to align specify elements along with default alignment to sibling elements. If you did not know about flexbox, It's worth learning right now.
unknown
d3746
train
So you asked: "Why does asynchronous behavior reduce the amount of threads?" - Note: Don't confuse threading with using multicore, Its totally deferent concept , But of course thread can take advantage of multicore system, But now Lets think we have a single core CPU. Threading A thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, (Basically small unit of execution). For I/O operation (like making a network call) take time but program need to wait and wasting valuable computation power by doing nothing, So historically we use thread that execute a task independently, Its has some drawback, One of is memory concussion (Because Its need to clone register, stack, counter), this is a deferent topic. Also thread are so expensive to switch context... So we know that thread are expensive, What if we can reduce thread count ? Asynchronous The idea is to use Event, and execute via a library ( Also known: runtime, executor etc...), without the program blocking to wait for results. Its cheep and efficient for I/O intensive tasks. Even, It can use a single thread to do all async stuff!
unknown
d3747
train
If I have not misunderstood, I suppose you want to get the InstanceId of the VM in the Azure VM Scale set. You could try to use Get-AzureRmVmssVM to get it. Get-AzureRmVmssVM -ResourceGroupName <ResourceGroupName> -VMScaleSetName <VMScaleSetName> Update: If you want to get the ResourceId of azure resource, you could use Get-AzureRmResource to do it, just specify the properties what you want. For example: 1.Get ResourceId of the specific resource: $resource = Get-AzureRmResource -ResourceGroupName <ResourceGroupName> -ResourceType <ResourceType> -ResourceName <ResourceName> $resource.ResourceId 2.Get ResourceIds of all resources in the specific resource group $resource = Get-AzureRmResource -ResourceGroupName <ResourceGroupName> $resource.ResourceId 3.Get ResourceIds of all resources under your subscription. $resource = Get-AzureRmResource $resource.ResourceId The result will like(actual result will decided by your properties):
unknown
d3748
train
:strA(int x){ this->x = x; } And another structure that uses a pointer to the previous one: #include strA struct strB{ int y; strA *var_strA; strB(int y); ~strB(){ delete var_strA; } }; strB::strB(int y){ this->y = y; var_strA = new strA(123); } Then if I do from the main aplication a vector of strB items: std::vector<strB> vectB; main(){ strB *itemB = new strB(456); vectB.push_back(*itemB); delete itemB; //more code } If I try to access the var_strA on the item in the vector, is empty. And also, I get an error when by deleting the item on the vector, since the destructor tries to delete var_strA again. Comming from Java... I'm really getting lost with the damn pointers. thanks in advance A: You need a copy constructor and a copy assignment operator on that pointer-holding type, i.e. follow the rule of three. Here's a great resource here on SO: What is The Rule of Three?
unknown
d3749
train
There's a very nice example here that solves the problem: https://github.com/spring-projects/spring-data-examples/tree/master/jdbc/basics The solution amounts to adding a configuration that registers a converter that can extract the CLOB data to the String property import java.sql.Clob; import java.sql.SQLException; import java.util.Arrays; import org.springframework.context.annotation.Configuration; import org.springframework.core.convert.converter.Converter; import org.springframework.data.jdbc.core.convert.JdbcCustomConversions; import org.springframework.data.jdbc.repository.config.AbstractJdbcConfiguration; import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; import org.springframework.data.relational.core.mapping.Embedded.Nullable; @Configuration @EnableJdbcRepositories public class AggregateJdbcConfiguration extends AbstractJdbcConfiguration { @Override public JdbcCustomConversions jdbcCustomConversions() { return new JdbcCustomConversions(Arrays.asList(new Converter<Clob, String>() { @Nullable @Override public String convert(Clob clob) { try { return Math.toIntExact(clob.length()) == 0 // ? "" // : clob.getSubString(1, Math.toIntExact(clob.length())); } catch (SQLException e) { throw new IllegalStateException("Failed to convert CLOB to String.", e); } } })); } } Here are a few of my favorite videos on the subject https://www.youtube.com/watch?v=EaHlancPA14&list=PLsC0nE-wJ1I4ra6KYXTPOXipdrJ_IdhaO&index=3&t=0s https://www.youtube.com/watch?v=GOSW911Ox6s&list=PLsC0nE-wJ1I4ra6KYXTPOXipdrJ_IdhaO&index=4&t=59s https://www.youtube.com/watch?v=AnIouYdwxo0&list=PLsC0nE-wJ1I4ra6KYXTPOXipdrJ_IdhaO&index=5&t=2730s And a couple of blog posts https://spring.io/blog/2018/09/24/spring-data-jdbc-references-and-aggregates https://spring.io/blog/2018/09/17/introducing-spring-data-jdbc
unknown
d3750
train
You should create a column group to your tablix on the date field so that it will actually group your dates instead of displaying each one individually. You can then use the SSRS aggregate functions in your details fields to combine the data from the grouped columns & rows. More info: * *Understanding Groups (Report Builder and SSRS) *Aggregate Functions Reference (Report Builder and SSRS)
unknown
d3751
train
My specific question is if I can control my container so that it shows 'starting' until the setup is ready and that the health check can somehow be started immediately after that? I don't think that it is possible with just K8s or Docker. Containers are not designed to communicate with Docker Daemon or Kubernetes to tell that its internal setup is done. If the application takes a time to setup you could play with readiness and liveness probe options of Kubernetes. You may indeed configure readynessProbe to perform the initial check after a specific delay. For example to specify 120 seconds as initial delay : readinessProbe: tcpSocket: port: 8080 initialDelaySeconds: 5 periodSeconds: 120 Same thing for livenessProbe: livenessProbe: httpGet: path: /healthz port: 8080 httpHeaders: - name: Custom-Header value: Awesome initialDelaySeconds: 120 periodSeconds: 3 For Docker "alone" while not so much configurable you could make it to work with the --health-start-period parameter of the docker run sub command : --health-start-period : Start period for the container to initialize before starting health-retries countdown For example you could specify an important value such as : docker run --health-start-period=120s ... A: Here is my work around. First in docker-compose set long timeout, start_period+timeout should be grater than max expected starting time, eg. healthcheck: test: ["CMD", "python3", "appstatus.py", '500'] interval: 60s timeout: 900s retries: 2 start_period: 30s and then run script which can wait (if needed) before return results. In example above it is appstatus.py. In the script is something like: timeout = int(sys.argv[1]) t0 = time.time() while True: time.sleep(2) if isReady(): sys.exit(os.EX_OK) t = time.time() - t0 if t > timeout: sys.exit(os.EX_SOFTWARE)
unknown
d3752
train
Well, looking through the web.config file I noticed that I had commented out the following line: <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> I uncommented it and no more error.
unknown
d3753
train
I couldn't find any documentation on those values, but my guess would be: * *Used: The cost of using the instance On-Demand *UnusedCapacityReservation: The cost of a Reserved Instance when it isn't being used (you still pay for it) *AllocatedCapacityReservation: The cost of an instance if it is being used as a Reserved Instance (already paid for, therefore no cost) Those are just my guesses.
unknown
d3754
train
I've run into this a few times and it's always been the same thing (for me at least). If the template tag function doesn't return anything this error pops up. class MyTag(template.Node): def __init__(self, name): self.name=name def render(self, context): context[self.name]='czarchaic' #return an empty string since we've only modified the context return '' @register.tag def my_tag(parser, token): bits=token.split_contents() if len(bits)==2: return MyTag(bits[1]) #return an empty string if all test fail return '' EDIT Looking at your code it would appear that if num were still 0 at the if num: check this tag would not return anything, resulting in this error. A: Line 265 (or 272) of your source views.py is sending an object that is a 'NoneType' which deeper code is trying to get the 'source' attribute from. In other words, you're sending a blank (NoneType) object to the template engine, so look at your code above these lines and see which objects don't have a value when you send them away.
unknown
d3755
train
You didn't install apache properly, doing an apt-get on apache2 does not install everything. what @newman stated is correct you can follow that guide, or here is a digitalocean link that is usuable for production server (since you would do this on a droplet). Note this is full stack LAMP, which I would assume you would get to eventually when you want to dab with mysql https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
unknown
d3756
train
I'd recommend using django-mptt - no need to reinvent the wheel. You'll find everything at https://github.com/django-mptt/django-mptt
unknown
d3757
train
This will do your transform, outside of pandas. d = {'a':['A', 'B'], 'b':[{5:1, 11:2}, {5:3}]} out = { 'a':[], 'b':[] } for a,b in zip(d['a'],d['b']): n = max(b.values()) for k in b: for i in range(n): out['a'].append(f'{a}{i+1}') out['b'].append(k+i) print(out) Output: {'a': ['A1', 'A2', 'A1', 'A2', 'B1', 'B2', 'B3'], 'b': [5, 6, 11, 12, 5, 6, 7]} A: First you need to preprocess your input dictionary like this import pandas as pd d = {'a':['A', 'B'], 'b':[{5:2, 11:2}, {5:3}]} # Assuming 5:2 instead of 5:1. res = {"a": [], "keys": []} for idx, i in enumerate(d['b']): res['a'].extend([f"{d['a'][idx]}{k}" for j in i for k in range(1,i[j]+1) ]) res['keys'].extend([k for j in i for k in range(j, j+i[j])]) df = pd.DataFrame(res) output {'a': ['A1', 'A2', 'A1', 'A2', 'B1', 'B2', 'B3'], 'keys': [5, 6, 11, 12, 5, 6, 7]} A: For a pandas solution: df2 = (df.drop(columns='b') .join(pd.json_normalize(df['b']) .rename_axis(columns='key') .stack().reset_index(-1, name='repeat') ) .loc[lambda d: d.index.repeat(d.pop('repeat'))] ) g = df2.groupby(['a', 'key']).cumcount() df2['a'] += g.add(1).astype(str) df2['key'] += g print(df2) Output: a key 0 A1 5 0 A1 11 0 A2 6 0 A2 12 0 A3 7 0 A3 13 1 B1 5 1 B2 6 1 B3 7
unknown
d3758
train
When the help button is pressed TrayDialog looks for a control with a SWT.Help listener. It starts at the currently focused control and moves up through the control's parents until it finds a control with the listener (or runs out of controls). You can set up a help listener that is connected to a 'help context' in the Eclipse help system using PlatformUI.getWorkbench().getHelpSystem().setHelp(control, "context-id"); or you can write your own help listener. A: I had the same problem and solved it by just adding a HelpListener to one of my controls: Composite area.addHelpListener(new HelpListener() { @Override public void helpRequested(HelpEvent e) { System.out.println("This is the help info"); } }); and adding the following to my Constructor: setDialogHelpAvailable(true);
unknown
d3759
train
I believe you are using @RequestParam annotations but you are not sending any params in the URL from the frontend, hence the 400 error. Since you are using Patch/Put I would suggest you change your changePassword function to take a dto. And since you are already sending data in the body from frontend so no change needed there. For example public Object changePassword(@RequestBody @Valid ChangePasswordDto changePasswordDto){ // your logic } Then create a ChangePasswordDto class with @Required on properties that are required. public class ChangePasswordDto{ private String email; private String newPassword; private String oldPassword; @Required public void setEmail(String email) { this.email= email; } @Required public void setOldPassword(String oldPassword) { this.oldPassword= oldPassword; } @Required public void setNewPassword(String newPassword) { this.newPassword= newPassword; } // corresponding getters }
unknown
d3760
train
The problem was the generated java files having the unused import org.openapitools.jackson.nullable.JsonNullable So while generating the code using openapi-generator passed the following config to ignore the JsonNullable import. "openApiNullable": false
unknown
d3761
train
1、 Is using @bean at job/step/reader/writer mandatory or not ? No, it is not mandatory to declare batch artefacts as beans. But you would want to at least declare the Job as a bean to benefit from Spring's dependency injection (like injecting the job repository reference into the job, etc) and be able to do something like: ApplicationContext context = new AnnotationConfigApplicationContext(MyJobConfig.class); Job job = context.getBean(Job.class); JobLauncher jobLauncher = context.getBean(JobLauncher.class); jobLauncher.run(job, new JobParameters()); 2、 if it is not mandatory, when I new a object like reader, do I need to call afterPropertiesSet() manually? I guess that by "when I new a object like reader" you mean create a new instance manually. In this case yes, if the object is not managed by Spring, you need to call that method yourself. If the object is declared as a bean, Spring will call the afterPropertiesSet() method automatically. Here is a quick sample: import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class TestAfterPropertiesSet { @Bean public MyBean myBean() { return new MyBean(); } public static void main(String[] args) throws Exception { ApplicationContext context = new AnnotationConfigApplicationContext(TestAfterPropertiesSet.class); MyBean myBean = context.getBean(MyBean.class); myBean.sayHello(); } static class MyBean implements InitializingBean { @Override public void afterPropertiesSet() throws Exception { System.out.println("MyBean.afterPropertiesSet"); } public void sayHello() { System.out.println("Hello"); } } } This prints: MyBean.afterPropertiesSet Hello
unknown
d3762
train
After i did more search i found this Question and his first answer was what i want. the second part of my Question was about api to use i found this 2 api * *Nexmo *Infobip but you will have to contact them first both of them will give you atest account to use it at first , but i used the first one from SQL SSIS.
unknown
d3763
train
The problem is that the Sublime Text command-line tool by default tells the Sublime Text GUI to open a file, and then exits right away, even while the GUI still has the file open. There's an option, though, that'll tell the command-line tool to wait for the file to be closed in the GUI. That option is --wait (or -w for short). So if I try this: : $; git config core.editor subl : $; git commit ... I get the following -- with the first line showing briefly then getting erased and replaced by the second: hint: Waiting for your editor to close the file... Aborting commit due to empty commit message. You may or may not see the first line, as this all happens at about the same time as the Sublime Text GUI is becoming visible, and opening up the COMMIT_MESSAGE file. And when you return to the Terminal, you'll see only the second line. But if I add the option to wait, it works. So I change the editor like so: : $; git config core.editor 'subl -w' And then if I do a git commit, and switch from Sublime Text to the Terminal without closing the COMMIT_MESSAGE file, I see: : $; git commit hint: Waiting for your editor to close the file... And then if I go back and close the file (after writing in some text and saving it), I come back to see: : $; git commit [master 79d5a7b] Commit message I typed in Sublime Text GUI. 1 file changed, 1 insertion(+), 1 deletion(-) A: If you're exiting without changing the message, you should be aware that you actually have to type something in. The same thing happens to me (with gedit) if I don't actually enter something over and above the comment lines it starts with (merges are okay since they automatically add the non-comment "merging a to b"-like text). However, if your editor is actually starting but the git commit carries on while it's open, then there's an issue with the way the editor is being started. There's a known issue with Sublime Text in that programs that start it can't always correctly identify that it's still running. I think that may be due to the fact that the command line tool simply tells the GUI program to open the file (starting it first if needed), then the command line tool will exit. Hence, git will assume it's finished and, since the file hasn't been changed at that point, it gives you that error message. In terms of fixing that issue, I believe Sublime Text added a -w flag to ensure this didn't happen. In any case, I prefer explicitly entering a message on the command line with something like: git commit -m 'fixed my earlier screw-up' so that I don't have to worry about editors and such.
unknown
d3764
train
am sending a file through TCP, and have the server sending a message containing "END_OF_MESSAGE" to alert the client that they have received the whole file and can close the socket. Why? Just close the socket. That will tell the client exactly the same thing.. What you're attempting is fraught with difficulty. What happens if the file contains END_OF_MESSAGE? You're going to need an escape convention, and an escape for the escape, and inspect all the data when both sending and receiving. The actual problem that you're seeing is that END_OF_MESSAGE can arrive along with the last bit of the file, so it isn't at the start of the buffer. But it's all pointless. Just close the socket.
unknown
d3765
train
error's screenshot In my case, it happened after installing react-native-gifted-chat, so link to the instructions: * *go to node_modules/react-native-parsed-text/babel.config.js *coomment second line // api.cache(true); *close Metro Bundler run yarn run ios, *you may need to run it twice // "ios": "react-native run-ios"
unknown
d3766
train
No. VisualStudioWorkspace only exists in VS2015 and newer.
unknown
d3767
train
I've been working on your problem, and my solution can blink the flashlight. I used your same logic, except I used Handler instead of Thread to delay the blink. public void flash_effect(View view) { long delay = 50; camera = Camera.open(); params = camera.getParameters(); params.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); camera.setParameters(params); camera.startPreview(); handler.postDelayed(new Runnable() { @Override public void run() { params.setFlashMode(Camera.Parameters.FLASH_MODE_OFF); camera.setParameters(params); camera.stopPreview(); camera.release(); } }, delay); } You have to initialise the handler before using it. Do it in the onCreate() method. Handler handler = new Handler(); This method is an onClick() of a button. I used a button to start a blink public void flash_effect(View view)
unknown
d3768
train
DPS will not provide you neccessary keys for each device. To work with Azure IoT (either DPS or Hub), you must have per-device credential flash to your device, this is usually done during manufacturing phase. When you use DPS group enrollment, you get a group key from DPS and use a formula to generate per-device key (hash the group key and enrollment/device id), you need a method to flash 3k keys to 3k devices on production line. A: DPS do actually provision a device AUTOMATICALLY. You don't extra step. Let me explain how. Step 1: Things you have to do once from the Azure portal: * *You create/you have an Azure IoT Hub up and running; *Your create/you have azure DPS up and running; *You create/you have a group enrolment with symmetric key from within DPS; *You keep the primary key of your group enrolment for use in a bit. Let’s call the primary key “KEY” Step 2: programming From your firmware source code: * *Write a code function that returns a device ID that’s unique for a device. You can use a string followed by the device MAC address, that you usually get from the Wifi interface (or Ethernet interface). For example: “3Kdevice-3454e210228c” the prefix will be the same for all devices you’ll have, but the hex numeric suffix will be different for each device. Let’s call this string REG_ID. *Write a code function that creates for the device it runs on, the symmetric key from both the primary key (aka KEY) of your enrolment and the registration ID (aka REG_ID). You do that by doing a SHA256 (see DPS doc for that). Let’s call the computed symmetric key “SYM_KEY”; *Use the azure SDK to get the credentials from DPS by presenting the registration ID (aka REG_ID) and the computed symmetric key (SYM_KEY) to it; *You can connect to the IoT Hub with the credentials you got at point 3.
unknown
d3769
train
It looks like map is still a value, but not a callable. Most likely, you assigned a value to it earlier in the Jupyter notebook (as jasonharper said in a comment). You can check what type of object map is by executing this in a code cell: map? The notebook should show an overlay window at the bottom describing the type, string representation, and docstring.
unknown
d3770
train
I would suggest using !IsPostBack if (!IsPostBack) { LoadData(); //generate dataset to construct table } This is the initial load. Once you postback - selected change - this should not load again. I assume the LoadData() creates the datatable or set therefore on postback loading it multiple times.
unknown
d3771
train
Make sure your local and remote paths are correct. You can check your remote path by logging into the container's terminal. There you can find the absolute path of your "app". I also cannot tell where you ${workspaceFolder} is actually is. Could be DTNetworkRepos or ip2m-metrr. You will need to make sure you clarify the path. Also it would help if you posted up your folder stucture, Docker file for the server project and docker compose for all your container projects. Docker file will explain your path on the remote server. Dockerfile & Docker-compose file will ensure us that you have the right cmd or entrypoint for your environment. It may not line up with the tutorial that you set up.
unknown
d3772
train
Try feed_targeting instead of targeting! All parameters which you can target like languages,cities,counties are facebook specific. You can resolve them via autocomplete data : "{'locales':[1001],'countries':[GE],'cities':[825886]}" Nice feature for automatic posting with targeting but so bad documented in the Facebook documentation... A: The right solution is: You generate the key for the city (using the API) and use the country's 2 letter code. $messageData will be: $messageData = [ 'access_token' => $AccessToken, 'message' => $GenerateMessageStr, 'targeting' => "{'cities': <generated city key>,'countries':'GE'}" ] If you're using API v2.8 and the current Facebook PHP SDK (5): $request = new \Facebook\FacebookRequest( $fbApp, $accessToken, 'POST', '/<facebook-page-id>/feed', [ 'message' => 'With Geolocate Ib', 'targeting' => "{'geo_locations': {'cities': [{'key':" . <city key> . "}]}}" ] ); The targeting flags makes sure only those in the specified city, region etc sees the post. feeds_targeting might still allow people not in those city/region to see the posts.
unknown
d3773
train
The item value for this item <f:selectItem itemLabel="Ignored" itemValue="#{record.ignored}" /> should be either true or false since that is the condition that will be check during the filtering of the records <f:selectItem itemLabel="Ignored" itemValue="true" />
unknown
d3774
train
It means that the channel.send() returned false. As for Should we do the retry, i don't know as I don't know your requirements. Also, I would be interested why are you using StreamBridge? Indeed it is a component of s-c-stream, but 90% of what it does could be done in a more idiomatic way without it. In fact it was designed for one specific purpose, hence my interest.
unknown
d3775
train
django-lazysignup, which you are using, allows you to deliver a custom LazyUser class (here). All you need to do is to write a subclass of lazysignup.models.LazyUser with defined is_authenticated method and set it as settings.LAZYSIGNUP_USER_MODEL. But this is not the end of your troubles. Lots of django apps assume that authenticated user has some properties. Mainly, is_staff, is_superuser, permissions, groups. First and foremost, django.contrib.admin needs them to check if it can let the user in and what to show him. Look how django.contrib.auth.models.AnonymousUser mocks them and copy it. Remark: look how AnonymousUser is not subclassing any user class nor db.Model. Supplied user class only needs to quack. A: Ended up just having to replace all calls to User.is_authenticated(). To prevent django-allauth from redirecting lazy-users from the login page, this ended up looking something like this: from allauth.account.views import AjaxCapableProcessFormViewMixin def _ajax_response(request, response, form=None): if request.is_ajax(): if (isinstance(response, HttpResponseRedirect) or isinstance(response, HttpResponsePermanentRedirect)): redirect_to = response['Location'] else: redirect_to = None response = get_adapter().ajax_response(request, response, form=form, redirect_to=redirect_to) return response class RedirectUserWithAccountMixin(object): def dispatch(self, request, *args, **kwargs): self.request = request if user_has_account(request.user): redirect_to = self.get_authenticated_redirect_url() response = HttpResponseRedirect(redirect_to) return _ajax_response(request, response) else: response = super(RedirectUserWithAccountMixin, self).dispatch(request, *args, **kwargs) return response def get_authenticated_redirect_url(self): redirect_field_name = self.redirect_field_name return get_login_redirect_url(self.request, url=self.get_success_url(), redirect_field_name=redirect_field_name) class LoginView(RedirectUserWithAccountMixin, AjaxCapableProcessFormViewMixin, FormView): ... Where user_has_account() was my own method for checking whether the user was actually signed in.
unknown
d3776
train
just do Build > Clean Project Wait for Cleaning Ends and then Build > Rebuild Project, and the error was gone. that's it. A: I also faced the same error, and i was searching through many existing answers with duplicate dependencies or multidex etc. but none worked. (Android studio 2.0 Beta 6, Build tools 23.0.2, no multidex) It turned out that i once used a package names which didn't match the package name that is depicted in the Manifest. In other ParseException lines, i found out that i had files in different modules whith similiar package names/paths that possibly conflicted the dexer. Example: Module A: com.example.xyz.ticketing.modulea.Interface.java Module B: com.example.Xyz.ticketing.moduleb.Enumerations.java Module C: Has dependencies on A and B After fixing "Xyz" to lowercase, the dexer was fine again. How to find out: When i looked through the output of the gradle console for the ParseExceptions that looks like this: AGPBI: {"kind":"error","text":"Error converting bytecode to dex:\nCause: java.lang.RuntimeException: Exception parsing classes" I scrolled close to the end of the exception. There is a part in that long exception line that actually mentions the cause: Caused by: com.android.dx.cf.iface.ParseException: class name (at/dummycompany/mFGM/hata/hwp/BuildConfig) does not match path (at/dummycompany/mfgm/hata/hwp/BuildConfig.class) This way i found out where to search for missmatching package names/paths A: I had a wrong package name in one of the helper class,hence I was having the error.So check all the Classes and make sure you have correct package name. A: My solution was different, I was added these lines in proguard-rules.pro -optimizationpasses 5 -overloadaggressively -repackageclasses '' -allowaccessmodification Make sure to update everything from SDK manager as well. A: If your targetSdkVersion is 25 or higher version and you use JDK 8 you have to add in your build.gradle file the following: android { compileSdkVersion 26 buildToolsVersion "26.0.0" defaultConfig { ... jackOptions { enabled true } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } More info: https://stackoverflow.com/a/37294741 A: The solution for me is to modifing the Build Gradle file. I found out, that the problem is a GC overhead (out of memory). So I add some code to my configuration android { dexOptions { incremental = true; preDexLibraries = false javaMaxHeapSize "2g" } } There is some other problem with proguard. You've to set minifyEnabled to false also. A: Removing -overloadaggressively from my proguard-rules.pro fixed this for me. Alternatively, adding -useuniqueclassmembernames also fixed it. A: I tried ./gradlew clean build, Invalidating studio cache, restarting machine. But what solved the issue is turning Instant run off A: Got this issue while using the Android studio template for Login activity. I've selected "activity" package to put my activity into. The template in AndroidManifest.xml, instead of .activity.LoginActivity used the .LoginActivity thus causing the error. A: If you faced this error, certainly your package in manifest differ from the others that you have set in your classes. be careful. A: I ran into the same issue today and the problem was that in my Constants.java classed I have defined (by mistake) public static final class Checkout { ....... } and public static final class CHECKOUT { ...... } A: In my case, there was a class that I made that I didn't use yet. So I have to delete the class or use the class. A: I faced the same error. Appears that its due to renaming a package to lower case and a class had the previous case wording. A: Your gradle.build file will contain compile files('libs/httpclient-4.2.1.jar') compile 'org.apache.httpcomponents:httpclient:4.5' compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1' By removing this line from file. compile files('libs/httpclient-4.2.1.jar') It will work fine.
unknown
d3777
train
Its hard to infer the cause of the error with what you have posted. However, you asked about how to prevent a page from resubmitting in Grails. Take a look at documentation. Grails has a build in support for that. Basically you define a form with a token and using withForm you will check if the token still is valid or not. <g:form useToken="true" ...> / withForm { // good request }.invalidToken { // bad request }
unknown
d3778
train
It's a vague and broad question, but I guess you use different URLs to prevent retrieving old, cached versions of changed resources (that's one sure way anyway, although not necessarily the best way) and have a problem with Chromium-based browsers not caching resources that are unchanged. Chromium respects caching directives as per spec, so it seems you're not sending the appropriate caching directives (headers) in the first place or have a problem testing the caching behavior (e.g. testing with caching disabled). Determine which is the problem and fix it.
unknown
d3779
train
You can hide a button with CSS by using the class names that CKEditor creates for toolbar buttons. Try this (tested with v4.5.11): // hide document.getElementsByClassName('cke_button__myButton')[0].style.display = 'none'; //show document.getElementsByClassName('cke_button__myButton')[0].style.display = 'block';
unknown
d3780
train
So the HTMLSelectElement prototype (not the framework) has its own remove() method and when you call remove() on <select>s it does not traverse up the prototype chain to the remove() method of HTMLElement added by PrototypeJS. 2 options for you $('history_status').parentNode.removeChild($('history_status')); or Element.remove($('history_status')); I've filed a bug report for this as well https://github.com/sstephenson/prototype/issues/122 EDIT Use a CSS selector and the select() method like this $('order_history_block').up().select('select').each(function(item){ Element.remove(item); });
unknown
d3781
train
The step attribute respects the max, but also restricts the input. If you need more flexibility, try this: <input list="numbers"> <datalist id="numbers"> <option value="1"> <option value="4"> <option value="7"> <option value="10"> <option value="11"> </datalist> On second thought, that's not great - I would just use the good old-fashioned select tag: <select> <option>1<option> <option>4<option> <option>7<option> <option>10<option> <option>11<option> </select> to get closer to your example. If your data set is contrived to demonstrate a point, these alternatives can be generated programmatically jsut as easy as the one in your example. A: This is simply not possible using straight HTML5. There's no HTML5 number feature that increments by 3s and switch to 1s near the last number. HTML rarely deviates from its established rules, no matter what our needs are. And step has pretty strict rules with no similar HTML5 alternatives. You will have to use Javascript or a <select> dropdown. Easy Imperfect Solution You can use some Javascript to make this happen. This example uses jQuery in a ready event: $('input').change(function(){ var $input = $(this), val = $input.val(); if (val == 13) { $input.attr("step","1"); $input.val(11); } else if (val == 10) { $input.attr("step","3"); } else if (val == 12) { $input.val(11); } }); Demo: http://jsfiddle.net/fpm21ej2/1/ There is a flash of the incorrect number "13" right before it changes to "11". I don't know of an event that would intercept this faster though, making this solution imperfect. Harder Better Solution Create a custom text field to mimick this incrementing behavior, but using your special number sequence. That means take a number box, add in some up/down buttons (possibly with sprite images), use Javascript to bind them to events that increment this as expected, and validate against the user entering invalid numbers (use the HTML5 pattern attribute). That will probably take some work, and it needs a bit more time than most of us can volunteer here at StackOverflow. But this should be possible. Easy Better Solution Use a <select> dropdown.
unknown
d3782
train
You should look at the JSON transparency property. When an attendee tentatively accepts a meeting, the property will look like this: "transparency": "transparent" On the other hand, when an attendee accepts a meeting, the property will look like this: "transparency": "opaque" In other words, a transparent event doesn't block busy time; an opaque event does block busy time. This terminology comes from the iCalendar specification. See the TRANSP property in iCalendar.
unknown
d3783
train
You can use the * operator to unpack arguments from a list or tuple: error_info = traceback.format_exception(*sys.exc_info()) Here's the example from the docs: >>> range(3, 6) # normal call with separate arguments [3, 4, 5] >>> args = [3, 6] >>> range(*args) # call with arguments unpacked from a list [3, 4, 5]
unknown
d3784
train
Try this for logging specific query in log file: Create a logFile.log file then write your query in this file. $sql_query = "insert into tablename (column1, column2) values(value1, value2)"; file_put_contents('logFile.log', json_encode($sql_query , true), FILE_APPEND); Hope this will help you a bit. Or you can follow the duplication question here: logging all queries after execution in codeigniter
unknown
d3785
train
What you can do is declare a custom TypeDescriptionProvider for the Chart type, early before you select your object into the PropertyGrid: ... TypeDescriptor.AddProvider(new ChartDescriptionProvider(), typeof(Chart)); ... And here is the custom provider (you'll need to implement the CreateInstance method): public class ChartDescriptionProvider : TypeDescriptionProvider { private static TypeDescriptionProvider _baseProvider = TypeDescriptor.GetProvider(typeof(Chart)); public override object CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, object[] args) { // TODO: implement this return new Chart(...); } public override IDictionary GetCache(object instance) { return _baseProvider.GetCache(instance); } public override ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance) { return _baseProvider.GetExtendedTypeDescriptor(instance); } public override string GetFullComponentName(object component) { return _baseProvider.GetFullComponentName(component); } public override Type GetReflectionType(Type objectType, object instance) { return _baseProvider.GetReflectionType(objectType, instance); } public override Type GetRuntimeType(Type reflectionType) { return _baseProvider.GetRuntimeType(reflectionType); } public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { return _baseProvider.GetTypeDescriptor(objectType, instance); } public override bool IsSupportedType(Type type) { return _baseProvider.IsSupportedType(type); } }
unknown
d3786
train
Later, following the solution in thread here: Many-to-many relationship to determine if user has liked a post I was able to come up (copy?) with alternative solution that yields the same result: select p.* ,EXISTS(SELECT * FROM likes l WHERE l.postid = p.id and l.userid = 4) AS isLiked FROM posts p order by p.id; While substantially reducing the complexity. I ran the explain command and it does look to perform better on paper.. Not sure if the best solution of all but works fine in my scenario while only a few records in table are present..
unknown
d3787
train
onclick='DeleteRow("+table_id+","+lastRow+")'/>"; it's wrong, and not a good way to do that. try this const input = Document.createElement('input'); input.type = "button"; input.value = "Sil"; input.id = "btnSil"; input.class = "btn btn-danger"; input.addEventListener('click', ()=> deleteRow(tableId, lastRow)); cellDeleteButton.appendChild(input); let me know if that works. updated:
unknown
d3788
train
VCProject is for C++ projects, in order to use a similar interface with C#/VB project you'll have to use VSProject. There are a number of VSLangProj overloads/extensions and you'll have to find the one that is specific to the version you need to use. See: https://msdn.microsoft.com/en-us/library/1xt0ezx9.aspx for all the VSLangProj interfaces from 2 through 100 (I think thats Version 2 through Version 10). A: You can't cast the Project object itself, because there's no inheritance relationship. But you can use the inner object: VCProject vcProject = project.Object as VCProject;
unknown
d3789
train
5000000000000000000 is your balance in wei, which represents 5 ethers.
unknown
d3790
train
well it looks like you are already using a framework like jquery...use $(document).ready (assuming that's jquery you are using...) the point of frameworks like jquery is that it (in principle) should be crossbrowser compatible.
unknown
d3791
train
You can't really pause a repo sync, but if you abort it using Ctrl-C and then run it again later, it will effectively pick up where it left off. Although it will start working through the project list from the beginning again, and may still fetch some new data for projects that have already been processed, it should whizz through these projects, because all of the data that it had previously fetched will still be there in the hidden .repo directory. See this answer for an excellent description of the way that repo init and repo sync work. Note that you won't immediately see any of the projects that have been fetched, because repo sync doesn't create and populate your working directories until it has finished cloning all of the git repositories in .repo/projects. A: If you want to repo sync without hanging up, you can use: nohup repo sync & and exit the ssh/telnet/terminal session. For the disk space increasing issue, just do the following periodically: cd /path/to/repo rm -f `find . -name '*tmp_pack*'`
unknown
d3792
train
You are probably using 32bit PHP. This version cannot allocate enough memory for composer even if you change the memory_limit to -1 (unlimited). Please use 64 bit PHP with the Composer to get rid of these memory problems.
unknown
d3793
train
You also have the option of using -subarrayWithRange: detailed in the NSArray documentation: NSArray *firstHalfOfArray; NSArray *secondHalfOfArray; NSRange someRange; someRange.location = 0; someRange.length = [wholeArray count] / 2; firstHalfOfArray = [wholeArray subarrayWithRange:someRange]; someRange.location = someRange.length; someRange.length = [wholeArray count] - someRange.length; secondHalfOfArray = [wholeArray subarrayWithRange:someRange]; This method returns new, autorelease-d arrays. A: Have you tried adding nil to the end of the -initWithObjects: method? NSArray *leftArray = [[NSArray alloc] initWithObjects:[testableArray objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(????, ????)]], nil]; NSArray *rightArray = [[NSArray alloc] initWithObjects:[testableArray objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(????, ????)]], nil]; A: If you want an extra object on first array (in case total items are odd), use following code modified from Alex's answer: NSArray *arrayTotal = [NSArray arrayWithObjects:@"A", nil]; //NSArray *arrayTotal = [NSArray arrayWithObjects:@"A", @"B", nil]; //NSArray *arrayTotal = [NSArray arrayWithObjects:@"A", @"B", @"C", nil]; //NSArray *arrayTotal = [NSArray arrayWithObjects:@"A", @"B", @"C", @"D", nil]; //NSArray *arrayTotal = [NSArray arrayWithObjects:@"A", @"B", @"C", @"D", @"E", nil]; NSArray *arrLeft; NSArray *arrRight; NSRange range; range.location = 0; range.length = ([arrayTotal count] % 2) ? ([arrayTotal count] / 2) + 1 : ([arrayTotal count] / 2); arrLeft = [arrayTotal subarrayWithRange:range]; range.location = range.length; range.length = [arrayTotal count] - range.length; arrRight = [arrayTotal subarrayWithRange:range]; NSLog(@"Objects: %lu", (unsigned long)[arrLeft count]); NSLog(@"%@", [arrLeft description]); NSLog(@"Objects: %lu", (unsigned long)[arrRight count]); NSLog(@"%@", [arrRight description]);
unknown
d3794
train
Just putting my comment as an answer in case it can help somebody seeing this question in the future. When you see a message like this, then the only possibility is that there are multiple types of one of the parameter objects. In this case, @nscoppin had two different definitions for ContentFilter. Either import the correct one, or use the fully qualified name in the method call, ie someMethod(com.packageA.subPackage.ContentFilter);
unknown
d3795
train
To get the last fragment: FragmentManager fm = getSupportFragmentManager(); int lastFragEntry = fm.getBackStackEntryCount()-1; String lastFragTag = fm.getBackStackEntryAt(lastFragEntry).getName(); Log.i("Last Fragment Tag->", lastFragTag); NB: If you want to get the name/tag of last fragment, you also have to use the same Tag during fragment transaction: ft.replace(android.R.id.container, fragment, "abc"); ft.addToBackStack("abc"); Hope this helps.
unknown
d3796
train
i would do it like that FileId=fopen(Filename) npoints=textscan(FileId,'%s %f',1,'HeaderLines',1) points=textscan(FileId,'%f %f',npoints{2},'MultipleDelimsAsOne',1,'Headerlines',1) % now you have the values you want you can put them in a matrix or any variable Y=cell2mat(C);
unknown
d3797
train
I hope i understand your problem. the application hangs on Process.WaitForExit() because this is what Process.WaitForExit(): it waits for the process to exit. you might want to call it in a new thread: int your method that create the process: Thread trd = new Thread(new ParameterizedThreadStart(Start)); trd.Start(); and add this method: private void Start(object o) { ((Process)o).WaitForExit(); // your code after process ended }
unknown
d3798
train
Are you calling this method for each product item in a list? In that case, looks like for one of the product, no values have been set for start_time, and time_type. You would get this error when expire_time is 0. But since you have tried the value of expire_time, I believe it must be happening for more product instances and it fails for one of those.
unknown
d3799
train
Polling is a bad workaround that does the job in a small scalle but is not efficient and ugly to implement. Modern browsers support WebSockets as a much better way to allow bidirectional communication. With something such as node.js' Socket.IO you can even use a high-level WebSocket abstraction layer that falls back to whatever is available in the browser - it can use WebSockets (preferred) and techniques such as Flash sockets, AJAX long-polling or JSONp long-polling without you having to care about what's used. A: This is what WebSockets is designed for, but it's not yet supported on IE (though it's coming in IE 10), or some older but still-used versions of the other big browsers. http://caniuse.com/#search=websockets Until then, check out Comet: http://en.wikipedia.org/wiki/Comet_(programming)
unknown
d3800
train
Pattern p = Pattern.compile("\\[Text:(.*?)\\]"); Matcher m = p.matcher("[Qual:3] [Text:PIX 1252471471953/YHYF/PPP121.40/10RTY10/NOLXX08X1] [Elem:123]"); m.find(); System.out.println(m.group(1)); Gives: PIX 1252471471953/YHYF/PPP121.40/10RTY10/NOLXX08X1 The \\[ and \\] are to escape the brackets, which are special characters in regexes. The .*? is a non-greedy quantifier, so it stops gobbling up characters when it reaches the closing bracket. This part of the regex is given inside a capturing group (), which you can access with m.group(1). A: Use the following string as the regex: "\\[Text:(.*?)\\]" The first capture group will give you exactly the substring you want. The non-greedy match (.*?) is required to make it stop at the first ] rather than also including [Elem:123]. A: String.substring(int beginIndex, int endIndex) Returns a new string that is a substring of this string. You could use this to remove the start and end of the string, or.... You could use String.indexOf(String str) To get the index of the start and end of the match and copy the contents to a new result string. You could use String.matches(String regex) However writing regular expressions can get difficult, http://docs.oracle.com/javase/6/docs/api/java/lang/String.html I hope this helps. A: Instead of using "\\[Text:(.*?)\\]", as others have suggested, I'd go one step further and use lookarounds to filter out the text you don't want: (?<=\\[Text:).*?(?=\\]) This will match exactly the text you want without having to select a capturing group.
unknown