qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
19,610,082
I have 2 tables with the same schema already created. I want to insert rows from table1 -> table2 with the constraint of Age(column) not being duplicates. The query executes but nothing gets inserted. ``` CREATE TABLE #Global (dbName varchar(100) NULL) INSERT INTO #Global VALUES ('db1') DECLARE @temp nvarchar(1000) S...
2013/10/26
[ "https://Stackoverflow.com/questions/19610082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/359151/" ]
Your where clause would exclude all rows. You should try something like this: ``` DECLARE @sql nvarchar(max) SELECT @sql = 'INSERT INTO [dbo].[Person] ([id], [age], [name]) SELECT min([id]) as id, [age], min([name]) as name FROM [' + @temp + ']..[Person] group by age' exec s...
try this as the select statement: ``` INSERT INTO [dbo].[Person] ([age], [name]) SELECT [age], [name] FROM [' + @temp + ']..[Person] WHERE [' + @temp + ']..[Person].[age] not in (select distinct age from [dbo].[Person]) ```
19,610,082
I have 2 tables with the same schema already created. I want to insert rows from table1 -> table2 with the constraint of Age(column) not being duplicates. The query executes but nothing gets inserted. ``` CREATE TABLE #Global (dbName varchar(100) NULL) INSERT INTO #Global VALUES ('db1') DECLARE @temp nvarchar(1000) S...
2013/10/26
[ "https://Stackoverflow.com/questions/19610082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/359151/" ]
Write as: ``` CREATE TABLE #Global (dbName varchar(100) NULL) INSERT INTO #Global VALUES ('db1') DECLARE @temp nvarchar(1000) SELECT @temp = dbName from #Global DECLARE @sql nvarchar(max) SELECT @sql = 'INSERT INTO [dbo].[Person] ([age], [name]) SELECT [age], [name] FROM [' + @temp + '].[...
try this as the select statement: ``` INSERT INTO [dbo].[Person] ([age], [name]) SELECT [age], [name] FROM [' + @temp + ']..[Person] WHERE [' + @temp + ']..[Person].[age] not in (select distinct age from [dbo].[Person]) ```
132,184
I have a few thousand binary files that have corresponding structs in them, followed by any number of bytes (this exact number of bytes is given in one of the fields in the structs). I read in data from the binary files to a struct, and assign variables from certain fields in those structs. I was wondering if there is ...
2016/06/16
[ "https://codereview.stackexchange.com/questions/132184", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/102883/" ]
An alternative solution could be a binary reader (see also: [this code project article](http://www.codeproject.com/Articles/10750/Fast-Binary-File-Reading-with-C)) **Implementation:** (I just replaced the 2 try catch blocks with one using): ``` public static void ReadBinaryReader(string filePath) { using (var str...
~~Your problem isn't the struct reading but the reading of small junks from disc. Consider to load the whole file into a memorystream first and then use either your aproach or use the `BinaryReader` like @JanDotNet suggested.~~ --- As a side note, you really should name your things better. E.g `stream1` implies that...
37,691,552
I have the following code that is leveraging multiprocessing to iterate through a large list and find a match. How can I get all processes to stop once a match is found in any one processes? I have seen examples but I none of them seem to fit into what I am doing here. ``` #!/usr/bin/env python3.5 import sys, itertool...
2016/06/08
[ "https://Stackoverflow.com/questions/37691552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2109254/" ]
You can check [this question](https://stackoverflow.com/questions/33447055/python-multiprocess-pool-how-to-exit-the-script-when-one-of-the-worker-process/33450972#33450972) to see an implementation example solving your problem. This works also with concurrent.futures pool. Just replace the `map` method with `apply_as...
`multiprocessing` isn't really designed to cancel tasks, but you can simulate it for your particular case by using `pool.imap_unordered` and terminating the pool when you get a hit: ``` def do_job(first_bits): for x in itertools.product(first_bits, *itertools.repeat(alphabet, num_parts-1)): # CHECK FOR MAT...
10,823,878
It seems on XCode I need to use std::size\_t instead of just size\_t on Visual C++. But this is a pain as I don't really want to have to `#include <cstddef>` and change every `size_t` to `std::size_t` in my code... in my Windows code `size_t` just works without including any additional files. Is there a way to make my...
2012/05/30
[ "https://Stackoverflow.com/questions/10823878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197229/" ]
Perhaps saying this somewhere near the top ? ``` using std::size_t; ```
Use `#include <stddef.h>`. So, what's the difference between `#include <stddef.h>` and `#include <cstddef>`? `<cstddef>` is a C++ header and is guaranteed to define all symbols in the `std` namespace and also *may* define things in the global namespace. `<stddef.h>`is a C header and is guaranteed to define all symbo...
10,823,878
It seems on XCode I need to use std::size\_t instead of just size\_t on Visual C++. But this is a pain as I don't really want to have to `#include <cstddef>` and change every `size_t` to `std::size_t` in my code... in my Windows code `size_t` just works without including any additional files. Is there a way to make my...
2012/05/30
[ "https://Stackoverflow.com/questions/10823878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197229/" ]
According to the C++03 standard, 17.4.1.2.4: > > Except as noted in clauses 18 through 27, the contents of each header cname shall be the same as that of the corresponding header name.h, as specified in ISO/IEC 9899:1990 Programming Languages C (Clause 7), or ISO/IEC:1990 Programming Languages—C AMENDMENT 1: C Integr...
Perhaps saying this somewhere near the top ? ``` using std::size_t; ```
10,823,878
It seems on XCode I need to use std::size\_t instead of just size\_t on Visual C++. But this is a pain as I don't really want to have to `#include <cstddef>` and change every `size_t` to `std::size_t` in my code... in my Windows code `size_t` just works without including any additional files. Is there a way to make my...
2012/05/30
[ "https://Stackoverflow.com/questions/10823878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197229/" ]
According to the C++03 standard, 17.4.1.2.4: > > Except as noted in clauses 18 through 27, the contents of each header cname shall be the same as that of the corresponding header name.h, as specified in ISO/IEC 9899:1990 Programming Languages C (Clause 7), or ISO/IEC:1990 Programming Languages—C AMENDMENT 1: C Integr...
Use `#include <stddef.h>`. So, what's the difference between `#include <stddef.h>` and `#include <cstddef>`? `<cstddef>` is a C++ header and is guaranteed to define all symbols in the `std` namespace and also *may* define things in the global namespace. `<stddef.h>`is a C header and is guaranteed to define all symbo...
144,075
So from the [docs](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_testvisible.htm) I understand that `@TestVisible` is used to allow Unit Tests access to `private` and `protected` methods. What I was wondering is, when is it appropriate to use this annotation? For exa...
2016/10/12
[ "https://salesforce.stackexchange.com/questions/144075", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/22232/" ]
I think the question in your title is too broad and opinion based to touch on here. I have worked with many developers who feel the `@TestVisible` annotation should never be used, but regardless, I have found some instances where it felt like the best option. For me, it boils down to using it only when I need to be abl...
Generally, you'd use @TestVisible when you need to control the internal state of an object, *or* you need to observe the internal state of an object that can't be deduced from the outside. Generally speaking, this is only for particularly esoteric designs. I've personally never had a use for this annotation, but it can...
144,075
So from the [docs](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_testvisible.htm) I understand that `@TestVisible` is used to allow Unit Tests access to `private` and `protected` methods. What I was wondering is, when is it appropriate to use this annotation? For exa...
2016/10/12
[ "https://salesforce.stackexchange.com/questions/144075", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/22232/" ]
I think the question in your title is too broad and opinion based to touch on here. I have worked with many developers who feel the `@TestVisible` annotation should never be used, but regardless, I have found some instances where it felt like the best option. For me, it boils down to using it only when I need to be abl...
As an addendum to Adrian's answer: I use a lot of custom messaging assigned to final strings and they have an access of private ``` @TestVisible private static final string REQERROR = 'There was an error processing your request'; ``` Adding the @TestVisible annotation allows me to use this property in my test class...
7,330,395
I have a jquery plugin for my website which converts textareas / Inputs to Urdu Keyboard but that plugin doesn't work with ckeditor, because ckeditor takes some time to load. Request you to please let me know if there is a way to load my jquery plugin after some delay or when ckeditor is completely loaded? I have added...
2011/09/07
[ "https://Stackoverflow.com/questions/7330395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932187/" ]
Solution (without altering the indexes on my tables): ``` SELECT df.*, ( SELECT dfa.file_archive_id FROM dca_file_archive dfa WHERE df.file_id = dfa.file_id ORDER BY dfa.file_archive_version desc LIMIT 1 ) as file_archive_id, ( SELECT dfa.file_archive...
Try this (i named your tables `table1` and `table2`): ``` SELECT t1.fild_id, t1.file_name, t2A.file_archive_id, t2A.file_archive_version FROM table1 t1 JOIN table2 t2A ON (t1.fild_id = t2A.file_id) WHERE NOT EXISTS ( SELECT * FROM table2 t2B ...
7,330,395
I have a jquery plugin for my website which converts textareas / Inputs to Urdu Keyboard but that plugin doesn't work with ckeditor, because ckeditor takes some time to load. Request you to please let me know if there is a way to load my jquery plugin after some delay or when ckeditor is completely loaded? I have added...
2011/09/07
[ "https://Stackoverflow.com/questions/7330395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932187/" ]
Solution (without altering the indexes on my tables): ``` SELECT df.*, ( SELECT dfa.file_archive_id FROM dca_file_archive dfa WHERE df.file_id = dfa.file_id ORDER BY dfa.file_archive_version desc LIMIT 1 ) as file_archive_id, ( SELECT dfa.file_archive...
Try this one - ``` SELECT f.*, a1.file_archive_id, a1.file_archive_version FROM files f JOIN file_archives a1 ON f.file_id = a1.file_id JOIN ( SELECT file_id, MAX(file_archive_version) max_file_archive_version FROM file_archives GROUP BY file_id ) a2 ON a1.file_id = a2.file_id AND a1.file_archive_version = a2....
7,330,395
I have a jquery plugin for my website which converts textareas / Inputs to Urdu Keyboard but that plugin doesn't work with ckeditor, because ckeditor takes some time to load. Request you to please let me know if there is a way to load my jquery plugin after some delay or when ckeditor is completely loaded? I have added...
2011/09/07
[ "https://Stackoverflow.com/questions/7330395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932187/" ]
Solution (without altering the indexes on my tables): ``` SELECT df.*, ( SELECT dfa.file_archive_id FROM dca_file_archive dfa WHERE df.file_id = dfa.file_id ORDER BY dfa.file_archive_version desc LIMIT 1 ) as file_archive_id, ( SELECT dfa.file_archive...
t1 as first table, t2 as second table ``` SELECT t1.file_id as tx_id,t1.file_name,tx.file_archive_id,tx.file_archive_version FROM maindb.t1 t1,maindb.t2 tx WHERE t1.file_id = tx.file_id GROUP BY t1.file_id HAVING max(tx.file_archive_version) >= all ( SELECT max(t2.file_archive_version) FROM maindb.t2 WHER...
27,682,842
I am trying to make the text the user types of the search view white. "android:searchViewTextField" give an error. I can't find the right name for a global style: ``` <style name="AppTheme" parent="@style/_AppTheme"/> <style name="_AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:searc...
2014/12/29
[ "https://Stackoverflow.com/questions/27682842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172861/" ]
Define the theme "SearchTextViewTheme" ``` <style name="SearchTextViewTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:textColor">@color/white_color</item> </style> ``` Then inside the TextView ``` <TextView style="@style/SearchTextViewTheme" android:layout_width="wrap_content...
Here's how it's done ins `Xamarin` (I based the idea from **Patrick's** answer): ``` [assembly: ExportRenderer(typeof (CustomSearchBar), typeof (CustomSearchBarRenderer))] namespace Bahai.Android.Renderers { public class CustomSearchBarRenderer : SearchBarRenderer { protected overri...
27,682,842
I am trying to make the text the user types of the search view white. "android:searchViewTextField" give an error. I can't find the right name for a global style: ``` <style name="AppTheme" parent="@style/_AppTheme"/> <style name="_AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:searc...
2014/12/29
[ "https://Stackoverflow.com/questions/27682842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172861/" ]
Define the theme "SearchTextViewTheme" ``` <style name="SearchTextViewTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:textColor">@color/white_color</item> </style> ``` Then inside the TextView ``` <TextView style="@style/SearchTextViewTheme" android:layout_width="wrap_content...
If your targed SDK is 20 or less, the attributes Goolge uses to style the `SearchView` are hidden and you’ll end up with compilation errors if you try overriding them in your theme. You can use the AppCompat v20 `SearchView` instead of the the native `SearchView` following this [tutorial](http://www.jayway.com/2014/06...
27,682,842
I am trying to make the text the user types of the search view white. "android:searchViewTextField" give an error. I can't find the right name for a global style: ``` <style name="AppTheme" parent="@style/_AppTheme"/> <style name="_AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:searc...
2014/12/29
[ "https://Stackoverflow.com/questions/27682842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172861/" ]
Define the theme "SearchTextViewTheme" ``` <style name="SearchTextViewTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:textColor">@color/white_color</item> </style> ``` Then inside the TextView ``` <TextView style="@style/SearchTextViewTheme" android:layout_width="wrap_content...
this did the trick ``` <style name="myTheme" parent="@style/Theme.AppCompat.Light"> <item name="android:editTextColor">#fffff</item> </style> ``` The above solutions might work in java but they don't work in xamarin and i guess this solution will work in java.
27,682,842
I am trying to make the text the user types of the search view white. "android:searchViewTextField" give an error. I can't find the right name for a global style: ``` <style name="AppTheme" parent="@style/_AppTheme"/> <style name="_AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:searc...
2014/12/29
[ "https://Stackoverflow.com/questions/27682842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172861/" ]
If your targed SDK is 20 or less, the attributes Goolge uses to style the `SearchView` are hidden and you’ll end up with compilation errors if you try overriding them in your theme. You can use the AppCompat v20 `SearchView` instead of the the native `SearchView` following this [tutorial](http://www.jayway.com/2014/06...
Here's how it's done ins `Xamarin` (I based the idea from **Patrick's** answer): ``` [assembly: ExportRenderer(typeof (CustomSearchBar), typeof (CustomSearchBarRenderer))] namespace Bahai.Android.Renderers { public class CustomSearchBarRenderer : SearchBarRenderer { protected overri...
27,682,842
I am trying to make the text the user types of the search view white. "android:searchViewTextField" give an error. I can't find the right name for a global style: ``` <style name="AppTheme" parent="@style/_AppTheme"/> <style name="_AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:searc...
2014/12/29
[ "https://Stackoverflow.com/questions/27682842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172861/" ]
If your targed SDK is 20 or less, the attributes Goolge uses to style the `SearchView` are hidden and you’ll end up with compilation errors if you try overriding them in your theme. You can use the AppCompat v20 `SearchView` instead of the the native `SearchView` following this [tutorial](http://www.jayway.com/2014/06...
this did the trick ``` <style name="myTheme" parent="@style/Theme.AppCompat.Light"> <item name="android:editTextColor">#fffff</item> </style> ``` The above solutions might work in java but they don't work in xamarin and i guess this solution will work in java.
33,542,959
If I don't know how many arguments a function will be passed, I *could* write the function using argument packing: ``` def add(factor, *nums): """Add numbers and multiply by factor.""" return sum(nums) * factor ``` Alternatively, I could avoid argument packing by passing a list of numbers as the argument: `...
2015/11/05
[ "https://Stackoverflow.com/questions/33542959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/797744/" ]
`*args`/`**kwargs` has its advantages, generally in cases where you want to be able to pass in an unpacked data structure, while retaining the ability to work with packed ones. Python 3's `print()` is a good example. ``` print('hi') print('you have', num, 'potatoes') print(*mylist) ``` Contrast that with what it wou...
It's about the API: \*args provides a better interface, as it states that the method accepts an arbitrary number of arguments AND that's it - no further assumptions. You know for sure that the method itself will not do anything else with the data structure containing the various arguments AND that no special data struc...
33,542,959
If I don't know how many arguments a function will be passed, I *could* write the function using argument packing: ``` def add(factor, *nums): """Add numbers and multiply by factor.""" return sum(nums) * factor ``` Alternatively, I could avoid argument packing by passing a list of numbers as the argument: `...
2015/11/05
[ "https://Stackoverflow.com/questions/33542959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/797744/" ]
`*args`/`**kwargs` has its advantages, generally in cases where you want to be able to pass in an unpacked data structure, while retaining the ability to work with packed ones. Python 3's `print()` is a good example. ``` print('hi') print('you have', num, 'potatoes') print(*mylist) ``` Contrast that with what it wou...
This is kind of an old one, but to answer @DBrenko's queries about when \*args and \*\*kwargs would be required, the clearest example I have found is when you want a function that runs another function as part of its execution. As a simple example: ``` import datetime def timeFunction(function, *args, **kwargs): ...
53,392,726
I come asking for quite a specific question regarding Flutter and the Future and await mechanism, which seems to be working, but my Clipboard does not really function while operating with my editable text fields, even following Google's advice on implementation... This is my code for pasting: ``` onPressed: () async ...
2018/11/20
[ "https://Stackoverflow.com/questions/53392726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8845653/" ]
You can simply re-use Flutter's existing library code to `getData` from Clipboard. ``` ClipboardData data = await Clipboard.getData('text/plain'); ```
It's works for me: ```dart _getFromClipboard() async { Map<String, dynamic> result = await SystemChannels.platform.invokeMethod('Clipboard.getData'); if (result != null) { return result['text'].toString(); } return ''; } ```
53,392,726
I come asking for quite a specific question regarding Flutter and the Future and await mechanism, which seems to be working, but my Clipboard does not really function while operating with my editable text fields, even following Google's advice on implementation... This is my code for pasting: ``` onPressed: () async ...
2018/11/20
[ "https://Stackoverflow.com/questions/53392726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8845653/" ]
First create a method ``` Future<String> getClipBoardData() async { ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain); return data.text; } ``` Then in build method ``` FutureBuilder( future: getClipBoardData(), initialData: 'nothing', ...
It's works for me: ```dart _getFromClipboard() async { Map<String, dynamic> result = await SystemChannels.platform.invokeMethod('Clipboard.getData'); if (result != null) { return result['text'].toString(); } return ''; } ```
53,392,726
I come asking for quite a specific question regarding Flutter and the Future and await mechanism, which seems to be working, but my Clipboard does not really function while operating with my editable text fields, even following Google's advice on implementation... This is my code for pasting: ``` onPressed: () async ...
2018/11/20
[ "https://Stackoverflow.com/questions/53392726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8845653/" ]
You can simply re-use Flutter's existing library code to `getData` from Clipboard. ``` ClipboardData data = await Clipboard.getData('text/plain'); ```
Also can be useful if you want to listen for periodic updates from the system clipboard. [Originally I replied here](https://stackoverflow.com/questions/50647727/how-do-i-monitor-the-clipboard-in-flutter/55596589#55596589), just re-posting the solution: ``` #creating a listening Stream: final clipboardContentStream =...
53,392,726
I come asking for quite a specific question regarding Flutter and the Future and await mechanism, which seems to be working, but my Clipboard does not really function while operating with my editable text fields, even following Google's advice on implementation... This is my code for pasting: ``` onPressed: () async ...
2018/11/20
[ "https://Stackoverflow.com/questions/53392726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8845653/" ]
You can simply re-use Flutter's existing library code to `getData` from Clipboard. ``` ClipboardData data = await Clipboard.getData('text/plain'); ```
First create a method ``` Future<String> getClipBoardData() async { ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain); return data.text; } ``` Then in build method ``` FutureBuilder( future: getClipBoardData(), initialData: 'nothing', ...
53,392,726
I come asking for quite a specific question regarding Flutter and the Future and await mechanism, which seems to be working, but my Clipboard does not really function while operating with my editable text fields, even following Google's advice on implementation... This is my code for pasting: ``` onPressed: () async ...
2018/11/20
[ "https://Stackoverflow.com/questions/53392726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8845653/" ]
First create a method ``` Future<String> getClipBoardData() async { ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain); return data.text; } ``` Then in build method ``` FutureBuilder( future: getClipBoardData(), initialData: 'nothing', ...
Also can be useful if you want to listen for periodic updates from the system clipboard. [Originally I replied here](https://stackoverflow.com/questions/50647727/how-do-i-monitor-the-clipboard-in-flutter/55596589#55596589), just re-posting the solution: ``` #creating a listening Stream: final clipboardContentStream =...
11,677
Darussalam publishes a copy of [Riyad-us-Saliheen](https://www.goodreads.com/book/show/507739.Riyad_us_Saliheen) which, in addition to the actual ahadith compiled by Al-Nawawi, includes commentary by one Hafiz Salahuddin Yusuf. The introduction to the collection provides no information on the commentator except that h...
2014/03/06
[ "https://islam.stackexchange.com/questions/11677", "https://islam.stackexchange.com", "https://islam.stackexchange.com/users/22/" ]
Asalam o Alikum brothers and sister, Hafiz Salahuddin Yusuf is a great scholar and had some appearance/lectures/interview on PeaceTV which is famous for it's spreading of Islam only based on Quran and Sahih Hadit (Hadees). I also bought a book from my friends book shop (Ahsan ul Bayan). He recommended that it is aut...
He focussed pretty much to prove several ahadees Daeef included in the text of Riyadhussaliheen that suggest practice against the practices of Salafiyah, from which I concluded that he is trying to say that Imaam UL Nawawi had less understanding of which Hadeeth to include and which to not include in his book. I think ...
11,677
Darussalam publishes a copy of [Riyad-us-Saliheen](https://www.goodreads.com/book/show/507739.Riyad_us_Saliheen) which, in addition to the actual ahadith compiled by Al-Nawawi, includes commentary by one Hafiz Salahuddin Yusuf. The introduction to the collection provides no information on the commentator except that h...
2014/03/06
[ "https://islam.stackexchange.com/questions/11677", "https://islam.stackexchange.com", "https://islam.stackexchange.com/users/22/" ]
Haafiz Salaah-ud-Deen Yoosuf is Head of Darussalam's Research Division in Lahore. He was formerly: - Islamic Legal Consultant to the Federal Shariat Court of Pakistan, and - Editor-in-Chief of al-I'tisaam magazine.
Asalam o Alikum brothers and sister, Hafiz Salahuddin Yusuf is a great scholar and had some appearance/lectures/interview on PeaceTV which is famous for it's spreading of Islam only based on Quran and Sahih Hadit (Hadees). I also bought a book from my friends book shop (Ahsan ul Bayan). He recommended that it is aut...
11,677
Darussalam publishes a copy of [Riyad-us-Saliheen](https://www.goodreads.com/book/show/507739.Riyad_us_Saliheen) which, in addition to the actual ahadith compiled by Al-Nawawi, includes commentary by one Hafiz Salahuddin Yusuf. The introduction to the collection provides no information on the commentator except that h...
2014/03/06
[ "https://islam.stackexchange.com/questions/11677", "https://islam.stackexchange.com", "https://islam.stackexchange.com/users/22/" ]
Haafiz Salaah-ud-Deen Yoosuf is Head of Darussalam's Research Division in Lahore. He was formerly: - Islamic Legal Consultant to the Federal Shariat Court of Pakistan, and - Editor-in-Chief of al-I'tisaam magazine.
He focussed pretty much to prove several ahadees Daeef included in the text of Riyadhussaliheen that suggest practice against the practices of Salafiyah, from which I concluded that he is trying to say that Imaam UL Nawawi had less understanding of which Hadeeth to include and which to not include in his book. I think ...
7,219
First, a bit of background. I've been training kungfu for nearly a decade now. During all these years, I had the nagging feeling something essential was missing. Shifu sometimes told me to follow tai chi classes as well, as it would make my movements more fluid. An opportunity to train tai chi with a good, proper train...
2017/02/14
[ "https://martialarts.stackexchange.com/questions/7219", "https://martialarts.stackexchange.com", "https://martialarts.stackexchange.com/users/7414/" ]
"Leaning out of axis" is, in my mind, a combination of three separate ideas. It's not clear to me how your idea relates to mine, so here are all of the elements as I understand them: 1. **Balance** Your center of mass is supported by your base. 2. **Alignment** The relative positions of your body parts are conducive t...
I don't know about the axis part of your question, but a good way to self-check is to use your smartphone or tablet with the video camera. I do this a lot.
7,219
First, a bit of background. I've been training kungfu for nearly a decade now. During all these years, I had the nagging feeling something essential was missing. Shifu sometimes told me to follow tai chi classes as well, as it would make my movements more fluid. An opportunity to train tai chi with a good, proper train...
2017/02/14
[ "https://martialarts.stackexchange.com/questions/7219", "https://martialarts.stackexchange.com", "https://martialarts.stackexchange.com/users/7414/" ]
"Leaning out of axis" is, in my mind, a combination of three separate ideas. It's not clear to me how your idea relates to mine, so here are all of the elements as I understand them: 1. **Balance** Your center of mass is supported by your base. 2. **Alignment** The relative positions of your body parts are conducive t...
Answering my own question... Oh geez... The past few days I've noticed some things during day to day office life, which can be helpful, and is very, very simple. When walking, I tend to walk fast. When taking stairs, I tend to take two steps at a time. If I'm carrying a coffee or a glass of water, the liquid swashes a...
7,219
First, a bit of background. I've been training kungfu for nearly a decade now. During all these years, I had the nagging feeling something essential was missing. Shifu sometimes told me to follow tai chi classes as well, as it would make my movements more fluid. An opportunity to train tai chi with a good, proper train...
2017/02/14
[ "https://martialarts.stackexchange.com/questions/7219", "https://martialarts.stackexchange.com", "https://martialarts.stackexchange.com/users/7414/" ]
"Leaning out of axis" is, in my mind, a combination of three separate ideas. It's not clear to me how your idea relates to mine, so here are all of the elements as I understand them: 1. **Balance** Your center of mass is supported by your base. 2. **Alignment** The relative positions of your body parts are conducive t...
I would recommend trying chi kung - in the book by Lam Kam Chuen, the simple standing 'pose' of wu chi is introduced. Nothing could be simpler to learn, but over the months and years, this simple stance teaches you everything. It's enhanced my martial arts practice beyond measure. It may or may not correct your leaning...
7,219
First, a bit of background. I've been training kungfu for nearly a decade now. During all these years, I had the nagging feeling something essential was missing. Shifu sometimes told me to follow tai chi classes as well, as it would make my movements more fluid. An opportunity to train tai chi with a good, proper train...
2017/02/14
[ "https://martialarts.stackexchange.com/questions/7219", "https://martialarts.stackexchange.com", "https://martialarts.stackexchange.com/users/7414/" ]
I don't know about the axis part of your question, but a good way to self-check is to use your smartphone or tablet with the video camera. I do this a lot.
Answering my own question... Oh geez... The past few days I've noticed some things during day to day office life, which can be helpful, and is very, very simple. When walking, I tend to walk fast. When taking stairs, I tend to take two steps at a time. If I'm carrying a coffee or a glass of water, the liquid swashes a...
7,219
First, a bit of background. I've been training kungfu for nearly a decade now. During all these years, I had the nagging feeling something essential was missing. Shifu sometimes told me to follow tai chi classes as well, as it would make my movements more fluid. An opportunity to train tai chi with a good, proper train...
2017/02/14
[ "https://martialarts.stackexchange.com/questions/7219", "https://martialarts.stackexchange.com", "https://martialarts.stackexchange.com/users/7414/" ]
I would recommend trying chi kung - in the book by Lam Kam Chuen, the simple standing 'pose' of wu chi is introduced. Nothing could be simpler to learn, but over the months and years, this simple stance teaches you everything. It's enhanced my martial arts practice beyond measure. It may or may not correct your leaning...
Answering my own question... Oh geez... The past few days I've noticed some things during day to day office life, which can be helpful, and is very, very simple. When walking, I tend to walk fast. When taking stairs, I tend to take two steps at a time. If I'm carrying a coffee or a glass of water, the liquid swashes a...
454,917
I do not understand how this voltage multiplier circuit works: [![enter image description here](https://i.stack.imgur.com/9ghpa.png)](https://i.stack.imgur.com/9ghpa.png) wherever I have read (also Wikipedia), I have not found a step by step explanation. I do not understand if the voltage drop across the diodes in co...
2019/08/27
[ "https://electronics.stackexchange.com/questions/454917", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/214898/" ]
As Bimpelrekkie explained, whether or not the voltage drop of the diodes is significant or not depends on what voltage you are working with. Since I've been playing with these things for the last few days, I'll post some of the diagrams and measurements I've made. I think the voltage traces explain fairly what happe...
> > I do not understand if the voltage drop across the diodes in conduction is negligible or not > > > It is not a case of "negligible or not", as with many things in electronics: **it depends**. The diodes have a certain forward voltage, typically between 0.5 V to 1.0 V depending on how much current flows though...
454,917
I do not understand how this voltage multiplier circuit works: [![enter image description here](https://i.stack.imgur.com/9ghpa.png)](https://i.stack.imgur.com/9ghpa.png) wherever I have read (also Wikipedia), I have not found a step by step explanation. I do not understand if the voltage drop across the diodes in co...
2019/08/27
[ "https://electronics.stackexchange.com/questions/454917", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/214898/" ]
The Vf drop of the diode does have a significant, cumulative effect. Each stage reduces the output voltage by one Vf drop. In the example below, there are two stages. With a 10Vp-p input, the output voltage is 18.66V instead of 20. The difference is two Vf diode drops of 0.66V each (1.33V total.) ![schematic](https:/...
> > I do not understand if the voltage drop across the diodes in conduction is negligible or not > > > It is not a case of "negligible or not", as with many things in electronics: **it depends**. The diodes have a certain forward voltage, typically between 0.5 V to 1.0 V depending on how much current flows though...
454,917
I do not understand how this voltage multiplier circuit works: [![enter image description here](https://i.stack.imgur.com/9ghpa.png)](https://i.stack.imgur.com/9ghpa.png) wherever I have read (also Wikipedia), I have not found a step by step explanation. I do not understand if the voltage drop across the diodes in co...
2019/08/27
[ "https://electronics.stackexchange.com/questions/454917", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/214898/" ]
As Bimpelrekkie explained, whether or not the voltage drop of the diodes is significant or not depends on what voltage you are working with. Since I've been playing with these things for the last few days, I'll post some of the diagrams and measurements I've made. I think the voltage traces explain fairly what happe...
The Vf drop of the diode does have a significant, cumulative effect. Each stage reduces the output voltage by one Vf drop. In the example below, there are two stages. With a 10Vp-p input, the output voltage is 18.66V instead of 20. The difference is two Vf diode drops of 0.66V each (1.33V total.) ![schematic](https:/...
454,917
I do not understand how this voltage multiplier circuit works: [![enter image description here](https://i.stack.imgur.com/9ghpa.png)](https://i.stack.imgur.com/9ghpa.png) wherever I have read (also Wikipedia), I have not found a step by step explanation. I do not understand if the voltage drop across the diodes in co...
2019/08/27
[ "https://electronics.stackexchange.com/questions/454917", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/214898/" ]
As Bimpelrekkie explained, whether or not the voltage drop of the diodes is significant or not depends on what voltage you are working with. Since I've been playing with these things for the last few days, I'll post some of the diagrams and measurements I've made. I think the voltage traces explain fairly what happe...
Remove all components except for D1 and C1. Analyse the circuit behaviour. Now add in D2 and C2. What's different? What's the same? Now add D3 and C3. What's the same and what's different? Do you notice a pattern? Generalise to adding an arbitrary number of Ds and Cs in the same pattern.
454,917
I do not understand how this voltage multiplier circuit works: [![enter image description here](https://i.stack.imgur.com/9ghpa.png)](https://i.stack.imgur.com/9ghpa.png) wherever I have read (also Wikipedia), I have not found a step by step explanation. I do not understand if the voltage drop across the diodes in co...
2019/08/27
[ "https://electronics.stackexchange.com/questions/454917", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/214898/" ]
The Vf drop of the diode does have a significant, cumulative effect. Each stage reduces the output voltage by one Vf drop. In the example below, there are two stages. With a 10Vp-p input, the output voltage is 18.66V instead of 20. The difference is two Vf diode drops of 0.66V each (1.33V total.) ![schematic](https:/...
Remove all components except for D1 and C1. Analyse the circuit behaviour. Now add in D2 and C2. What's different? What's the same? Now add D3 and C3. What's the same and what's different? Do you notice a pattern? Generalise to adding an arbitrary number of Ds and Cs in the same pattern.
59,762,078
To my current understanding, the pattern below should work (expected `['bar', 'FOO', 'bar']`), but only the first alternative is found (zero-width matches after FOO, but not before). ```vim echo split('barFOObar', '\v(FOO\zs|\zeFOO)') " --> ['barFOO', 'bar'] ``` Netiher could I solve it with lookahead/lookbehind. ...
2020/01/16
[ "https://Stackoverflow.com/questions/59762078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11020321/" ]
There doesn't seem to be a way to accomplish that direct result using a single `split()`. In fact, the docs for `split()` mention this particular situation of preserving the delimiter, with: > > If you want to keep the separator you can also use `\zs` at the end of the pattern: > > > > ``` > :echo split('abc:def:g...
You could first replace `FOO` with `-FOO-`, then split the string. For example: ``` :echo split(substitute('barFOObarFOObaz', 'FOO','-&-','g'),'-') ['bar', 'FOO', 'bar', 'FOO', 'baz'] ```
58,394,061
I want to remove elements from a numpy vector that are closer than a distance d. (I don't want any pair in the array or list that have a smaller distance between them than d but don't want to remove the pair completely otherwise. for example if my array is: > > > ``` > array([[0. ], > [0.9486833], > ...
2019/10/15
[ "https://Stackoverflow.com/questions/58394061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10392393/" ]
Here's a solution, using only a list. Note that this modifies the original list, so if you want to keep the original, copy.deepcopy it. ``` THRESHOLD = 0.1 def wrangle(l): for i in range(len(l)): for j in range(len(l)-1, i, -1): if abs(l[i] - l[j]) < THRESHOLD: l.pop(j) ``...
If your array is really only 1-d you can flatten it and do something like this: ``` a=tf.constant(np.array([[0. ], [0.9486833], [1.8973666], [2.8460498], [0.9486833]], dtype=np.float32)) d = 0.1 flat_a = tf.reshape(...
58,394,061
I want to remove elements from a numpy vector that are closer than a distance d. (I don't want any pair in the array or list that have a smaller distance between them than d but don't want to remove the pair completely otherwise. for example if my array is: > > > ``` > array([[0. ], > [0.9486833], > ...
2019/10/15
[ "https://Stackoverflow.com/questions/58394061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10392393/" ]
using `numpy`: ```py import numpy as np a = np.array([[0. ], [0.9486833], [1.8973666], [2.8460498], [0.9486833]]) threshold = 1.0 # The indices of the items smaller than a certain threshold, but larger than 0. smaller_than = np.flatnonzero(np.logical_and(...
If your array is really only 1-d you can flatten it and do something like this: ``` a=tf.constant(np.array([[0. ], [0.9486833], [1.8973666], [2.8460498], [0.9486833]], dtype=np.float32)) d = 0.1 flat_a = tf.reshape(...
2,206,281
I have to show this: Let $A = \{ x \in \mathbb{Z} : 3|x \}$ and $f : A \rightarrow \mathbb{N}$. Show that $A$ and $\mathbb{N}$ have the same cardinality. I know that when $a \in A \geq 0$, every element in $A$ maps to a unique element in $\mathbb{N}$. For example, $(0,0),(3,1),(6,2),(9,3)$, etc. Which means when $a \...
2017/03/28
[ "https://math.stackexchange.com/questions/2206281", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
It is enough to understand if the integrand function is integrable in a right neighbourhood of the origin and in a left neighbourhood of $+\infty$. $\sin(x)^2$ behaves like $x^2$ in a right neighbourhood of the origin and it is a non-negative function with mean value $\frac{1}{2}$, hence $$ \int\_{0}^{+\infty}\frac{\si...
Note that $$\begin{align} \int\_1^L \frac{\sin^2(x)}{x}\,dx&=\frac12\int\_1^L \frac{1-\cos(2x)}{x}\,dx\\\\ &=\frac12\log(L)-\frac12\int\_2^{2L}\frac{\cos(x)}{x}\,dx\tag 1 \end{align}$$ From [Abel's (Dirichlet's) Test](https://en.wikipedia.org/wiki/Dirichlet%27s_test#Improper_integrals) for improper integrals, the in...
2,206,281
I have to show this: Let $A = \{ x \in \mathbb{Z} : 3|x \}$ and $f : A \rightarrow \mathbb{N}$. Show that $A$ and $\mathbb{N}$ have the same cardinality. I know that when $a \in A \geq 0$, every element in $A$ maps to a unique element in $\mathbb{N}$. For example, $(0,0),(3,1),(6,2),(9,3)$, etc. Which means when $a \...
2017/03/28
[ "https://math.stackexchange.com/questions/2206281", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
For $(\sin^2{x})/x$: Divide the integration range up into intervals $[n\pi,(n+1)\pi]$ for $n=0,1,2,\dotsc$. Then on such an interval, $$ \frac{\sin^2{x}}{x} \geq \frac{\sin^2{x}}{(n+1)\pi}, $$ since $1/x$ is decreasing. Then $\int\_{n\pi}^{(n+1)\pi} \sin^2{x} \, dx = \pi/2$, so integrating both sides of the inequality ...
Note that $$\begin{align} \int\_1^L \frac{\sin^2(x)}{x}\,dx&=\frac12\int\_1^L \frac{1-\cos(2x)}{x}\,dx\\\\ &=\frac12\log(L)-\frac12\int\_2^{2L}\frac{\cos(x)}{x}\,dx\tag 1 \end{align}$$ From [Abel's (Dirichlet's) Test](https://en.wikipedia.org/wiki/Dirichlet%27s_test#Improper_integrals) for improper integrals, the in...
35,805,804
Hi I was wondering if it's possible to leverage Spring annotated Caching within Scala. I have tried but am receiving the error below. I am running the application from a java package that depends on the scala package. ``` No cache could be resolved for 'CacheableOperation[public scala.collection.immutable.List Mercha...
2016/03/04
[ "https://Stackoverflow.com/questions/35805804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6020194/" ]
Add a name to the @Cacheable annotation: ``` @Cacheable(Array("MerchantDataGateway.getAllMerchants")) ```
It needed a name, or an entry for the value ``` @Cacheable(value = Array("MerchantDataGateway.getAllMerchants") ```
235,791
I am considering buying a Game Boy Advance. I like the 1st generation model, but I don't know if the screen is bright enough for normal indoor use or not. Is screen brightness likely to be an issue, and if so, what can I do to help with the problem?
2015/09/08
[ "https://gaming.stackexchange.com/questions/235791", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/124363/" ]
It can be seen indoors, but there's no backlighting so it's tough (if not impossible) to see in the dark. There were several [peripherals](http://rads.stackoverflow.com/amzn/click/B004910A8I) released to solve this problem, so if you're dead-set on the original model you do have options. If the model isn't that importa...
I can't recommend the SP enough if you're going to play any version of the Game Boy Advance. Slickest design, more durable than it looks too, and of course the backlit screen is a must. I can't envision liking the 1st generation model enough to offset the annoyance by not having a backlit screen. It is playable indoors...
3,501,222
To find the area of segment of a circle, I used the following formula: $\frac{r^2}{2} (\theta$ - $\sin \theta$) But if the area is given and I want to find the angle $\theta$ how can I do that. $\theta$ - $\sin \theta$ = $\frac{2A}{r^2}$ where A and r are the given values of area and radius of the circle ...
2020/01/08
[ "https://math.stackexchange.com/questions/3501222", "https://math.stackexchange.com", "https://math.stackexchange.com/users/634349/" ]
It is enough to solve for $\theta\in[0,\pi]$, other ranges can be handled by symmetry. For small angles, the Taylor expansion to the third order is $$r:=\theta-\sin\theta\approx\frac{\theta^3}{6}$$ and can be used to find a simple approximation $$\theta\approx \sqrt[3]{6r}.$$ And you get an even better approximatio...
As Lord Shark pointed out there is no closed form expression to calculate $\theta$. I am not aware of any series expansion either. What I can give you is a formula that can be used to determine an approximate value for $\theta$. The values obtained are good only for small $\theta$ (i.e. $\lt \frac{\pi}{2})$. $$\theta\a...
3,501,222
To find the area of segment of a circle, I used the following formula: $\frac{r^2}{2} (\theta$ - $\sin \theta$) But if the area is given and I want to find the angle $\theta$ how can I do that. $\theta$ - $\sin \theta$ = $\frac{2A}{r^2}$ where A and r are the given values of area and radius of the circle ...
2020/01/08
[ "https://math.stackexchange.com/questions/3501222", "https://math.stackexchange.com", "https://math.stackexchange.com/users/634349/" ]
Considering that you want to work with $\theta -\sin (\theta )$, use Taylor series to get $$\theta -\sin (\theta )=\frac{\theta ^3}{6}-\frac{\theta ^5}{120}+\frac{\theta ^7}{5040}-\frac{\theta ^9}{362880}+O\left(\theta ^{11}\right)$$ If you look at the plots of the lhs and rhs, you will not see any difference for $0 \...
As Lord Shark pointed out there is no closed form expression to calculate $\theta$. I am not aware of any series expansion either. What I can give you is a formula that can be used to determine an approximate value for $\theta$. The values obtained are good only for small $\theta$ (i.e. $\lt \frac{\pi}{2})$. $$\theta\a...
13,996,965
I need to create a custom class that extends `MapFragment`. I am not sure how to instantiatemy new class, so that MapFragment will be instantiated in the correct way. MapFragment are suppose to be created by doing ``` MapFragment.newInstance(options) ``` If I have my own class, that extends MapFragment ``` publi...
2012/12/21
[ "https://Stackoverflow.com/questions/13996965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/995350/" ]
Apache POI is a good librairy to read xsl and xslx format. To read a file just instanciate a new `XSSFWorkbook` by passing a new FileInputStream with the path of the Excel file: ``` XSSFWorkbook workbook = new XSSFWorkbook(OPCPackage.open(new File("foo.xslx"))); ``` Or with an input stream (takes a little more memo...
Using POI 3.8 and poi-ooxml-3.8, I've had success with something like this (i've not tried older versions): ``` InputStream is = //Open file, and get inputstream Workbook workBook = WorkbookFactory.create(is); int totalSheets = workBook.getNumberOfSheets(); for (int i = 0; i <= totalSheets - 1; i++) { Sheet sheet = ...
13,996,965
I need to create a custom class that extends `MapFragment`. I am not sure how to instantiatemy new class, so that MapFragment will be instantiated in the correct way. MapFragment are suppose to be created by doing ``` MapFragment.newInstance(options) ``` If I have my own class, that extends MapFragment ``` publi...
2012/12/21
[ "https://Stackoverflow.com/questions/13996965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/995350/" ]
Apache POI is a good librairy to read xsl and xslx format. To read a file just instanciate a new `XSSFWorkbook` by passing a new FileInputStream with the path of the Excel file: ``` XSSFWorkbook workbook = new XSSFWorkbook(OPCPackage.open(new File("foo.xslx"))); ``` Or with an input stream (takes a little more memo...
I ended up using this modification of AbstractExcelView <https://github.com/hmkcode/Spring-Framework/blob/master/spring-mvc-json-pdf-xls-excel/src/main/java/com/hmkcode/view/abstractview/AbstractExcelView.java>
13,996,965
I need to create a custom class that extends `MapFragment`. I am not sure how to instantiatemy new class, so that MapFragment will be instantiated in the correct way. MapFragment are suppose to be created by doing ``` MapFragment.newInstance(options) ``` If I have my own class, that extends MapFragment ``` publi...
2012/12/21
[ "https://Stackoverflow.com/questions/13996965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/995350/" ]
Apache POI is a good librairy to read xsl and xslx format. To read a file just instanciate a new `XSSFWorkbook` by passing a new FileInputStream with the path of the Excel file: ``` XSSFWorkbook workbook = new XSSFWorkbook(OPCPackage.open(new File("foo.xslx"))); ``` Or with an input stream (takes a little more memo...
Add following dependencies in your code. ``` <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.17</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --> <dependency> <grou...
13,996,965
I need to create a custom class that extends `MapFragment`. I am not sure how to instantiatemy new class, so that MapFragment will be instantiated in the correct way. MapFragment are suppose to be created by doing ``` MapFragment.newInstance(options) ``` If I have my own class, that extends MapFragment ``` publi...
2012/12/21
[ "https://Stackoverflow.com/questions/13996965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/995350/" ]
Apache POI is a good librairy to read xsl and xslx format. To read a file just instanciate a new `XSSFWorkbook` by passing a new FileInputStream with the path of the Excel file: ``` XSSFWorkbook workbook = new XSSFWorkbook(OPCPackage.open(new File("foo.xslx"))); ``` Or with an input stream (takes a little more memo...
Add dependencies in pom.xml - ``` <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.15</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.15</version> </d...
13,996,965
I need to create a custom class that extends `MapFragment`. I am not sure how to instantiatemy new class, so that MapFragment will be instantiated in the correct way. MapFragment are suppose to be created by doing ``` MapFragment.newInstance(options) ``` If I have my own class, that extends MapFragment ``` publi...
2012/12/21
[ "https://Stackoverflow.com/questions/13996965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/995350/" ]
Using POI 3.8 and poi-ooxml-3.8, I've had success with something like this (i've not tried older versions): ``` InputStream is = //Open file, and get inputstream Workbook workBook = WorkbookFactory.create(is); int totalSheets = workBook.getNumberOfSheets(); for (int i = 0; i <= totalSheets - 1; i++) { Sheet sheet = ...
I ended up using this modification of AbstractExcelView <https://github.com/hmkcode/Spring-Framework/blob/master/spring-mvc-json-pdf-xls-excel/src/main/java/com/hmkcode/view/abstractview/AbstractExcelView.java>
13,996,965
I need to create a custom class that extends `MapFragment`. I am not sure how to instantiatemy new class, so that MapFragment will be instantiated in the correct way. MapFragment are suppose to be created by doing ``` MapFragment.newInstance(options) ``` If I have my own class, that extends MapFragment ``` publi...
2012/12/21
[ "https://Stackoverflow.com/questions/13996965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/995350/" ]
Using POI 3.8 and poi-ooxml-3.8, I've had success with something like this (i've not tried older versions): ``` InputStream is = //Open file, and get inputstream Workbook workBook = WorkbookFactory.create(is); int totalSheets = workBook.getNumberOfSheets(); for (int i = 0; i <= totalSheets - 1; i++) { Sheet sheet = ...
Add following dependencies in your code. ``` <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.17</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --> <dependency> <grou...
13,996,965
I need to create a custom class that extends `MapFragment`. I am not sure how to instantiatemy new class, so that MapFragment will be instantiated in the correct way. MapFragment are suppose to be created by doing ``` MapFragment.newInstance(options) ``` If I have my own class, that extends MapFragment ``` publi...
2012/12/21
[ "https://Stackoverflow.com/questions/13996965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/995350/" ]
Using POI 3.8 and poi-ooxml-3.8, I've had success with something like this (i've not tried older versions): ``` InputStream is = //Open file, and get inputstream Workbook workBook = WorkbookFactory.create(is); int totalSheets = workBook.getNumberOfSheets(); for (int i = 0; i <= totalSheets - 1; i++) { Sheet sheet = ...
Add dependencies in pom.xml - ``` <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.15</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.15</version> </d...
13,996,965
I need to create a custom class that extends `MapFragment`. I am not sure how to instantiatemy new class, so that MapFragment will be instantiated in the correct way. MapFragment are suppose to be created by doing ``` MapFragment.newInstance(options) ``` If I have my own class, that extends MapFragment ``` publi...
2012/12/21
[ "https://Stackoverflow.com/questions/13996965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/995350/" ]
Add following dependencies in your code. ``` <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.17</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --> <dependency> <grou...
I ended up using this modification of AbstractExcelView <https://github.com/hmkcode/Spring-Framework/blob/master/spring-mvc-json-pdf-xls-excel/src/main/java/com/hmkcode/view/abstractview/AbstractExcelView.java>
13,996,965
I need to create a custom class that extends `MapFragment`. I am not sure how to instantiatemy new class, so that MapFragment will be instantiated in the correct way. MapFragment are suppose to be created by doing ``` MapFragment.newInstance(options) ``` If I have my own class, that extends MapFragment ``` publi...
2012/12/21
[ "https://Stackoverflow.com/questions/13996965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/995350/" ]
Add following dependencies in your code. ``` <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.17</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --> <dependency> <grou...
Add dependencies in pom.xml - ``` <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.15</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.15</version> </d...
5,361,521
I want to have a task that will execute every 5 minutes, but it will wait for last execution to finish and then start to count this 5 minutes. (This way I can also be sure that there is only one task running) The easiest way I found is to run django application manage.py shell and run this: ``` while True: result ...
2011/03/19
[ "https://Stackoverflow.com/questions/5361521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
All you need is specify in celery conf witch task you want to run periodically and with which interval. Example: Run the tasks.add task every 30 seconds ``` from datetime import timedelta CELERYBEAT_SCHEDULE = { "runs-every-30-seconds": { "task": "tasks.add", "schedule": timedelta(seconds=30), ...
Because of celery.decorators deprecated, you can use periodic\_task decorator like that: ``` from celery.task.base import periodic_task from django.utils.timezone import timedelta @periodic_task(run_every=timedelta(seconds=5)) def my_background_process(): # insert code ```
5,361,521
I want to have a task that will execute every 5 minutes, but it will wait for last execution to finish and then start to count this 5 minutes. (This way I can also be sure that there is only one task running) The easiest way I found is to run django application manage.py shell and run this: ``` while True: result ...
2011/03/19
[ "https://Stackoverflow.com/questions/5361521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
All you need is specify in celery conf witch task you want to run periodically and with which interval. Example: Run the tasks.add task every 30 seconds ``` from datetime import timedelta CELERYBEAT_SCHEDULE = { "runs-every-30-seconds": { "task": "tasks.add", "schedule": timedelta(seconds=30), ...
Add that task to a separate queue, and then use a separate worker for that queue with the concurrency option set to 1.
5,361,521
I want to have a task that will execute every 5 minutes, but it will wait for last execution to finish and then start to count this 5 minutes. (This way I can also be sure that there is only one task running) The easiest way I found is to run django application manage.py shell and run this: ``` while True: result ...
2011/03/19
[ "https://Stackoverflow.com/questions/5361521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
Because of celery.decorators deprecated, you can use periodic\_task decorator like that: ``` from celery.task.base import periodic_task from django.utils.timezone import timedelta @periodic_task(run_every=timedelta(seconds=5)) def my_background_process(): # insert code ```
Add that task to a separate queue, and then use a separate worker for that queue with the concurrency option set to 1.
5,361,521
I want to have a task that will execute every 5 minutes, but it will wait for last execution to finish and then start to count this 5 minutes. (This way I can also be sure that there is only one task running) The easiest way I found is to run django application manage.py shell and run this: ``` while True: result ...
2011/03/19
[ "https://Stackoverflow.com/questions/5361521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
You may be interested in this simpler method that requires no changes to a celery conf. ``` @celery.decorators.periodic_task(run_every=datetime.timedelta(minutes=5)) def my_task(): # Insert fun-stuff here ```
Because of celery.decorators deprecated, you can use periodic\_task decorator like that: ``` from celery.task.base import periodic_task from django.utils.timezone import timedelta @periodic_task(run_every=timedelta(seconds=5)) def my_background_process(): # insert code ```
5,361,521
I want to have a task that will execute every 5 minutes, but it will wait for last execution to finish and then start to count this 5 minutes. (This way I can also be sure that there is only one task running) The easiest way I found is to run django application manage.py shell and run this: ``` while True: result ...
2011/03/19
[ "https://Stackoverflow.com/questions/5361521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
All you need is specify in celery conf witch task you want to run periodically and with which interval. Example: Run the tasks.add task every 30 seconds ``` from datetime import timedelta CELERYBEAT_SCHEDULE = { "runs-every-30-seconds": { "task": "tasks.add", "schedule": timedelta(seconds=30), ...
To expand on @MauroRocco's post, from <http://docs.celeryproject.org/en/v2.2.4/userguide/periodic-tasks.html> > > Using a timedelta for the schedule means the task will be executed 30 seconds after celerybeat starts, and then every 30 seconds after the last run. A crontab like schedule also exists, see the section on...
5,361,521
I want to have a task that will execute every 5 minutes, but it will wait for last execution to finish and then start to count this 5 minutes. (This way I can also be sure that there is only one task running) The easiest way I found is to run django application manage.py shell and run this: ``` while True: result ...
2011/03/19
[ "https://Stackoverflow.com/questions/5361521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
You may be interested in this simpler method that requires no changes to a celery conf. ``` @celery.decorators.periodic_task(run_every=datetime.timedelta(minutes=5)) def my_task(): # Insert fun-stuff here ```
Add that task to a separate queue, and then use a separate worker for that queue with the concurrency option set to 1.
5,361,521
I want to have a task that will execute every 5 minutes, but it will wait for last execution to finish and then start to count this 5 minutes. (This way I can also be sure that there is only one task running) The easiest way I found is to run django application manage.py shell and run this: ``` while True: result ...
2011/03/19
[ "https://Stackoverflow.com/questions/5361521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
Wow it's amazing how no one understands this person's question. They are asking not about running tasks periodically, but how to ensure that Celery does not run two instances of the same task simultaneously. I don't think there's a way to do this with Celery directly, but what you can do is have one of the tasks acquir...
Because of celery.decorators deprecated, you can use periodic\_task decorator like that: ``` from celery.task.base import periodic_task from django.utils.timezone import timedelta @periodic_task(run_every=timedelta(seconds=5)) def my_background_process(): # insert code ```
5,361,521
I want to have a task that will execute every 5 minutes, but it will wait for last execution to finish and then start to count this 5 minutes. (This way I can also be sure that there is only one task running) The easiest way I found is to run django application manage.py shell and run this: ``` while True: result ...
2011/03/19
[ "https://Stackoverflow.com/questions/5361521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
You may be interested in this simpler method that requires no changes to a celery conf. ``` @celery.decorators.periodic_task(run_every=datetime.timedelta(minutes=5)) def my_task(): # Insert fun-stuff here ```
To expand on @MauroRocco's post, from <http://docs.celeryproject.org/en/v2.2.4/userguide/periodic-tasks.html> > > Using a timedelta for the schedule means the task will be executed 30 seconds after celerybeat starts, and then every 30 seconds after the last run. A crontab like schedule also exists, see the section on...
5,361,521
I want to have a task that will execute every 5 minutes, but it will wait for last execution to finish and then start to count this 5 minutes. (This way I can also be sure that there is only one task running) The easiest way I found is to run django application manage.py shell and run this: ``` while True: result ...
2011/03/19
[ "https://Stackoverflow.com/questions/5361521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
To expand on @MauroRocco's post, from <http://docs.celeryproject.org/en/v2.2.4/userguide/periodic-tasks.html> > > Using a timedelta for the schedule means the task will be executed 30 seconds after celerybeat starts, and then every 30 seconds after the last run. A crontab like schedule also exists, see the section on...
Add that task to a separate queue, and then use a separate worker for that queue with the concurrency option set to 1.
5,361,521
I want to have a task that will execute every 5 minutes, but it will wait for last execution to finish and then start to count this 5 minutes. (This way I can also be sure that there is only one task running) The easiest way I found is to run django application manage.py shell and run this: ``` while True: result ...
2011/03/19
[ "https://Stackoverflow.com/questions/5361521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
All you need is specify in celery conf witch task you want to run periodically and with which interval. Example: Run the tasks.add task every 30 seconds ``` from datetime import timedelta CELERYBEAT_SCHEDULE = { "runs-every-30-seconds": { "task": "tasks.add", "schedule": timedelta(seconds=30), ...
Wow it's amazing how no one understands this person's question. They are asking not about running tasks periodically, but how to ensure that Celery does not run two instances of the same task simultaneously. I don't think there's a way to do this with Celery directly, but what you can do is have one of the tasks acquir...
19,242,348
I am creating a theme for my wordpress blog, I am struct on the code to display custom menus in my functions.php I have wrote: ``` function register_my_menus(){ register_nav_menus( array('menu-1' => __('Primary Menu'), ) ); } add_action('init', 'register_my_menus'); ``` this is my header.php ``` if ( has...
2013/10/08
[ "https://Stackoverflow.com/questions/19242348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2756124/" ]
Here are some FAQ type of information to the question in the original post. [Cilk Plus vs. TBB vs. Intel OpenMP](http://www.cilkplus.org/faq/24) In short it depends what type of parallelization you are trying to implement and how your application is coded.
So, as a request from the OP: I have used `TBB` before and I'm happy with it. It has good docs and the forum is active. It's not rare to see the library developers answering the questions. Give it a try. (I never used `cilkplus` so I can't talk about it). I worked with it both in Ubuntu and Windows. You can download ...
19,242,348
I am creating a theme for my wordpress blog, I am struct on the code to display custom menus in my functions.php I have wrote: ``` function register_my_menus(){ register_nav_menus( array('menu-1' => __('Primary Menu'), ) ); } add_action('init', 'register_my_menus'); ``` this is my header.php ``` if ( has...
2013/10/08
[ "https://Stackoverflow.com/questions/19242348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2756124/" ]
Is there a reason you can't use the pre-built GCC binaries we make available at <https://www.cilkplus.org/download#gcc-development-branch> ? It's built from the cilkplus\_4-8\_branch, and should be reasonably current. Which solution you choose is up to you. Cilk provides a very natural way to express recursive algorit...
So, as a request from the OP: I have used `TBB` before and I'm happy with it. It has good docs and the forum is active. It's not rare to see the library developers answering the questions. Give it a try. (I never used `cilkplus` so I can't talk about it). I worked with it both in Ubuntu and Windows. You can download ...
19,242,348
I am creating a theme for my wordpress blog, I am struct on the code to display custom menus in my functions.php I have wrote: ``` function register_my_menus(){ register_nav_menus( array('menu-1' => __('Primary Menu'), ) ); } add_action('init', 'register_my_menus'); ``` this is my header.php ``` if ( has...
2013/10/08
[ "https://Stackoverflow.com/questions/19242348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2756124/" ]
They can be used in complement to each other (CILK and TBB). Usually, thats the best. But from my experience you will use TBB the most. TBB and CILK will scale automatically with the number of cores. (by creating a tree of tasks, and then using recursion at run-time). * **TBB** is a runtime library for C++, that uses ...
So, as a request from the OP: I have used `TBB` before and I'm happy with it. It has good docs and the forum is active. It's not rare to see the library developers answering the questions. Give it a try. (I never used `cilkplus` so I can't talk about it). I worked with it both in Ubuntu and Windows. You can download ...
19,242,348
I am creating a theme for my wordpress blog, I am struct on the code to display custom menus in my functions.php I have wrote: ``` function register_my_menus(){ register_nav_menus( array('menu-1' => __('Primary Menu'), ) ); } add_action('init', 'register_my_menus'); ``` this is my header.php ``` if ( has...
2013/10/08
[ "https://Stackoverflow.com/questions/19242348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2756124/" ]
I can answer this question in context to TBB. The pros of using TBB are: * No compiler support needed to run the code. * Generic C++ algorithms of TBB lets user create their own objects and map them to thread as task. * User doesn't need to worry about thread management. The built in task scheduler automatically detec...
So, as a request from the OP: I have used `TBB` before and I'm happy with it. It has good docs and the forum is active. It's not rare to see the library developers answering the questions. Give it a try. (I never used `cilkplus` so I can't talk about it). I worked with it both in Ubuntu and Windows. You can download ...
19,242,348
I am creating a theme for my wordpress blog, I am struct on the code to display custom menus in my functions.php I have wrote: ``` function register_my_menus(){ register_nav_menus( array('menu-1' => __('Primary Menu'), ) ); } add_action('init', 'register_my_menus'); ``` this is my header.php ``` if ( has...
2013/10/08
[ "https://Stackoverflow.com/questions/19242348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2756124/" ]
Here are some FAQ type of information to the question in the original post. [Cilk Plus vs. TBB vs. Intel OpenMP](http://www.cilkplus.org/faq/24) In short it depends what type of parallelization you are trying to implement and how your application is coded.
Is there a reason you can't use the pre-built GCC binaries we make available at <https://www.cilkplus.org/download#gcc-development-branch> ? It's built from the cilkplus\_4-8\_branch, and should be reasonably current. Which solution you choose is up to you. Cilk provides a very natural way to express recursive algorit...
19,242,348
I am creating a theme for my wordpress blog, I am struct on the code to display custom menus in my functions.php I have wrote: ``` function register_my_menus(){ register_nav_menus( array('menu-1' => __('Primary Menu'), ) ); } add_action('init', 'register_my_menus'); ``` this is my header.php ``` if ( has...
2013/10/08
[ "https://Stackoverflow.com/questions/19242348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2756124/" ]
Here are some FAQ type of information to the question in the original post. [Cilk Plus vs. TBB vs. Intel OpenMP](http://www.cilkplus.org/faq/24) In short it depends what type of parallelization you are trying to implement and how your application is coded.
They can be used in complement to each other (CILK and TBB). Usually, thats the best. But from my experience you will use TBB the most. TBB and CILK will scale automatically with the number of cores. (by creating a tree of tasks, and then using recursion at run-time). * **TBB** is a runtime library for C++, that uses ...
19,242,348
I am creating a theme for my wordpress blog, I am struct on the code to display custom menus in my functions.php I have wrote: ``` function register_my_menus(){ register_nav_menus( array('menu-1' => __('Primary Menu'), ) ); } add_action('init', 'register_my_menus'); ``` this is my header.php ``` if ( has...
2013/10/08
[ "https://Stackoverflow.com/questions/19242348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2756124/" ]
Here are some FAQ type of information to the question in the original post. [Cilk Plus vs. TBB vs. Intel OpenMP](http://www.cilkplus.org/faq/24) In short it depends what type of parallelization you are trying to implement and how your application is coded.
I can answer this question in context to TBB. The pros of using TBB are: * No compiler support needed to run the code. * Generic C++ algorithms of TBB lets user create their own objects and map them to thread as task. * User doesn't need to worry about thread management. The built in task scheduler automatically detec...
19,242,348
I am creating a theme for my wordpress blog, I am struct on the code to display custom menus in my functions.php I have wrote: ``` function register_my_menus(){ register_nav_menus( array('menu-1' => __('Primary Menu'), ) ); } add_action('init', 'register_my_menus'); ``` this is my header.php ``` if ( has...
2013/10/08
[ "https://Stackoverflow.com/questions/19242348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2756124/" ]
They can be used in complement to each other (CILK and TBB). Usually, thats the best. But from my experience you will use TBB the most. TBB and CILK will scale automatically with the number of cores. (by creating a tree of tasks, and then using recursion at run-time). * **TBB** is a runtime library for C++, that uses ...
Is there a reason you can't use the pre-built GCC binaries we make available at <https://www.cilkplus.org/download#gcc-development-branch> ? It's built from the cilkplus\_4-8\_branch, and should be reasonably current. Which solution you choose is up to you. Cilk provides a very natural way to express recursive algorit...
19,242,348
I am creating a theme for my wordpress blog, I am struct on the code to display custom menus in my functions.php I have wrote: ``` function register_my_menus(){ register_nav_menus( array('menu-1' => __('Primary Menu'), ) ); } add_action('init', 'register_my_menus'); ``` this is my header.php ``` if ( has...
2013/10/08
[ "https://Stackoverflow.com/questions/19242348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2756124/" ]
I can answer this question in context to TBB. The pros of using TBB are: * No compiler support needed to run the code. * Generic C++ algorithms of TBB lets user create their own objects and map them to thread as task. * User doesn't need to worry about thread management. The built in task scheduler automatically detec...
Is there a reason you can't use the pre-built GCC binaries we make available at <https://www.cilkplus.org/download#gcc-development-branch> ? It's built from the cilkplus\_4-8\_branch, and should be reasonably current. Which solution you choose is up to you. Cilk provides a very natural way to express recursive algorit...
8,848,806
I have the following interface ``` package test.test; public interface IMyInterface { public String hello(); } ``` and an implementation ``` package test.test.impl; public class TestImpl implements IMyInterface { public String hello() { return "Hello"; } } ``` So I have only the full String "test.test.impl.T...
2012/01/13
[ "https://Stackoverflow.com/questions/8848806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007099/" ]
Use reflection: ``` TestImpl ti = (TestImpl) Class.forName("test.test.impl.TestImpl").newInstance(); ```
``` Class<?> clazz = .... Object o = clazz.newInstance(); // o will be a valid instance of you impl class ``` It will call the default constructor (you must have one!).
8,848,806
I have the following interface ``` package test.test; public interface IMyInterface { public String hello(); } ``` and an implementation ``` package test.test.impl; public class TestImpl implements IMyInterface { public String hello() { return "Hello"; } } ``` So I have only the full String "test.test.impl.T...
2012/01/13
[ "https://Stackoverflow.com/questions/8848806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007099/" ]
[Use](http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getConstructor%28java.lang.Class...%29) `impl = (IMyInterface) i.getConstructor().newInstance();`
``` Class<?> clazz = .... Object o = clazz.newInstance(); // o will be a valid instance of you impl class ``` It will call the default constructor (you must have one!).
8,848,806
I have the following interface ``` package test.test; public interface IMyInterface { public String hello(); } ``` and an implementation ``` package test.test.impl; public class TestImpl implements IMyInterface { public String hello() { return "Hello"; } } ``` So I have only the full String "test.test.impl.T...
2012/01/13
[ "https://Stackoverflow.com/questions/8848806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007099/" ]
With [Class.newInstance](http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#newInstance%28%29). The drawback of this approach is, though, that it suppresses checked exceptions (and introduces new reflection related exceptions) and always no-arg. Alternatively you can use [Class.getConstructor](http://docs...
``` Class<?> clazz = .... Object o = clazz.newInstance(); // o will be a valid instance of you impl class ``` It will call the default constructor (you must have one!).
8,848,806
I have the following interface ``` package test.test; public interface IMyInterface { public String hello(); } ``` and an implementation ``` package test.test.impl; public class TestImpl implements IMyInterface { public String hello() { return "Hello"; } } ``` So I have only the full String "test.test.impl.T...
2012/01/13
[ "https://Stackoverflow.com/questions/8848806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007099/" ]
``` Class<?> clazz = .... Object o = clazz.newInstance(); // o will be a valid instance of you impl class ``` It will call the default constructor (you must have one!).
``` IMyInterface impl = null; Class testImpl = Class.forName("test.test.impl.TestImpl"); if(testImpl != null && IMyInterface.class.isAssignableFrom(testImpl.getClass()) { impl = testImpl.getConstructor().newInstance(); } ``` Also, check: 1) [Using Java Reflection - java.sun.com](http://java.sun.com/developer/tech...
8,848,806
I have the following interface ``` package test.test; public interface IMyInterface { public String hello(); } ``` and an implementation ``` package test.test.impl; public class TestImpl implements IMyInterface { public String hello() { return "Hello"; } } ``` So I have only the full String "test.test.impl.T...
2012/01/13
[ "https://Stackoverflow.com/questions/8848806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007099/" ]
Use reflection: ``` TestImpl ti = (TestImpl) Class.forName("test.test.impl.TestImpl").newInstance(); ```
``` IMyInterface impl = null; Class testImpl = Class.forName("test.test.impl.TestImpl"); if(testImpl != null && IMyInterface.class.isAssignableFrom(testImpl.getClass()) { impl = testImpl.getConstructor().newInstance(); } ``` Also, check: 1) [Using Java Reflection - java.sun.com](http://java.sun.com/developer/tech...
8,848,806
I have the following interface ``` package test.test; public interface IMyInterface { public String hello(); } ``` and an implementation ``` package test.test.impl; public class TestImpl implements IMyInterface { public String hello() { return "Hello"; } } ``` So I have only the full String "test.test.impl.T...
2012/01/13
[ "https://Stackoverflow.com/questions/8848806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007099/" ]
[Use](http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getConstructor%28java.lang.Class...%29) `impl = (IMyInterface) i.getConstructor().newInstance();`
``` IMyInterface impl = null; Class testImpl = Class.forName("test.test.impl.TestImpl"); if(testImpl != null && IMyInterface.class.isAssignableFrom(testImpl.getClass()) { impl = testImpl.getConstructor().newInstance(); } ``` Also, check: 1) [Using Java Reflection - java.sun.com](http://java.sun.com/developer/tech...
8,848,806
I have the following interface ``` package test.test; public interface IMyInterface { public String hello(); } ``` and an implementation ``` package test.test.impl; public class TestImpl implements IMyInterface { public String hello() { return "Hello"; } } ``` So I have only the full String "test.test.impl.T...
2012/01/13
[ "https://Stackoverflow.com/questions/8848806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007099/" ]
With [Class.newInstance](http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#newInstance%28%29). The drawback of this approach is, though, that it suppresses checked exceptions (and introduces new reflection related exceptions) and always no-arg. Alternatively you can use [Class.getConstructor](http://docs...
``` IMyInterface impl = null; Class testImpl = Class.forName("test.test.impl.TestImpl"); if(testImpl != null && IMyInterface.class.isAssignableFrom(testImpl.getClass()) { impl = testImpl.getConstructor().newInstance(); } ``` Also, check: 1) [Using Java Reflection - java.sun.com](http://java.sun.com/developer/tech...
7,397,626
I have a Java swing launcher program to launch another class (running its main method). Each program has its cancel button to exit itself. I use `System.exit(0);` when this cancel button is pressed. The launcher program does this in `actionPerformed`: ``` if (source==carMenuItem) { ta.append("Car launched\n"); ...
2011/09/13
[ "https://Stackoverflow.com/questions/7397626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/925552/" ]
[System.exit()](http://download.oracle.com/javase/6/docs/api/java/lang/System.html) terminates the VM therefore your initial thread is terminated also, simply return from your main() method. After reviewing you code: Not all classes are supposed to have a main() method (If not also used standalone). You should conside...
With System.exit you can't. This will terminate the whole JVM and all processes inside it.
7,397,626
I have a Java swing launcher program to launch another class (running its main method). Each program has its cancel button to exit itself. I use `System.exit(0);` when this cancel button is pressed. The launcher program does this in `actionPerformed`: ``` if (source==carMenuItem) { ta.append("Car launched\n"); ...
2011/09/13
[ "https://Stackoverflow.com/questions/7397626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/925552/" ]
[System.exit()](http://download.oracle.com/javase/6/docs/api/java/lang/System.html) terminates the VM therefore your initial thread is terminated also, simply return from your main() method. After reviewing you code: Not all classes are supposed to have a main() method (If not also used standalone). You should conside...
Or you can use `dispose()` method in stead of `System.exit()` :-because `System.exit()` will terminate the total application it self. or you can use `setVisible()` as false.
7,397,626
I have a Java swing launcher program to launch another class (running its main method). Each program has its cancel button to exit itself. I use `System.exit(0);` when this cancel button is pressed. The launcher program does this in `actionPerformed`: ``` if (source==carMenuItem) { ta.append("Car launched\n"); ...
2011/09/13
[ "https://Stackoverflow.com/questions/7397626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/925552/" ]
[System.exit()](http://download.oracle.com/javase/6/docs/api/java/lang/System.html) terminates the VM therefore your initial thread is terminated also, simply return from your main() method. After reviewing you code: Not all classes are supposed to have a main() method (If not also used standalone). You should conside...
you have to implements [WindowListener](http://download.oracle.com/javase/tutorial/uiswing/events/windowlistener.html) and its `WindowEvents`, example [here](https://stackoverflow.com/questions/7080638/basic-java-swing-how-to-exit-and-dispose-of-your-application-jframe/7082054#7082054) another option is [setDefaultCl...
7,397,626
I have a Java swing launcher program to launch another class (running its main method). Each program has its cancel button to exit itself. I use `System.exit(0);` when this cancel button is pressed. The launcher program does this in `actionPerformed`: ``` if (source==carMenuItem) { ta.append("Car launched\n"); ...
2011/09/13
[ "https://Stackoverflow.com/questions/7397626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/925552/" ]
Or you can use `dispose()` method in stead of `System.exit()` :-because `System.exit()` will terminate the total application it self. or you can use `setVisible()` as false.
With System.exit you can't. This will terminate the whole JVM and all processes inside it.
7,397,626
I have a Java swing launcher program to launch another class (running its main method). Each program has its cancel button to exit itself. I use `System.exit(0);` when this cancel button is pressed. The launcher program does this in `actionPerformed`: ``` if (source==carMenuItem) { ta.append("Car launched\n"); ...
2011/09/13
[ "https://Stackoverflow.com/questions/7397626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/925552/" ]
you have to implements [WindowListener](http://download.oracle.com/javase/tutorial/uiswing/events/windowlistener.html) and its `WindowEvents`, example [here](https://stackoverflow.com/questions/7080638/basic-java-swing-how-to-exit-and-dispose-of-your-application-jframe/7082054#7082054) another option is [setDefaultCl...
With System.exit you can't. This will terminate the whole JVM and all processes inside it.
1,370,236
*(Note the code is an example)* I have the following syntax: ``` SomeMethod(() => x.Something) ``` What do the first brackets mean in the expression? I'm also curious how you can get the property name from argument that is being passed in. Is this posssible?
2009/09/02
[ "https://Stackoverflow.com/questions/1370236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59711/" ]
The `()` is an empty argument list. You're defining an anonymous function that takes no arguments and returns `x.Something`. Edit: It differs from `x => x.Something` in that the latter requires an argument and Something is called on that argument. With the former version `x` has to exist somewhere outside the function...
I assume x is declared in somewhere inside your method, if yes, you can compare this lambda expression with a delegate that has no paramaters and return the type of x.someproperty ``` delegate{ return x.someproperty; } ``` that is the same as: ``` () => x.someproperty ```
1,370,236
*(Note the code is an example)* I have the following syntax: ``` SomeMethod(() => x.Something) ``` What do the first brackets mean in the expression? I'm also curious how you can get the property name from argument that is being passed in. Is this posssible?
2009/09/02
[ "https://Stackoverflow.com/questions/1370236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59711/" ]
It's a [lambda expression](http://msdn.microsoft.com/en-us/library/bb397687.aspx). That is, it's a way to create an anonymous function or delegate. The general form is: ``` (input parameters) => expression ``` If you have ``` () => expression ``` then you have created a function that takes no arguments, and retu...
the () mean that this method doesn't take any parameters. for example, if you assign a normal event handler using a lambda expression, it would look like this: ``` someButton.Click += (s, e) => DoSomething(); ```
1,370,236
*(Note the code is an example)* I have the following syntax: ``` SomeMethod(() => x.Something) ``` What do the first brackets mean in the expression? I'm also curious how you can get the property name from argument that is being passed in. Is this posssible?
2009/09/02
[ "https://Stackoverflow.com/questions/1370236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59711/" ]
The `()` is an empty argument list. You're defining an anonymous function that takes no arguments and returns `x.Something`. Edit: It differs from `x => x.Something` in that the latter requires an argument and Something is called on that argument. With the former version `x` has to exist somewhere outside the function...
To get the name of the property you need SomeMethod to have an argument of the type of `System.Linq.Expressions.Expression<System.Func<object>>`. You can then go through the expression to determine the property name.
1,370,236
*(Note the code is an example)* I have the following syntax: ``` SomeMethod(() => x.Something) ``` What do the first brackets mean in the expression? I'm also curious how you can get the property name from argument that is being passed in. Is this posssible?
2009/09/02
[ "https://Stackoverflow.com/questions/1370236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59711/" ]
> > What do the first brackets mean in the expression? > > > It's the lambda syntax for a method that takes no parameters. If it took 1 parameter, it'd be: ``` SomeMethod(x => x.Something); ``` If it took n + 1 arguments, then it'd be: ``` SomeMethod((x, y, ...) => x.Something); ``` > > I'm also curious how...
I assume x is declared in somewhere inside your method, if yes, you can compare this lambda expression with a delegate that has no paramaters and return the type of x.someproperty ``` delegate{ return x.someproperty; } ``` that is the same as: ``` () => x.someproperty ```
1,370,236
*(Note the code is an example)* I have the following syntax: ``` SomeMethod(() => x.Something) ``` What do the first brackets mean in the expression? I'm also curious how you can get the property name from argument that is being passed in. Is this posssible?
2009/09/02
[ "https://Stackoverflow.com/questions/1370236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59711/" ]
See also the following two blog posts that discuss exactly your second question and provide alternative approaches: [How to Find Out Variable or Parameter Name in C#?](http://abdullin.com/journal/2008/12/13/how-to-find-out-variable-or-parameter-name-in-c.html) [How to Get Parameter Name and Argument Value From C# Lam...
To get the name of the property you need SomeMethod to have an argument of the type of `System.Linq.Expressions.Expression<System.Func<object>>`. You can then go through the expression to determine the property name.
1,370,236
*(Note the code is an example)* I have the following syntax: ``` SomeMethod(() => x.Something) ``` What do the first brackets mean in the expression? I'm also curious how you can get the property name from argument that is being passed in. Is this posssible?
2009/09/02
[ "https://Stackoverflow.com/questions/1370236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59711/" ]
the () mean that this method doesn't take any parameters. for example, if you assign a normal event handler using a lambda expression, it would look like this: ``` someButton.Click += (s, e) => DoSomething(); ```
To get the name of the property you need SomeMethod to have an argument of the type of `System.Linq.Expressions.Expression<System.Func<object>>`. You can then go through the expression to determine the property name.
1,370,236
*(Note the code is an example)* I have the following syntax: ``` SomeMethod(() => x.Something) ``` What do the first brackets mean in the expression? I'm also curious how you can get the property name from argument that is being passed in. Is this posssible?
2009/09/02
[ "https://Stackoverflow.com/questions/1370236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59711/" ]
The `()` is an empty argument list. You're defining an anonymous function that takes no arguments and returns `x.Something`. Edit: It differs from `x => x.Something` in that the latter requires an argument and Something is called on that argument. With the former version `x` has to exist somewhere outside the function...
It's a [lambda expression](http://msdn.microsoft.com/en-us/library/bb397687.aspx). That is, it's a way to create an anonymous function or delegate. The general form is: ``` (input parameters) => expression ``` If you have ``` () => expression ``` then you have created a function that takes no arguments, and retu...
1,370,236
*(Note the code is an example)* I have the following syntax: ``` SomeMethod(() => x.Something) ``` What do the first brackets mean in the expression? I'm also curious how you can get the property name from argument that is being passed in. Is this posssible?
2009/09/02
[ "https://Stackoverflow.com/questions/1370236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59711/" ]
I assume x is declared in somewhere inside your method, if yes, you can compare this lambda expression with a delegate that has no paramaters and return the type of x.someproperty ``` delegate{ return x.someproperty; } ``` that is the same as: ``` () => x.someproperty ```
See also the following two blog posts that discuss exactly your second question and provide alternative approaches: [How to Find Out Variable or Parameter Name in C#?](http://abdullin.com/journal/2008/12/13/how-to-find-out-variable-or-parameter-name-in-c.html) [How to Get Parameter Name and Argument Value From C# Lam...
1,370,236
*(Note the code is an example)* I have the following syntax: ``` SomeMethod(() => x.Something) ``` What do the first brackets mean in the expression? I'm also curious how you can get the property name from argument that is being passed in. Is this posssible?
2009/09/02
[ "https://Stackoverflow.com/questions/1370236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59711/" ]
> > What do the first brackets mean in the expression? > > > It's the lambda syntax for a method that takes no parameters. If it took 1 parameter, it'd be: ``` SomeMethod(x => x.Something); ``` If it took n + 1 arguments, then it'd be: ``` SomeMethod((x, y, ...) => x.Something); ``` > > I'm also curious how...
the () mean that this method doesn't take any parameters. for example, if you assign a normal event handler using a lambda expression, it would look like this: ``` someButton.Click += (s, e) => DoSomething(); ```
1,370,236
*(Note the code is an example)* I have the following syntax: ``` SomeMethod(() => x.Something) ``` What do the first brackets mean in the expression? I'm also curious how you can get the property name from argument that is being passed in. Is this posssible?
2009/09/02
[ "https://Stackoverflow.com/questions/1370236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59711/" ]
It's a [lambda expression](http://msdn.microsoft.com/en-us/library/bb397687.aspx). That is, it's a way to create an anonymous function or delegate. The general form is: ``` (input parameters) => expression ``` If you have ``` () => expression ``` then you have created a function that takes no arguments, and retu...
To get the name of the property you need SomeMethod to have an argument of the type of `System.Linq.Expressions.Expression<System.Func<object>>`. You can then go through the expression to determine the property name.
676,370
I want to store the value of os-version from the command `cat /etc/os-release`. The output of cat /etc/os-release is ``` VERSION="4.4" ID="someId" ID_LIKE="someIdLike" ``` I want a shell command to store the version "4.4" into a variable without apostrophes or the text "VERSION". So far what I have done is ``` vari...
2021/11/05
[ "https://unix.stackexchange.com/questions/676370", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/500076/" ]
The `os-release` manual on Ubuntu states that the `/etc/os-release` file should contain simple variable assignments compatible with the shell and that one should be able to source the file: > > The basic file format of `os-release` is a newline-separated list of > environment-like shell-compatible variable assignment...
Using `lsb_release` to get the release number: ``` variable=$(lsb_release -rs) ``` `man lsb_release`: ``` -r, --release displays release number of distribution. -s, --short displays all of the above information in short output format. ```
676,370
I want to store the value of os-version from the command `cat /etc/os-release`. The output of cat /etc/os-release is ``` VERSION="4.4" ID="someId" ID_LIKE="someIdLike" ``` I want a shell command to store the version "4.4" into a variable without apostrophes or the text "VERSION". So far what I have done is ``` vari...
2021/11/05
[ "https://unix.stackexchange.com/questions/676370", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/500076/" ]
Using `lsb_release` to get the release number: ``` variable=$(lsb_release -rs) ``` `man lsb_release`: ``` -r, --release displays release number of distribution. -s, --short displays all of the above information in short output format. ```
Thanks for the above answers as they were really helpful, but I found another solution from <https://unix.stackexchange.com/a/498788> which states that we can store the value from `os-release` as ``` VERSION=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"') echo $VERSION ```
676,370
I want to store the value of os-version from the command `cat /etc/os-release`. The output of cat /etc/os-release is ``` VERSION="4.4" ID="someId" ID_LIKE="someIdLike" ``` I want a shell command to store the version "4.4" into a variable without apostrophes or the text "VERSION". So far what I have done is ``` vari...
2021/11/05
[ "https://unix.stackexchange.com/questions/676370", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/500076/" ]
The `os-release` manual on Ubuntu states that the `/etc/os-release` file should contain simple variable assignments compatible with the shell and that one should be able to source the file: > > The basic file format of `os-release` is a newline-separated list of > environment-like shell-compatible variable assignment...
Thanks for the above answers as they were really helpful, but I found another solution from <https://unix.stackexchange.com/a/498788> which states that we can store the value from `os-release` as ``` VERSION=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"') echo $VERSION ```
64,923,873
So to give a little context im using expo-firebase-analytics (latest version) on Expo (27) and im trying to activate setDebugModeEnabled so that i can use the debugView on firebase analytics. The problem is that when running it i get the following warning > > The method or property expo-firebase-analytics.setDebugMo...
2020/11/20
[ "https://Stackoverflow.com/questions/64923873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11710240/" ]
Have you tried installing the latest version of expo-firebase-analytics since expo install brings an older one
if you check on the exports is the function there?