qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
30,031,388
I'd like to know about other patterns that could be more efficient than the use of factories.
2015/05/04
[ "https://Stackoverflow.com/questions/30031388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4333314/" ]
You could use a memory pool, the boost one is pretty good: <http://www.boost.org/doc/libs/1_58_0/libs/pool/doc/html/boost_pool/pool.html> And every client could configure the maximum size of the pool. Allocations and deallocations will be really fast,and you will drop your factory implementation
Measure first. If you haven't proved that your allocator is a performance problem then you shouldn't optimize it away. Your solution to not free memory back may in fact perform worse (e.g., if you're using a simple free-list, you might be spending a lot of time on cache misses when you traverse the list). If memory al...
18,718,469
I have a search method in `User` model. But I can search only by User columns. User `belongs_to` Company model. **Question:** I want to search users by `user.company.name` too. How can I do this? user.rb ``` class User < ActiveRecord::Base attr_accessible :email, :name, :password, :password_confirmation, :develope...
2013/09/10
[ "https://Stackoverflow.com/questions/18718469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2702786/" ]
Try This ``` def self.search(search) if search q = "%#{search}%" joins(:company).where('users.name LIKE ? OR companies.name LIKE ?',q,q) else scoped end end ```
``` @users = User.joins(:company).where(companies: {name: name}, developer: false, admin: false) ``` Now you only need to input your company name into parameters.
21,154,462
I want to rename a series of .jpg but i want to append the string at the end of file name. Please help me how can I achive this as I am new to batch file coding. **Series of jpg files** - CurDt\_S1, CurDt\_S2, CurDt\_S3 etc.. uptill S20. **I want to replace CurDt\_S1 with CurDt\_1\_S1 as -** CurDt\_1\_S1, CurDt\_1\...
2014/01/16
[ "https://Stackoverflow.com/questions/21154462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2742601/" ]
Here is the simplest way I can think of: ``` @echo off set i=1 for %%f in (CurDt_S*.jpg) do call :renameit "%%f" goto done :renameit ren CurDt_S%i%.jpg CurDt_1_S%i%.jpg set /A i+=1 :done ``` It assumes the batch files are located in the same directory as the jpg files. Hope this helps.
``` for %%f in ("c:\somewhere\CurDt_*.jpg") do ( for /f "tokens=1,* delims=_" %%g in ("%%~nf") do echo ren "%%~ff" "%%~g_1_%%~h%%~xf" ) ``` For each of the indicated files, split the name of the file using the first underscore as delimiter to get the two parts, and rename the file to the the first token + `_1_` +...
21,154,462
I want to rename a series of .jpg but i want to append the string at the end of file name. Please help me how can I achive this as I am new to batch file coding. **Series of jpg files** - CurDt\_S1, CurDt\_S2, CurDt\_S3 etc.. uptill S20. **I want to replace CurDt\_S1 with CurDt\_1\_S1 as -** CurDt\_1\_S1, CurDt\_1\...
2014/01/16
[ "https://Stackoverflow.com/questions/21154462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2742601/" ]
``` for /L %%x in (1,1,20) do ECHO ren CurDt_S%%x.jpg CurDt_1_S%%x.jpg ``` should work for you. The required commands are merely `ECHO`ed for testing purposes. After you've verified that the commands are correct, change `ECHO REN` to `REN` to actually rename the files.
Here is the simplest way I can think of: ``` @echo off set i=1 for %%f in (CurDt_S*.jpg) do call :renameit "%%f" goto done :renameit ren CurDt_S%i%.jpg CurDt_1_S%i%.jpg set /A i+=1 :done ``` It assumes the batch files are located in the same directory as the jpg files. Hope this helps.
21,154,462
I want to rename a series of .jpg but i want to append the string at the end of file name. Please help me how can I achive this as I am new to batch file coding. **Series of jpg files** - CurDt\_S1, CurDt\_S2, CurDt\_S3 etc.. uptill S20. **I want to replace CurDt\_S1 with CurDt\_1\_S1 as -** CurDt\_1\_S1, CurDt\_1\...
2014/01/16
[ "https://Stackoverflow.com/questions/21154462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2742601/" ]
Here is the simplest way I can think of: ``` @echo off set i=1 for %%f in (CurDt_S*.jpg) do call :renameit "%%f" goto done :renameit ren CurDt_S%i%.jpg CurDt_1_S%i%.jpg set /A i+=1 :done ``` It assumes the batch files are located in the same directory as the jpg files. Hope this helps.
I am using following code to rename the files. Basically, it would be as follows - CurDt\_S1 will be renamed as CurDt\_1\_S1 uptill S20, CurDt\_1\_S1 to CurDt\_2\_S1 uptill S20, CurDt\_2\_S1 to CurDt\_3\_S1 uptill S20, CurDt\_3\_S1 to CurDt\_4\_S1 uptill S20, and CurDt\_4\_S1 files will be archived to a diff folder. C...
21,154,462
I want to rename a series of .jpg but i want to append the string at the end of file name. Please help me how can I achive this as I am new to batch file coding. **Series of jpg files** - CurDt\_S1, CurDt\_S2, CurDt\_S3 etc.. uptill S20. **I want to replace CurDt\_S1 with CurDt\_1\_S1 as -** CurDt\_1\_S1, CurDt\_1\...
2014/01/16
[ "https://Stackoverflow.com/questions/21154462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2742601/" ]
I finally figured out the **SIMPLEST way** to achieve this by using **BATCH in simplest way.** By Using following code - ``` del CurDt_5_S* ren CurDt_4_S* CurDt_5_S* ren CurDt_3_S* CurDt_4_S* ren CurDt_2_S* CurDt_3_S* ren CurDt_1_S* CurDt_2_S* ``` I tested it and its working. :) :) :)
Here is the simplest way I can think of: ``` @echo off set i=1 for %%f in (CurDt_S*.jpg) do call :renameit "%%f" goto done :renameit ren CurDt_S%i%.jpg CurDt_1_S%i%.jpg set /A i+=1 :done ``` It assumes the batch files are located in the same directory as the jpg files. Hope this helps.
21,154,462
I want to rename a series of .jpg but i want to append the string at the end of file name. Please help me how can I achive this as I am new to batch file coding. **Series of jpg files** - CurDt\_S1, CurDt\_S2, CurDt\_S3 etc.. uptill S20. **I want to replace CurDt\_S1 with CurDt\_1\_S1 as -** CurDt\_1\_S1, CurDt\_1\...
2014/01/16
[ "https://Stackoverflow.com/questions/21154462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2742601/" ]
``` for /L %%x in (1,1,20) do ECHO ren CurDt_S%%x.jpg CurDt_1_S%%x.jpg ``` should work for you. The required commands are merely `ECHO`ed for testing purposes. After you've verified that the commands are correct, change `ECHO REN` to `REN` to actually rename the files.
``` for %%f in ("c:\somewhere\CurDt_*.jpg") do ( for /f "tokens=1,* delims=_" %%g in ("%%~nf") do echo ren "%%~ff" "%%~g_1_%%~h%%~xf" ) ``` For each of the indicated files, split the name of the file using the first underscore as delimiter to get the two parts, and rename the file to the the first token + `_1_` +...
21,154,462
I want to rename a series of .jpg but i want to append the string at the end of file name. Please help me how can I achive this as I am new to batch file coding. **Series of jpg files** - CurDt\_S1, CurDt\_S2, CurDt\_S3 etc.. uptill S20. **I want to replace CurDt\_S1 with CurDt\_1\_S1 as -** CurDt\_1\_S1, CurDt\_1\...
2014/01/16
[ "https://Stackoverflow.com/questions/21154462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2742601/" ]
I finally figured out the **SIMPLEST way** to achieve this by using **BATCH in simplest way.** By Using following code - ``` del CurDt_5_S* ren CurDt_4_S* CurDt_5_S* ren CurDt_3_S* CurDt_4_S* ren CurDt_2_S* CurDt_3_S* ren CurDt_1_S* CurDt_2_S* ``` I tested it and its working. :) :) :)
``` for %%f in ("c:\somewhere\CurDt_*.jpg") do ( for /f "tokens=1,* delims=_" %%g in ("%%~nf") do echo ren "%%~ff" "%%~g_1_%%~h%%~xf" ) ``` For each of the indicated files, split the name of the file using the first underscore as delimiter to get the two parts, and rename the file to the the first token + `_1_` +...
21,154,462
I want to rename a series of .jpg but i want to append the string at the end of file name. Please help me how can I achive this as I am new to batch file coding. **Series of jpg files** - CurDt\_S1, CurDt\_S2, CurDt\_S3 etc.. uptill S20. **I want to replace CurDt\_S1 with CurDt\_1\_S1 as -** CurDt\_1\_S1, CurDt\_1\...
2014/01/16
[ "https://Stackoverflow.com/questions/21154462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2742601/" ]
``` for /L %%x in (1,1,20) do ECHO ren CurDt_S%%x.jpg CurDt_1_S%%x.jpg ``` should work for you. The required commands are merely `ECHO`ed for testing purposes. After you've verified that the commands are correct, change `ECHO REN` to `REN` to actually rename the files.
I am using following code to rename the files. Basically, it would be as follows - CurDt\_S1 will be renamed as CurDt\_1\_S1 uptill S20, CurDt\_1\_S1 to CurDt\_2\_S1 uptill S20, CurDt\_2\_S1 to CurDt\_3\_S1 uptill S20, CurDt\_3\_S1 to CurDt\_4\_S1 uptill S20, and CurDt\_4\_S1 files will be archived to a diff folder. C...
21,154,462
I want to rename a series of .jpg but i want to append the string at the end of file name. Please help me how can I achive this as I am new to batch file coding. **Series of jpg files** - CurDt\_S1, CurDt\_S2, CurDt\_S3 etc.. uptill S20. **I want to replace CurDt\_S1 with CurDt\_1\_S1 as -** CurDt\_1\_S1, CurDt\_1\...
2014/01/16
[ "https://Stackoverflow.com/questions/21154462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2742601/" ]
I finally figured out the **SIMPLEST way** to achieve this by using **BATCH in simplest way.** By Using following code - ``` del CurDt_5_S* ren CurDt_4_S* CurDt_5_S* ren CurDt_3_S* CurDt_4_S* ren CurDt_2_S* CurDt_3_S* ren CurDt_1_S* CurDt_2_S* ``` I tested it and its working. :) :) :)
I am using following code to rename the files. Basically, it would be as follows - CurDt\_S1 will be renamed as CurDt\_1\_S1 uptill S20, CurDt\_1\_S1 to CurDt\_2\_S1 uptill S20, CurDt\_2\_S1 to CurDt\_3\_S1 uptill S20, CurDt\_3\_S1 to CurDt\_4\_S1 uptill S20, and CurDt\_4\_S1 files will be archived to a diff folder. C...
865,466
I was on Office 2010 and got asked to be in the pilot group for Office 365. After this period O365 went live and I deemed it a good idea to uninstall Office 2010. After this was done all Office related filetypes lost their association with office and excel woorkbooks were always opened as a blank file. Since repairin...
2015/01/16
[ "https://superuser.com/questions/865466", "https://superuser.com", "https://superuser.com/users/275822/" ]
You can open `viber.db` in `C:\Users\USERNAME\AppData\Roaming\ViberPC\YourNumber` with WordPad and somewhere in the beginning of the file you will find contacts phone numbers. Just enter them manually in your new phone and they will appear on you contacts list in Viber. Or download [command-line shell for accessing ...
Maybe the data base structure has changed, in my case, I had to slightly change @Davidenko's instructions. Install a SQLite command-line shell, perhaps from here [sqlite.org/download.html](https://www.sqlite.org/download.html). It is bundled in the sqlite-tools. Copy the file ``` C:\Users\USERNAME\AppData\Roaming\...
865,466
I was on Office 2010 and got asked to be in the pilot group for Office 365. After this period O365 went live and I deemed it a good idea to uninstall Office 2010. After this was done all Office related filetypes lost their association with office and excel woorkbooks were always opened as a blank file. Since repairin...
2015/01/16
[ "https://superuser.com/questions/865466", "https://superuser.com", "https://superuser.com/users/275822/" ]
You can open `viber.db` in `C:\Users\USERNAME\AppData\Roaming\ViberPC\YourNumber` with WordPad and somewhere in the beginning of the file you will find contacts phone numbers. Just enter them manually in your new phone and they will appear on you contacts list in Viber. Or download [command-line shell for accessing ...
On **ubuntu** I found it under: * `/home/[user]/snap/viber-unofficial/37/.ViberPC/[phonenumber]/viber.db` (snap installation) * `/home/[user]/.ViberPC/[phonenumber]/viber.db` (non-snap installation) Then you can open with `sqlitebrowser` ```bsh sudo apt install sqlitebrowser sqlitebrowser viber.db ```
865,466
I was on Office 2010 and got asked to be in the pilot group for Office 365. After this period O365 went live and I deemed it a good idea to uninstall Office 2010. After this was done all Office related filetypes lost their association with office and excel woorkbooks were always opened as a blank file. Since repairin...
2015/01/16
[ "https://superuser.com/questions/865466", "https://superuser.com", "https://superuser.com/users/275822/" ]
Maybe the data base structure has changed, in my case, I had to slightly change @Davidenko's instructions. Install a SQLite command-line shell, perhaps from here [sqlite.org/download.html](https://www.sqlite.org/download.html). It is bundled in the sqlite-tools. Copy the file ``` C:\Users\USERNAME\AppData\Roaming\...
On **ubuntu** I found it under: * `/home/[user]/snap/viber-unofficial/37/.ViberPC/[phonenumber]/viber.db` (snap installation) * `/home/[user]/.ViberPC/[phonenumber]/viber.db` (non-snap installation) Then you can open with `sqlitebrowser` ```bsh sudo apt install sqlitebrowser sqlitebrowser viber.db ```
68,464,729
Goodday, I have 2 sheets. For each ID on sheet1 I need to verify if that ID is also on sheet2 AND if Date Processed is blank. If both condition are true > today's date should be set in Date Processed. [![enter image description here](https://i.stack.imgur.com/Wvet0.png)](https://i.stack.imgur.com/Wvet0.png) I've ma...
2021/07/21
[ "https://Stackoverflow.com/questions/68464729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15972586/" ]
I know it doesn't makes much sense. Muhammet's code works and looks just fine. But, rather for fun and educational purposes, here is another "functional" solution: ``` function myFunction() { const ss = SpreadsheetApp.getActiveSpreadsheet(); const s1 = ss.getSheetByName('Sheet1'); const s2 = ss.getSheetByName('...
You need a loop for this. Use > > var mySearchs = ss.getRange('A2:A').getValues(); > > > and loop through all values of this array. ``` function myMatch(){ var file = SpreadsheetApp.getActiveSpreadsheet(); var ss = file.getSheetByName("Sheet1"); var ws = file.getSheetByName("Sheet2"); var wsData ...
33,316,924
I am trying to make a slider which scrolls over 3 div elements on to 3 new scroll elements. I am looking for a manual slider with an arrow pointing right on the right side and left on the left side. The slider should slide right when right arrow clicked and display the 3 remaining div elements. If the left arrow is cli...
2015/10/24
[ "https://Stackoverflow.com/questions/33316924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5393006/" ]
Here's a start to see if we're headed in the right direction: ``` >> M = [1 2 3 4; 1 2 8 10; 4 5 7 9; 2 3 6 4; 1 2 4 7]; >> N = M; %// copy M into a new matrix so we can modify it >> idx = ismember(N(:,1:2), N(1,1:2), 'rows') idx = 1 1 0 0 1 >> N(idx, :) ans = 1 2 3 ...
this will give you the results ``` data1 =[1 2 3 4 1 2 8 10 4 5 7 9 2 3 6 4 1 2 4 7]; data2 = [1 2 3 4 1 2 3 10 1 2 4 7]; [exists,position] = ismember(data1,data2, 'rows') ``` where the exists vector tells you wheter the row is on the other matrix and position gives you the position... a less elegant and simpler...
13,134,230
I have the following column values in my crystal report: ``` |Code |Unit | |A |2 | |B |3 | |C |2 | |D |3 | |E |1 | |F |1 | |G |4 | |H |(3) | ``` I want to summarize the Unit except the Units which has Code H,J,K, and L. The Codes: H,J,K, and L contains units which has pa...
2012/10/30
[ "https://Stackoverflow.com/questions/13134230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/925063/" ]
I use a FSM machine to change the state of the application. Each states shows and hides the appropriate view. My views use transition to animate in and out, so changing the state is more complex, then simple show/hide - it animates in and out from one state into another. I have forked <https://github.com/fschaefer/Stat...
I can share my personal experience with such a problem. I don't know if it's the best solution, but it worked for me. My problem was even worse because I had several routers and each of them should hide/show views that belong to it. The solution I chose was similar to the first option you consider. In my router ther...
72,079,389
As a new Developer I'd like more information about json file. I know that The this file is the heart of a Node.js system. This file holds the metadata for a particular project. The file is found in the root directory of any Node application or module. Please Write More about it.
2022/05/01
[ "https://Stackoverflow.com/questions/72079389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18390083/" ]
**TLDR:** `semantic-ui-react@2.1.2` is [incompatible with React 18](https://github.com/Semantic-Org/Semantic-UI-React/issues/4354). As a workaround, you can downgrade your application to **React 17**. ### While resolving: camp-project@0.1.0 ``` npm ERR! Found: react@18.1.0 npm ERR! node_modules/react npm ERR! react...
You can use this [article](https://dev.to/lowla/create-react-app-with-a-previous-version-of-react-4g03) it helped me solved the same problem when i wanted to install `semantic-ui` with `react 18` it will probably help you with other frameworks that doesn't compatible with react 18
58,376,478
I'm trying to use a service account to retrieve locations/reviews using the Google My Business API. So far I have: 1. Created a project in Developers Console 2. Enabled access to the Google My Business API (it's been approved/whitelisted by Google) 3. Created a service account with an associated OAuth identity 4. Inv...
2019/10/14
[ "https://Stackoverflow.com/questions/58376478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/87043/" ]
To log in as a service account for server to server authentication you need to enable domain wide delegation for your service account. <https://developers.google.com/admin-sdk/directory/v1/guides/delegation> Once you do this, you can make your service account log into the Google My Business API by impersonating the em...
Service accounts in the GMB API can't substitute for a Google user account authentication. You'll need to use Oauth with a user account — for example, a gmail account that has access to the GMB web interface - so that you can perform actions on behalf of a user.
37,573,802
Is it possible using Javascript and Html to open a Save As Dialog from a chrome extension on a Windows OS machine? I have tried the following without luck: 1. The chrome extension's fileBrowserHandler - It works only on Chrome OS 2. HTML5 input with type= file - It opens the Open dialog but not save 3. Anchor tag wit...
2016/06/01
[ "https://Stackoverflow.com/questions/37573802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6410577/" ]
To force the Save Dialog from a chrome extension, use chrome extension's download api and set the saveAs options flag to true. Something like this: ``` chrome.downloads.download({ url: window.location.href + '/' + fileName, filename: fileName, saveAs: true }, function (downloadId) { console.log(downloa...
Try using the [FileSaver](http://purl.eligrey.com/github/FileSaver.js/) HTML5 polyfill. It allows you to save anything to a file from JavaScript: ```js var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); saveAs(blob, "hello world.txt"); ```
105,239
Creating a character to do an animation but have been very unsuccessful in getting clothes to act like they are on the character. Created him in Make Human. Exported with just s shirt on so I could use that to make his robe/gown. Copied shirt and created gown. Tried many videos and even though none were that similar to...
2018/03/29
[ "https://blender.stackexchange.com/questions/105239", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/54502/" ]
Array modifiers will duplicate the uv of the original mesh so any texture you are using on the base mesh will automatically duplicate it over to the array. If you are wanting for each segment to have its own individual texture then you will have to apply the modifier first before you can make adjustments individually.
Once the array has been applied, unwrap using Follow Active Quads and then arrange the resultant UV map (by positioning, rotating, scaling the entire island) so that one ‘face’ is scaled and positioned to fit the whole image. This should result in the image repeating identically for each face.
56,133,320
Currently cleaning data from a csv file. Successfully mad everything lowercase, removed stopwords and punctuation etc. But need to remove special characters. For example, the csv file contains things such as 'César' '‘disgrace’'. If there is a way to replace these characters then even better but I am fine with rem...
2019/05/14
[ "https://Stackoverflow.com/questions/56133320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11496197/" ]
When saving the file try: ``` df.to_csv('clean_soccer.csv', encoding='utf-8-sig') ``` or simply ``` df.to_csv('clean_soccer.csv', encoding='utf-8') ```
I'm not sure if there's an easy way to replace the special characters, but I know how you can remove them. Try using: ``` df['post_title']= df['post_title'].str.replace(r'[^A-Za-z0-9]+', '') ``` That should replace 'César' '‘disgrace’' with 'Csardisgrace'. Hope this helps.
56,133,320
Currently cleaning data from a csv file. Successfully mad everything lowercase, removed stopwords and punctuation etc. But need to remove special characters. For example, the csv file contains things such as 'César' '‘disgrace’'. If there is a way to replace these characters then even better but I am fine with rem...
2019/05/14
[ "https://Stackoverflow.com/questions/56133320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11496197/" ]
When saving the file try: ``` df.to_csv('clean_soccer.csv', encoding='utf-8-sig') ``` or simply ``` df.to_csv('clean_soccer.csv', encoding='utf-8') ```
As an alternative to other answers, you could use `string.printable`: ``` import string printable = set(string.printable) def remove_spec_chars(in_str): return ''.join([c for c in in_str if c in printable]) df['post_title'].apply(remove_spec_chars) ``` For reference, `string.printable` varies by machine, whic...
21,401,801
I want to monitor internet in every page in my project through service. I don't have any code regarding this. I have method how to check internet connection, but I want to implement it through service. 1. Is it possible ? if yes please provide me some methods or logic. Thanks in advance
2014/01/28
[ "https://Stackoverflow.com/questions/21401801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064182/" ]
From the [source](http://www.juliencavandoli.com/how-to-disable-recent-apps-dialog-on-long-press-home-button/) ``` public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); Log.d("Focus debug", "Focus changed !"); if(!hasFocus) { Log.d("Focus debug", "Lost foc...
For disable the recent apps button while launching other applications then you can create a service. public class StatusBarService extends Service { ``` private static final String TAG = StatusBarService.class.getSimpleName(); private volatile boolean isRunning; @Override public IBinder onBind(Intent intent) { ...
21,401,801
I want to monitor internet in every page in my project through service. I don't have any code regarding this. I have method how to check internet connection, but I want to implement it through service. 1. Is it possible ? if yes please provide me some methods or logic. Thanks in advance
2014/01/28
[ "https://Stackoverflow.com/questions/21401801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064182/" ]
From the [source](http://www.juliencavandoli.com/how-to-disable-recent-apps-dialog-on-long-press-home-button/) ``` public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); Log.d("Focus debug", "Focus changed !"); if(!hasFocus) { Log.d("Focus debug", "Lost foc...
``` @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); Log.d("Focus debug", "Focus changed !"); if(!hasFocus) { Log.d("Focus debug", "Lost focus !"); Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); sendBroadc...
21,401,801
I want to monitor internet in every page in my project through service. I don't have any code regarding this. I have method how to check internet connection, but I want to implement it through service. 1. Is it possible ? if yes please provide me some methods or logic. Thanks in advance
2014/01/28
[ "https://Stackoverflow.com/questions/21401801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064182/" ]
For disabling Recent button add this code to your Main activity: ``` @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (!hasFocus) { windowCloseHandler.post(windowCloserRunnable); } } private void toggleRecents() { Intent closeRecents = new...
For disable the recent apps button while launching other applications then you can create a service. public class StatusBarService extends Service { ``` private static final String TAG = StatusBarService.class.getSimpleName(); private volatile boolean isRunning; @Override public IBinder onBind(Intent intent) { ...
21,401,801
I want to monitor internet in every page in my project through service. I don't have any code regarding this. I have method how to check internet connection, but I want to implement it through service. 1. Is it possible ? if yes please provide me some methods or logic. Thanks in advance
2014/01/28
[ "https://Stackoverflow.com/questions/21401801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064182/" ]
``` @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); Log.d("Focus debug", "Focus changed !"); if(!hasFocus) { Log.d("Focus debug", "Lost focus !"); Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); sendBroadc...
For disable the recent apps button while launching other applications then you can create a service. public class StatusBarService extends Service { ``` private static final String TAG = StatusBarService.class.getSimpleName(); private volatile boolean isRunning; @Override public IBinder onBind(Intent intent) { ...
21,401,801
I want to monitor internet in every page in my project through service. I don't have any code regarding this. I have method how to check internet connection, but I want to implement it through service. 1. Is it possible ? if yes please provide me some methods or logic. Thanks in advance
2014/01/28
[ "https://Stackoverflow.com/questions/21401801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064182/" ]
For disabling Recent button add this code to your Main activity: ``` @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (!hasFocus) { windowCloseHandler.post(windowCloserRunnable); } } private void toggleRecents() { Intent closeRecents = new...
``` @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); Log.d("Focus debug", "Focus changed !"); if(!hasFocus) { Log.d("Focus debug", "Lost focus !"); Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); sendBroadc...
39,237,237
I have multiples views but the same search input on a navbar, the question is: **How use the input in the navbar to update data in view1Ctrl , View2Ctrl or anyCtrl** **------- EDIT 1 -------** My question was not specific **I want to use the input in the navbar to update data in view1Ctrl , View2Ctrl or anyCtrl and h...
2016/08/30
[ "https://Stackoverflow.com/questions/39237237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5111445/" ]
Maybe I do not understand this correctly, but there's no need to check for *existance*. You can alter a table's column to `NOT NULL` over and over again - if you like. Try this: ``` CREATE TABLE Test(ID INT,SomeValue VARCHAR(100)); INSERT INTO Test VALUES(1,NULL),(2,'Value 2'),(NULL,'Value NULL'); ``` --Ups, ID sh...
You can use views in `sys` namespace for this purpose. Something like this. ``` select c.name,t.name,c.is_nullable from sys.all_columns c inner join sys.tables t on c.object_id=t.object_id where t.name = 'MyTable' and c.name = 'myCol'; ``` and then `alter table ... alter column...`
57,959,682
At my work I manually copy sales forecast into another file that gets uploaded to our website. The two files I manually copy have the same exact layout everytime (no cells are changing positions) but the name of the file changes due to having different products every day. I tried the VBA record button but since the f...
2019/09/16
[ "https://Stackoverflow.com/questions/57959682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12074970/" ]
I would suggest skipping the Interop and using the nuget package: [ExcelDataReader](https://github.com/ExcelDataReader/). It does not require excel on the running machine and also works in Linux builds of Core applications. The library does support password protected excel files.
There is not much that you can collect from Excel workbook using interop APIs, but what you can collect is file name etc. Check out the sample code below. ``` var xls = new Excel.Application(); var activeProtectedViewWindow = xls?.ActiveProtectedViewWindow; var spath = activeProtectedViewWindow.SourcePath; var ...
1,471,437
When i implement ``` WaitCallback waitCB = new WaitCallback(DisplayTime); for (int i = 1; i <= 5; i++) { ThreadPool.QueueUserWorkItem(waitCB, null); Thread.Sleep(2000); } public void DisplayTime(object state) { Console.WriteLine("Current Time {0} ", DateTime.Now); } ``` ( 1 ) Does it mean ,m...
2009/09/24
[ "https://Stackoverflow.com/questions/1471437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/160677/" ]
> > ( 1 ) Does it mean ,my job is queued into to CLR ? > > > It is queued to be processed as soon as a thread from the pool is available > > ( 2 ) Will CLR process it after finishing the existing pending item in the queue ? > > > There can be several jobs executing at the same time... As soon as one of the p...
Your callback will be executed on a threadpool thread based on whatever algorithm the CLR is using to allocate and start threads from its pool. In your example the callbacks will be processed close to instantly and in a seemingly deterministic fashion. However that could easily change depending on the state of the thr...
33,596,372
``` NSKeyedArchiver.archiveRootObject(<#rootObject: AnyObject#>, toFile: <#String#>) ``` Only returns true the first time. Every next time I call it, the method returns false. I read some SO, some posts said that I can't rewrite data this way. However, I tried : ``` NSFileManager.defaultManager().removeItemAtPath...
2015/11/08
[ "https://Stackoverflow.com/questions/33596372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3009276/" ]
Because of the code you put here does't contain the call of `saveDataArray` or `saveDataObject` so I judge that you have maintain the path of a archived object manually.**This is where thing went wrong.** The method of NSKeyedArchiver named `archiveRootObject` can automatically maintain the archiver file path. In the ...
I followed apple instructions in this good example: [Persist Data](https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson10.html) But I had the same problem you describe with my app for AppleTV. At the end I change .Documents directory for CacheDirectory and it's working well...
32,905,860
I need to create a set of matrices from the file below, the lines/rows with the same value of Z will go in a matrix together. Below is a shortened version of my txt file: ``` X Y Z -1 10 0 1 20 5 2 15 10 2 50 10 2 90 10 3 15 11 4 50 11 5 90 11 6 13 14 7 50 14 8 70 14 8 95 14 8 ...
2015/10/02
[ "https://Stackoverflow.com/questions/32905860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5371327/" ]
Try to edit your template ------------------------- **Go to File->Settings->Editors->File and Code Templates** here find your unit test template and modify it as you wish [![enter image description here](https://i.stack.imgur.com/NGgH6.png)](https://i.stack.imgur.com/NGgH6.png) Once you have modified it all you futu...
Unless you object to using wildcard imports, `static import org.junit.Assert.*;` will sort you out nicely. The recommendation is to use static imports sparingly (and wildcards even more so), but unit testing is one place where that becomes quite common and is somewhat risk-free.
26,361,797
Every time an user click on the button it has to show "John - Sue" or "Sue - John". I tried with this code: ``` public class MyActivity extends Activity { ArrayList<String> names = new ArrayList<String>(); int p1, p2; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstan...
2014/10/14
[ "https://Stackoverflow.com/questions/26361797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2516399/" ]
If you want shuffle list: ``` Collections.shuffle(names) ``` If you want random int between 0 or 1 ([nextInt(int) javadoc](http://docs.oracle.com/javase/7/docs/api/java/util/Random.html#nextInt(int))): ``` Random random = new Random(); int randomInt = random.nextInt(2); ```
Math.random() returns a number between 0 and 1. So when you cast it to int it will always be 0. Try this: ``` p1 = (int)(Math.random()*2); ```
26,361,797
Every time an user click on the button it has to show "John - Sue" or "Sue - John". I tried with this code: ``` public class MyActivity extends Activity { ArrayList<String> names = new ArrayList<String>(); int p1, p2; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstan...
2014/10/14
[ "https://Stackoverflow.com/questions/26361797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2516399/" ]
If you want shuffle list: ``` Collections.shuffle(names) ``` If you want random int between 0 or 1 ([nextInt(int) javadoc](http://docs.oracle.com/javase/7/docs/api/java/util/Random.html#nextInt(int))): ``` Random random = new Random(); int randomInt = random.nextInt(2); ```
It happens because `p1 = (int)Math.random();` always gives you zero.
70,293,840
I am trying to send Emails through Gmail but exception "**Unknown SMTP host: smtp.gmail.com**". I already **Turned on** Less secure app access and Two Step Verification should be **turned off**. ``` public class MonitoringMail { public void sendMail(String mailServer, String from, String[] to, String subject, Stri...
2021/12/09
[ "https://Stackoverflow.com/questions/70293840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12569370/" ]
SMTP have 2 different ports PORTS for **SSL** 465 PORTS for **TLS/STARTTLS** 587 did you try with another ports ?
Please try with port 25. ``` props.setProperty("mail.smtp.port", "25"); ```
70,293,840
I am trying to send Emails through Gmail but exception "**Unknown SMTP host: smtp.gmail.com**". I already **Turned on** Less secure app access and Two Step Verification should be **turned off**. ``` public class MonitoringMail { public void sendMail(String mailServer, String from, String[] to, String subject, Stri...
2021/12/09
[ "https://Stackoverflow.com/questions/70293840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12569370/" ]
SMTP have 2 different ports PORTS for **SSL** 465 PORTS for **TLS/STARTTLS** 587 did you try with another ports ?
I understand that you've setup gmail account and enabled less secured apps, but Gmail account automatically turns off "allow less secured apps" option after some period of inactivity. If this code worked before, try to check your gmail account settings again.
70,293,840
I am trying to send Emails through Gmail but exception "**Unknown SMTP host: smtp.gmail.com**". I already **Turned on** Less secure app access and Two Step Verification should be **turned off**. ``` public class MonitoringMail { public void sendMail(String mailServer, String from, String[] to, String subject, Stri...
2021/12/09
[ "https://Stackoverflow.com/questions/70293840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12569370/" ]
SMTP have 2 different ports PORTS for **SSL** 465 PORTS for **TLS/STARTTLS** 587 did you try with another ports ?
In my case i was change ports after that it's working properly
70,293,840
I am trying to send Emails through Gmail but exception "**Unknown SMTP host: smtp.gmail.com**". I already **Turned on** Less secure app access and Two Step Verification should be **turned off**. ``` public class MonitoringMail { public void sendMail(String mailServer, String from, String[] to, String subject, Stri...
2021/12/09
[ "https://Stackoverflow.com/questions/70293840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12569370/" ]
Please try with port 25. ``` props.setProperty("mail.smtp.port", "25"); ```
In my case i was change ports after that it's working properly
70,293,840
I am trying to send Emails through Gmail but exception "**Unknown SMTP host: smtp.gmail.com**". I already **Turned on** Less secure app access and Two Step Verification should be **turned off**. ``` public class MonitoringMail { public void sendMail(String mailServer, String from, String[] to, String subject, Stri...
2021/12/09
[ "https://Stackoverflow.com/questions/70293840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12569370/" ]
I understand that you've setup gmail account and enabled less secured apps, but Gmail account automatically turns off "allow less secured apps" option after some period of inactivity. If this code worked before, try to check your gmail account settings again.
In my case i was change ports after that it's working properly
23,154,829
It seems when I use Postal to send an email using Layout, the headers was not parsed and included on the mail message. **Views/Emails/\_ViewStart.cshtml** ``` @{ Layout = "~/Views/Emails/_EmailLayout.cshtml"; } ``` **Views/Emails/\_EmailLayout.cshtml** ``` <html> <head> <meta name="viewport" content="width=de...
2014/04/18
[ "https://Stackoverflow.com/questions/23154829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/671714/" ]
One option is to use a Razor section. At the top of the layout add: ``` @RenderSection("Headers") ``` Then in the view add: ``` @section Headers { To: @ViewBag.To From: @ViewBag.From Subject: Reset Password Views: Html } ```
Move the first line Content-Type: text/html; charset=utf-8 from Views/Emails/ResetPassword.html.cshtml to Views/Emails/\_EmailLayout.cshtml ``` Content-Type: text/html; charset=utf-8 <html> <head> <meta name="viewport" content="width=device-width" /> <title>ViewEmails</title> </head> <b...
60,308,981
My app is unable to detect the state change that occurs when a user logs in without completely refreshing the page. Upon refreshing everything displays correctly. I am using Nuxt and its included auth module documented here - <https://auth.nuxtjs.org/>. Here is the v-if statement that is unable to detect the state cha...
2020/02/19
[ "https://Stackoverflow.com/questions/60308981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4266752/" ]
1. In `store/index.js` add this : ``` export const getters = { isAuthenticated(state) { return state.auth.loggedIn }, loggedInUser(state) { return state.auth.user }, }; ``` 2. In the pages you are suppose to be authenticated * use middle ware auth as : `middleware: 'auth'` * use `import { mapGett...
Sometimes Vue's reactivity system falls short and you just need to manually trigger a re-render and the simplest way to do so is by wrapping your function logic in `setTimeout()` ```js setTimeout(async () => { await this.$auth.logout(); }, 0); ```
52,742,585
why does my app crash when i click the button to go to the next page? On the 1st page `onCreate` method ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button startBtn = findViewById(R.id.startBtn); startBtn.setOnCli...
2018/10/10
[ "https://Stackoverflow.com/questions/52742585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7515191/" ]
I forgot to add in the 2nd page to the manifest file...
``` this is my Button code : <Button android:id="@+id/startBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" /> //-------------------------this is click listener of button------------- Button startBtn = findViewById(R.id.startBtn); startBtn.setOnClickL...
5,677,446
I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this?
2011/04/15
[ "https://Stackoverflow.com/questions/5677446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663229/" ]
If I understood the requirement then can't both scripts be simply executed in same sub shell, independently but **without** calling each other or without any need of an external file or pipe like this: Let's say this is your **script1.sh** ``` #!/bin/bash # script1.sh: do something and finally export x=19 ``` And h...
You may echo values to files, then the other script may read them. If you want to use it as a parameter for something, use reverse aposthrophe: ``` echo `cat storedvalue` ``` Be careful, if the two scripts are running at the same time, concurrency problems may occur, which can cause rarely appearing, mystic-looking ...
5,677,446
I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this?
2011/04/15
[ "https://Stackoverflow.com/questions/5677446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663229/" ]
If I understood the requirement then can't both scripts be simply executed in same sub shell, independently but **without** calling each other or without any need of an external file or pipe like this: Let's say this is your **script1.sh** ``` #!/bin/bash # script1.sh: do something and finally export x=19 ``` And h...
Can't you read a third file, let's say settings.sh with the common exported variables? ``` # common.sh export MY_PATH=/home/foo/bar/ export VERSION=42.2a ``` and in both A and B `source common.sh` to load those values. Note that the export may not be required in that case.
5,677,446
I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this?
2011/04/15
[ "https://Stackoverflow.com/questions/5677446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663229/" ]
``` mkfifo /tmp/channel process_a.sh > /tmp/channel& process_b.sh < /tmp/channel& wait ``` Of course you can also just read a single line when you want it. In bash there are coprocs, which also might be what you want. Random example from [this page](http://wiki.bash-hackers.org/syntax/keywords/coproc) ``` # l...
You may echo values to files, then the other script may read them. If you want to use it as a parameter for something, use reverse aposthrophe: ``` echo `cat storedvalue` ``` Be careful, if the two scripts are running at the same time, concurrency problems may occur, which can cause rarely appearing, mystic-looking ...
5,677,446
I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this?
2011/04/15
[ "https://Stackoverflow.com/questions/5677446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663229/" ]
Think of each script as a function: function A calculates some value and returns it. It does not know who will call it. Function B takes in some value and echo it. It does not care who produced that value. So, script A is: ``` #!/bin/sh # a.sh: Calculate something and return the result echo 19 ``` and script B is: ...
Actually all your need is `source` you can skip the `export` prefix. *My use-case was an environment specific settings file, example:* Within **main\_script.sh** ``` THIS_DIR=`dirname $0` source $THIS_DIR/config_vars.sh # other commands ``` Within **config\_vars.sh** ``` LOCAL_ROOT="$HOME/folder/folder" REMOTE_US...
5,677,446
I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this?
2011/04/15
[ "https://Stackoverflow.com/questions/5677446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663229/" ]
If I understood the requirement then can't both scripts be simply executed in same sub shell, independently but **without** calling each other or without any need of an external file or pipe like this: Let's say this is your **script1.sh** ``` #!/bin/bash # script1.sh: do something and finally export x=19 ``` And h...
Actually all your need is `source` you can skip the `export` prefix. *My use-case was an environment specific settings file, example:* Within **main\_script.sh** ``` THIS_DIR=`dirname $0` source $THIS_DIR/config_vars.sh # other commands ``` Within **config\_vars.sh** ``` LOCAL_ROOT="$HOME/folder/folder" REMOTE_US...
5,677,446
I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this?
2011/04/15
[ "https://Stackoverflow.com/questions/5677446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663229/" ]
If I understood the requirement then can't both scripts be simply executed in same sub shell, independently but **without** calling each other or without any need of an external file or pipe like this: Let's say this is your **script1.sh** ``` #!/bin/bash # script1.sh: do something and finally export x=19 ``` And h...
Think of each script as a function: function A calculates some value and returns it. It does not know who will call it. Function B takes in some value and echo it. It does not care who produced that value. So, script A is: ``` #!/bin/sh # a.sh: Calculate something and return the result echo 19 ``` and script B is: ...
5,677,446
I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this?
2011/04/15
[ "https://Stackoverflow.com/questions/5677446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663229/" ]
If I understood the requirement then can't both scripts be simply executed in same sub shell, independently but **without** calling each other or without any need of an external file or pipe like this: Let's say this is your **script1.sh** ``` #!/bin/bash # script1.sh: do something and finally export x=19 ``` And h...
``` mkfifo /tmp/channel process_a.sh > /tmp/channel& process_b.sh < /tmp/channel& wait ``` Of course you can also just read a single line when you want it. In bash there are coprocs, which also might be what you want. Random example from [this page](http://wiki.bash-hackers.org/syntax/keywords/coproc) ``` # l...
5,677,446
I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this?
2011/04/15
[ "https://Stackoverflow.com/questions/5677446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663229/" ]
``` mkfifo /tmp/channel process_a.sh > /tmp/channel& process_b.sh < /tmp/channel& wait ``` Of course you can also just read a single line when you want it. In bash there are coprocs, which also might be what you want. Random example from [this page](http://wiki.bash-hackers.org/syntax/keywords/coproc) ``` # l...
Think of each script as a function: function A calculates some value and returns it. It does not know who will call it. Function B takes in some value and echo it. It does not care who produced that value. So, script A is: ``` #!/bin/sh # a.sh: Calculate something and return the result echo 19 ``` and script B is: ...
5,677,446
I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this?
2011/04/15
[ "https://Stackoverflow.com/questions/5677446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663229/" ]
Think of each script as a function: function A calculates some value and returns it. It does not know who will call it. Function B takes in some value and echo it. It does not care who produced that value. So, script A is: ``` #!/bin/sh # a.sh: Calculate something and return the result echo 19 ``` and script B is: ...
Can't you read a third file, let's say settings.sh with the common exported variables? ``` # common.sh export MY_PATH=/home/foo/bar/ export VERSION=42.2a ``` and in both A and B `source common.sh` to load those values. Note that the export may not be required in that case.
5,677,446
I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this?
2011/04/15
[ "https://Stackoverflow.com/questions/5677446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/663229/" ]
``` mkfifo /tmp/channel process_a.sh > /tmp/channel& process_b.sh < /tmp/channel& wait ``` Of course you can also just read a single line when you want it. In bash there are coprocs, which also might be what you want. Random example from [this page](http://wiki.bash-hackers.org/syntax/keywords/coproc) ``` # l...
Can't you read a third file, let's say settings.sh with the common exported variables? ``` # common.sh export MY_PATH=/home/foo/bar/ export VERSION=42.2a ``` and in both A and B `source common.sh` to load those values. Note that the export may not be required in that case.
4,257,267
Let's say you have parameters(s) in your LINQ query where clause, how do you handle that? Here is an example: ``` var peoples= from i in individuals where (string.IsNullOrEmpty(lastName) i.LastName.Equals(lastName)) select i; ```
2010/11/23
[ "https://Stackoverflow.com/questions/4257267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449897/" ]
Try to understand what's going on under the hood: * How query expressions are translated by the compiler * How LINQ to Objects streams its data, and how it defers execution * How queries execute remotely via IQueryable and expression trees It's also worth becoming comfortable with both query expressions, e.g. ``` va...
[101 LinQ Samples](http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx) you can start with samples from MSDN
4,257,267
Let's say you have parameters(s) in your LINQ query where clause, how do you handle that? Here is an example: ``` var peoples= from i in individuals where (string.IsNullOrEmpty(lastName) i.LastName.Equals(lastName)) select i; ```
2010/11/23
[ "https://Stackoverflow.com/questions/4257267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449897/" ]
[101 LinQ Samples](http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx) you can start with samples from MSDN
The best advice I could offer someone just starting with `LINQ` is get [`LINQPad`](http://www.linqpad.net/). It is an invaluable tool and will speed up your learning process significantly. And it comes with lots and lots of samples that demonstrate, and let you work with, all the `LINQ` operators.
4,257,267
Let's say you have parameters(s) in your LINQ query where clause, how do you handle that? Here is an example: ``` var peoples= from i in individuals where (string.IsNullOrEmpty(lastName) i.LastName.Equals(lastName)) select i; ```
2010/11/23
[ "https://Stackoverflow.com/questions/4257267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449897/" ]
[101 LinQ Samples](http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx) you can start with samples from MSDN
You do it in LINQ like you would do in "normal" C#. In your sample you used string.IsNullOrEmpty(), so you don't differentiate between null and "". If that's the case you could write sth. like the following: ``` if ((lastName ?? "") == (i.LastName ?? "")) { // equal } ``` Note: [The ?? operator returns the left-...
4,257,267
Let's say you have parameters(s) in your LINQ query where clause, how do you handle that? Here is an example: ``` var peoples= from i in individuals where (string.IsNullOrEmpty(lastName) i.LastName.Equals(lastName)) select i; ```
2010/11/23
[ "https://Stackoverflow.com/questions/4257267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449897/" ]
Try to understand what's going on under the hood: * How query expressions are translated by the compiler * How LINQ to Objects streams its data, and how it defers execution * How queries execute remotely via IQueryable and expression trees It's also worth becoming comfortable with both query expressions, e.g. ``` va...
The result of a query expression is *a query object*, not *the results of the query*. If you want the results, you can ask the query object to start proffering up results. That is, when you say: ``` var names = from c in customers where c.City == "London" select c.Name; ``` then names is *a query object* that repres...
4,257,267
Let's say you have parameters(s) in your LINQ query where clause, how do you handle that? Here is an example: ``` var peoples= from i in individuals where (string.IsNullOrEmpty(lastName) i.LastName.Equals(lastName)) select i; ```
2010/11/23
[ "https://Stackoverflow.com/questions/4257267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449897/" ]
Try to understand what's going on under the hood: * How query expressions are translated by the compiler * How LINQ to Objects streams its data, and how it defers execution * How queries execute remotely via IQueryable and expression trees It's also worth becoming comfortable with both query expressions, e.g. ``` va...
The best advice I could offer someone just starting with `LINQ` is get [`LINQPad`](http://www.linqpad.net/). It is an invaluable tool and will speed up your learning process significantly. And it comes with lots and lots of samples that demonstrate, and let you work with, all the `LINQ` operators.
4,257,267
Let's say you have parameters(s) in your LINQ query where clause, how do you handle that? Here is an example: ``` var peoples= from i in individuals where (string.IsNullOrEmpty(lastName) i.LastName.Equals(lastName)) select i; ```
2010/11/23
[ "https://Stackoverflow.com/questions/4257267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449897/" ]
Try to understand what's going on under the hood: * How query expressions are translated by the compiler * How LINQ to Objects streams its data, and how it defers execution * How queries execute remotely via IQueryable and expression trees It's also worth becoming comfortable with both query expressions, e.g. ``` va...
You do it in LINQ like you would do in "normal" C#. In your sample you used string.IsNullOrEmpty(), so you don't differentiate between null and "". If that's the case you could write sth. like the following: ``` if ((lastName ?? "") == (i.LastName ?? "")) { // equal } ``` Note: [The ?? operator returns the left-...
4,257,267
Let's say you have parameters(s) in your LINQ query where clause, how do you handle that? Here is an example: ``` var peoples= from i in individuals where (string.IsNullOrEmpty(lastName) i.LastName.Equals(lastName)) select i; ```
2010/11/23
[ "https://Stackoverflow.com/questions/4257267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449897/" ]
The result of a query expression is *a query object*, not *the results of the query*. If you want the results, you can ask the query object to start proffering up results. That is, when you say: ``` var names = from c in customers where c.City == "London" select c.Name; ``` then names is *a query object* that repres...
The best advice I could offer someone just starting with `LINQ` is get [`LINQPad`](http://www.linqpad.net/). It is an invaluable tool and will speed up your learning process significantly. And it comes with lots and lots of samples that demonstrate, and let you work with, all the `LINQ` operators.
4,257,267
Let's say you have parameters(s) in your LINQ query where clause, how do you handle that? Here is an example: ``` var peoples= from i in individuals where (string.IsNullOrEmpty(lastName) i.LastName.Equals(lastName)) select i; ```
2010/11/23
[ "https://Stackoverflow.com/questions/4257267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449897/" ]
The result of a query expression is *a query object*, not *the results of the query*. If you want the results, you can ask the query object to start proffering up results. That is, when you say: ``` var names = from c in customers where c.City == "London" select c.Name; ``` then names is *a query object* that repres...
You do it in LINQ like you would do in "normal" C#. In your sample you used string.IsNullOrEmpty(), so you don't differentiate between null and "". If that's the case you could write sth. like the following: ``` if ((lastName ?? "") == (i.LastName ?? "")) { // equal } ``` Note: [The ?? operator returns the left-...
33,641
What constitutes a Streak Bonus? This is in relation to obtaining the Combat Efficiency Ribbon, which states that you have to obtain 3 Streak Bonuses in a round.
2011/10/29
[ "https://gaming.stackexchange.com/questions/33641", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/306/" ]
Combat Efficiency Ribbon 500 XP Bonus. Get 3 Kill Streaks in one round. To get a streak, you need to kill 8 times in a row without dying yourself. Get 3 Kill Streaks of 8 to unlock this ribbon, try playing on infantry heavy maps to increase your chances early on. Per <http://www.gamefront.com/battlefield-3-ribbons-gu...
After 5 kills without dying, every 3rd thereafter is considered to extend the 'streak'. Thus, to get three in a row, it would be 14 kills. (5 +3 +3 +3 = 14)
33,641
What constitutes a Streak Bonus? This is in relation to obtaining the Combat Efficiency Ribbon, which states that you have to obtain 3 Streak Bonuses in a round.
2011/10/29
[ "https://gaming.stackexchange.com/questions/33641", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/306/" ]
The wording on the bonus is really silly (same goes for the Nemesis ribbon). Once you get 5 kills, you're considered to be a on Combat Efficiency streak. Your 6th kill gives you a 1 streak bonus, 7th kill gives you 2 streak bonus and 8th gives you a 3 streak bonus and hence the ribbon. It is possible to get multiple r...
Combat Efficiency Ribbon 500 XP Bonus. Get 3 Kill Streaks in one round. To get a streak, you need to kill 8 times in a row without dying yourself. Get 3 Kill Streaks of 8 to unlock this ribbon, try playing on infantry heavy maps to increase your chances early on. Per <http://www.gamefront.com/battlefield-3-ribbons-gu...
33,641
What constitutes a Streak Bonus? This is in relation to obtaining the Combat Efficiency Ribbon, which states that you have to obtain 3 Streak Bonuses in a round.
2011/10/29
[ "https://gaming.stackexchange.com/questions/33641", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/306/" ]
The wording on the bonus is really silly (same goes for the Nemesis ribbon). Once you get 5 kills, you're considered to be a on Combat Efficiency streak. Your 6th kill gives you a 1 streak bonus, 7th kill gives you 2 streak bonus and 8th gives you a 3 streak bonus and hence the ribbon. It is possible to get multiple r...
After 5 kills without dying, every 3rd thereafter is considered to extend the 'streak'. Thus, to get three in a row, it would be 14 kills. (5 +3 +3 +3 = 14)
18,229,890
I need to make a custom code which will help me to find location of a particular IP entered through a text box. When I searched the internet what I found is only providing automatic detection of IP and it's location. Please help me.
2013/08/14
[ "https://Stackoverflow.com/questions/18229890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2682127/" ]
Here you go. <http://jsfiddle.net/GLjND/3/> (the yellow background is just so you can see the new div) Just give the divs ``` display: table-cell ``` and you're done.
Here it is - [**fiddle**](http://jsfiddle.net/deepakb/zan9X/4/) ``` <div id="wrapper"> <div id="first"></div> <div id="second"></div> <div id="third"></div> </div> body{ padding:0; margin:0; } #wrapper{ width:500px; height:auto; background:red; } #first{ display: table-cell; ...
18,229,890
I need to make a custom code which will help me to find location of a particular IP entered through a text box. When I searched the internet what I found is only providing automatic detection of IP and it's location. Please help me.
2013/08/14
[ "https://Stackoverflow.com/questions/18229890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2682127/" ]
Here you go. <http://jsfiddle.net/GLjND/3/> (the yellow background is just so you can see the new div) Just give the divs ``` display: table-cell ``` and you're done.
When you are using float property, i recommend you to set overflow:hidden to the parent div ``` #wrapper{ overflow:hidden; } ``` And for the #second u have set the height to 100%, for this to work u should fix an height for the parent div ``` #wrapper{ height:400px; } ``` Here is the [Jsfiddle](http://jsf...
18,229,890
I need to make a custom code which will help me to find location of a particular IP entered through a text box. When I searched the internet what I found is only providing automatic detection of IP and it's location. Please help me.
2013/08/14
[ "https://Stackoverflow.com/questions/18229890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2682127/" ]
Here you go. <http://jsfiddle.net/GLjND/3/> (the yellow background is just so you can see the new div) Just give the divs ``` display: table-cell ``` and you're done.
Just give the CSS property: ``` overflow : hidden display : table-cell ```
14,002
I am working recognition of plant seeds with Matlab, and I am looking for code to remove the shadow in grayscale and binary. ![image of seed with shadow](https://i.stack.imgur.com/9s2hC.jpg) The binarized version of the image is: ![enter image description here](https://i.stack.imgur.com/WMYs1.png)
2014/01/25
[ "https://dsp.stackexchange.com/questions/14002", "https://dsp.stackexchange.com", "https://dsp.stackexchange.com/users/7673/" ]
This question seems to be based on several misconceptions. In a QPSK modulator operating at a rate of $N$ baud, *two* bits enter the modulator during each $T = N^{-1}$ second interval. If the bits are entering on a single wire (at a rate of $2N$ bits per second, the QPSK modulator first *converts* this serial input bi...
sure, in reception of QPSK, you receive bit pairs as they are transmitted, and detangle them in the reverse manner that they were grouped together. what's really cool about OQPSK is that the order of the bits going in can **naturally** determine the order of bit changing in OQPSK. in fact, it can be made into a DSP mo...
1,342,213
Is it possible to get the raw HTTP Request from the HttpServletRequest object? I want to see the raw request as a String if at all possible. I need to get the full text of the request, in this case it's a POST request, so the URL doesn't help. It's also part of a multi-part form, so I can't just call the "getParameter...
2009/08/27
[ "https://Stackoverflow.com/questions/1342213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32812/" ]
Well, it sounds like you are doing some sort of troubleshooting. Why not just drop the multi-part form component while you are looking at the raw form data. You can use the following JSP snippet to construct the form data. ``` <% Enumeration en = request.getParameterNames(); String str = ""; while(en.hasMoreElements()...
Sounds like you need a [servlet filter](http://java.sun.com/javaee/5/docs/api/javax/servlet/Filter.html). There is no standard way to handle `multipart/form-data`, so you'll have to take care to cache this data appropriately when [wrapping the HttpServletRequest](http://java.sun.com/javaee/5/docs/api/javax/servlet/http...
1,342,213
Is it possible to get the raw HTTP Request from the HttpServletRequest object? I want to see the raw request as a String if at all possible. I need to get the full text of the request, in this case it's a POST request, so the URL doesn't help. It's also part of a multi-part form, so I can't just call the "getParameter...
2009/08/27
[ "https://Stackoverflow.com/questions/1342213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32812/" ]
You can read the raw HTTP request by doing: ``` ServletInputStream in = request.getInputStream(); ``` and then use the regular `read`methods of the InputStream. Hope that helps.
Sounds like you need a [servlet filter](http://java.sun.com/javaee/5/docs/api/javax/servlet/Filter.html). There is no standard way to handle `multipart/form-data`, so you'll have to take care to cache this data appropriately when [wrapping the HttpServletRequest](http://java.sun.com/javaee/5/docs/api/javax/servlet/http...
1,342,213
Is it possible to get the raw HTTP Request from the HttpServletRequest object? I want to see the raw request as a String if at all possible. I need to get the full text of the request, in this case it's a POST request, so the URL doesn't help. It's also part of a multi-part form, so I can't just call the "getParameter...
2009/08/27
[ "https://Stackoverflow.com/questions/1342213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32812/" ]
Sounds like you need a [servlet filter](http://java.sun.com/javaee/5/docs/api/javax/servlet/Filter.html). There is no standard way to handle `multipart/form-data`, so you'll have to take care to cache this data appropriately when [wrapping the HttpServletRequest](http://java.sun.com/javaee/5/docs/api/javax/servlet/http...
If you want to get the whole request to a String you can do it with one line of code using the apache IOUtils library. ``` String myString = org.apache.commons.io.IOUtils.toString(request.getInputStream()); ```
1,342,213
Is it possible to get the raw HTTP Request from the HttpServletRequest object? I want to see the raw request as a String if at all possible. I need to get the full text of the request, in this case it's a POST request, so the URL doesn't help. It's also part of a multi-part form, so I can't just call the "getParameter...
2009/08/27
[ "https://Stackoverflow.com/questions/1342213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32812/" ]
Well, it sounds like you are doing some sort of troubleshooting. Why not just drop the multi-part form component while you are looking at the raw form data. You can use the following JSP snippet to construct the form data. ``` <% Enumeration en = request.getParameterNames(); String str = ""; while(en.hasMoreElements()...
or if you can write some interceptor to convert the parameter names and values to string format object and set it in request context, or filter is a good idea too.
1,342,213
Is it possible to get the raw HTTP Request from the HttpServletRequest object? I want to see the raw request as a String if at all possible. I need to get the full text of the request, in this case it's a POST request, so the URL doesn't help. It's also part of a multi-part form, so I can't just call the "getParameter...
2009/08/27
[ "https://Stackoverflow.com/questions/1342213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32812/" ]
You can read the raw HTTP request by doing: ``` ServletInputStream in = request.getInputStream(); ``` and then use the regular `read`methods of the InputStream. Hope that helps.
or if you can write some interceptor to convert the parameter names and values to string format object and set it in request context, or filter is a good idea too.
1,342,213
Is it possible to get the raw HTTP Request from the HttpServletRequest object? I want to see the raw request as a String if at all possible. I need to get the full text of the request, in this case it's a POST request, so the URL doesn't help. It's also part of a multi-part form, so I can't just call the "getParameter...
2009/08/27
[ "https://Stackoverflow.com/questions/1342213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32812/" ]
or if you can write some interceptor to convert the parameter names and values to string format object and set it in request context, or filter is a good idea too.
If you want to get the whole request to a String you can do it with one line of code using the apache IOUtils library. ``` String myString = org.apache.commons.io.IOUtils.toString(request.getInputStream()); ```
1,342,213
Is it possible to get the raw HTTP Request from the HttpServletRequest object? I want to see the raw request as a String if at all possible. I need to get the full text of the request, in this case it's a POST request, so the URL doesn't help. It's also part of a multi-part form, so I can't just call the "getParameter...
2009/08/27
[ "https://Stackoverflow.com/questions/1342213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32812/" ]
You can read the raw HTTP request by doing: ``` ServletInputStream in = request.getInputStream(); ``` and then use the regular `read`methods of the InputStream. Hope that helps.
Well, it sounds like you are doing some sort of troubleshooting. Why not just drop the multi-part form component while you are looking at the raw form data. You can use the following JSP snippet to construct the form data. ``` <% Enumeration en = request.getParameterNames(); String str = ""; while(en.hasMoreElements()...
1,342,213
Is it possible to get the raw HTTP Request from the HttpServletRequest object? I want to see the raw request as a String if at all possible. I need to get the full text of the request, in this case it's a POST request, so the URL doesn't help. It's also part of a multi-part form, so I can't just call the "getParameter...
2009/08/27
[ "https://Stackoverflow.com/questions/1342213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32812/" ]
Well, it sounds like you are doing some sort of troubleshooting. Why not just drop the multi-part form component while you are looking at the raw form data. You can use the following JSP snippet to construct the form data. ``` <% Enumeration en = request.getParameterNames(); String str = ""; while(en.hasMoreElements()...
If you want to get the whole request to a String you can do it with one line of code using the apache IOUtils library. ``` String myString = org.apache.commons.io.IOUtils.toString(request.getInputStream()); ```
1,342,213
Is it possible to get the raw HTTP Request from the HttpServletRequest object? I want to see the raw request as a String if at all possible. I need to get the full text of the request, in this case it's a POST request, so the URL doesn't help. It's also part of a multi-part form, so I can't just call the "getParameter...
2009/08/27
[ "https://Stackoverflow.com/questions/1342213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32812/" ]
You can read the raw HTTP request by doing: ``` ServletInputStream in = request.getInputStream(); ``` and then use the regular `read`methods of the InputStream. Hope that helps.
If you want to get the whole request to a String you can do it with one line of code using the apache IOUtils library. ``` String myString = org.apache.commons.io.IOUtils.toString(request.getInputStream()); ```
3,093,150
I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking. Basically, it should take a URL and load another one instead (locally or on a HTTP development server). Any idea?
2010/06/22
[ "https://Stackoverflow.com/questions/3093150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044/" ]
Not sure if this helps or not, but I just encountered a chrome plugin called Resource Override, which sounds like it does something similar. Im trying out the Fiddler which someone else mentioned, but I think i'm also going to try this one at some point. <https://chrome.google.com/webstore/detail/resource-override/pkoa...
There is [https everywhere which lets you define rules for url rewrites](https://www.eff.org/https-everywhere/rulesets). This should work on all request, including script requests. [Tamper](https://addons.mozilla.org/en-us/firefox/addon/tamper-data/) data might do the job, but I don't know how automated/permanent you ...
3,093,150
I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking. Basically, it should take a URL and load another one instead (locally or on a HTTP development server). Any idea?
2010/06/22
[ "https://Stackoverflow.com/questions/3093150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044/" ]
Try <http://www.fiddler2.com/fiddler2/version.asp> It does that and much more. But it's not a browser extension.
I think this is a task for a personal proxy. You can sniff traffic on the proxy and apply rules to modify requests/content
3,093,150
I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking. Basically, it should take a URL and load another one instead (locally or on a HTTP development server). Any idea?
2010/06/22
[ "https://Stackoverflow.com/questions/3093150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044/" ]
Try <http://www.fiddler2.com/fiddler2/version.asp> It does that and much more. But it's not a browser extension.
Disclaimer: I'm the author of the software :-) A different approach that *might* suit your usecase better is to use a RoboHydra-based development proxy. The idea here would be that you want to keep ALL Javascript files in your machine, and use another server simply as a backend. It's great for eg. front-end developers...
3,093,150
I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking. Basically, it should take a URL and load another one instead (locally or on a HTTP development server). Any idea?
2010/06/22
[ "https://Stackoverflow.com/questions/3093150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044/" ]
Not sure if this helps or not, but I just encountered a chrome plugin called Resource Override, which sounds like it does something similar. Im trying out the Fiddler which someone else mentioned, but I think i'm also going to try this one at some point. <https://chrome.google.com/webstore/detail/resource-override/pkoa...
How about [Greasemonkey](https://addons.mozilla.org/de/firefox/addon/greasemonkey/)? That should be the thing you're searching for!
3,093,150
I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking. Basically, it should take a URL and load another one instead (locally or on a HTTP development server). Any idea?
2010/06/22
[ "https://Stackoverflow.com/questions/3093150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044/" ]
Not sure if this helps or not, but I just encountered a chrome plugin called Resource Override, which sounds like it does something similar. Im trying out the Fiddler which someone else mentioned, but I think i'm also going to try this one at some point. <https://chrome.google.com/webstore/detail/resource-override/pkoa...
Disclaimer: I'm the author of the software :-) A different approach that *might* suit your usecase better is to use a RoboHydra-based development proxy. The idea here would be that you want to keep ALL Javascript files in your machine, and use another server simply as a backend. It's great for eg. front-end developers...
3,093,150
I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking. Basically, it should take a URL and load another one instead (locally or on a HTTP development server). Any idea?
2010/06/22
[ "https://Stackoverflow.com/questions/3093150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044/" ]
I think this is a task for a personal proxy. You can sniff traffic on the proxy and apply rules to modify requests/content
You should probably consider [robohydra](http://dev.opera.com/articles/view/robohydra-a-new-testing-tool-for-client-server-interactions/), since it is specifically developed for your case. They do not support https yet, but they are open to including it in the future.
3,093,150
I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking. Basically, it should take a URL and load another one instead (locally or on a HTTP development server). Any idea?
2010/06/22
[ "https://Stackoverflow.com/questions/3093150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044/" ]
Try <http://www.fiddler2.com/fiddler2/version.asp> It does that and much more. But it's not a browser extension.
Not sure if this helps or not, but I just encountered a chrome plugin called Resource Override, which sounds like it does something similar. Im trying out the Fiddler which someone else mentioned, but I think i'm also going to try this one at some point. <https://chrome.google.com/webstore/detail/resource-override/pkoa...
3,093,150
I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking. Basically, it should take a URL and load another one instead (locally or on a HTTP development server). Any idea?
2010/06/22
[ "https://Stackoverflow.com/questions/3093150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044/" ]
Alternatives: * Using chrome you can change code on the fly (Developer tools -> Sources tab) and just save it (command + s) * Use the LiveReload app that actually attaches an extension (that kind of does what you want) <http://livereload.com/> This may not be the "exact" answer to your question, yet I almost sure one...
ColBeseder correctly brings up Fiddler (http://www.fiddler2.com/fiddler2/version.asp) as a solution to your issue. Fiddler is perfectly capable of handling and decrypting HTTPS traffic as well - see the documentation on the page for how to configure it. To directly answer the OP question, you can use the autorespon...
3,093,150
I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking. Basically, it should take a URL and load another one instead (locally or on a HTTP development server). Any idea?
2010/06/22
[ "https://Stackoverflow.com/questions/3093150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044/" ]
I think this is a task for a personal proxy. You can sniff traffic on the proxy and apply rules to modify requests/content
You can intercept and block requests in browsers. For example in Chrome you can use the `beforeload` event check if it's a JS (`event.target` is script tag or `event.url` ends in .js) call `event.preventDefault()` and then load your own script instead. I'm pretty sure there's a similar way to do this in FF.
3,093,150
I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking. Basically, it should take a URL and load another one instead (locally or on a HTTP development server). Any idea?
2010/06/22
[ "https://Stackoverflow.com/questions/3093150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044/" ]
Try <http://www.fiddler2.com/fiddler2/version.asp> It does that and much more. But it's not a browser extension.
You should probably consider [robohydra](http://dev.opera.com/articles/view/robohydra-a-new-testing-tool-for-client-server-interactions/), since it is specifically developed for your case. They do not support https yet, but they are open to including it in the future.
44,939,086
Let say I have 2 forms in my app. let say loginForm and mainForm. In loginForm allows the user to enter his/her username and password then goes to mainForm. From mainForm is I click the back button it will go back to loginForm and now my **issue** is from loginForm if I will click back button it goes again to mainForm ...
2017/07/06
[ "https://Stackoverflow.com/questions/44939086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
That happend because the Image is a Widget and "the real image" (the picture) is a texture of that Widget, and *by default, the image is centered and fits inside the widget bounding box. If you don’t want that, you can set allow\_stretch to True and keep\_ratio to False.* ([docs](https://kivy.org/docs/api-kivy.uix.imag...
Favcau gives one solution above (and thanks), but I have found what I think is more obvious. All it needs is to have the size defined in the kv file. ``` Image: id: image2 source: 'image_400x90.jpg' pos_hint: {'left':1, 'top':1} size_hint: None, None size: 400, 90 allow_stretch: True keep_r...
66,320,285
I've encountered some unexpected empty lists when using `zip` to transpose the results of `itertools.groupby`. In reality my data is a bunch of objects, but for simplicity let's say my starting data is this list: ``` > a = [1, 1, 1, 2, 1, 3, 3, 2, 1] ``` I want to group the duplicates, so I use `itertools.groupby` (...
2021/02/22
[ "https://Stackoverflow.com/questions/66320285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2251982/" ]
You should avoid using apply whenever possible, but appending items to a list in a cell is tricky and I'm not sure of any way to do so without some sort of iteration. That being said, your operation could be optimized slightly by placing the date conditional in an indexer and then applying on the filtered result. This ...
This code is computationally more efficient (a little bit) although I don't know if I'd call it better. Your code would work fine and be easier to read. You can make this even more efficient if you didn't uses lists within the pandas rows. (I could think of a more efficient way to append than using a lambda.) ``` im...
17,366,978
I need a way to convert special characters like this: `Helloæ` To normal characters. So this word would end up being `Helloae`. So far I have tried `HttpUtility.Decode`, or a method that would convert UTF8 to win1252, but nothing worked. Is there something simple and generic that would do this job? Thank you. **EDI...
2013/06/28
[ "https://Stackoverflow.com/questions/17366978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2021863/" ]
See: [Does .NET transliteration library exists?](https://stackoverflow.com/questions/10027001/does-net-transliteration-library-exists) [UnidecodeSharpFork](https://bitbucket.org/DimaStefantsov/unidecodesharpfork) Usage: ``` var result = "Helloæ".Unidecode(); Console.WriteLine(result) // Prints Helloae ```
There is no direct mapping between `æ` and `ae` they are completely different unicode code points. If you need to do this you'll most likely need to write a function that maps the offending code points to the strings that you desire. Per the comments you may need to take a two stage approach to this: 1. Remove the di...
315,796
I intend to setup a samba share server that all user can write files to but they can not delete files was put in that folder. Which configuration is suitable for me! Thanks in advanced!
2011/09/27
[ "https://serverfault.com/questions/315796", "https://serverfault.com", "https://serverfault.com/users/9401/" ]
The user needs to have the linux file system rwx permissions on the directory the file is in, to be able to delete files in the directory. You can achieve this by default in a few different ways, for new files one method is the use of default create masks so all new files and folders will have the correct linux file s...
As far as I know it isn't done with samba, but with linux. You should assign the sticky flag to the main share directory with chmod. For example, if you're sharing /home/foo you should execute "chmod +t /home/foo/". Also I suggest to use the linux ACL system or the default creation mask in samba configuration to propa...
4,018,268
I am struggling with a concept of finding the **radius** in the shell method of finding the volume of the solid when revolved around a line other than the axis. Maybe the issue here is that I am looking for a "rule" instead of actually visualizing the problem. It was my understanding that when revolving around a line o...
2021/02/08
[ "https://math.stackexchange.com/questions/4018268", "https://math.stackexchange.com", "https://math.stackexchange.com/users/163862/" ]
You would only "use the absolute value of 1 plus the x" if the region of rotation was to the right of the vertical line of revolution AND the left boundary of the region of rotation were to the left of the y-axis. Perhaps most of the problems you did in the past were this case. --- There are rules for these types of ...
" Maybe the issue here is that I am looking for a "rule" instead of actually visualizing the problem". I am not sure if that is a good idea. However, what you CAN do is, perform a horizontal translation (a shift of $1$ units to the left) on all functions in question. So "Use the method of cylindrical shells to find the...
3,425,319
Prove the divisibility test by $7,11,13$ for numbers more than six digits --- **Attempt:** We know that $7\cdot 11 \cdot 13 = 1001$. The for a six-digit number, for example, $120544$, we write it as $$ 120544 = 120120 + 424 = 120\cdot1001 + 424 $$ thus we just check the divisibility of $424$ by $7,11,13$. Know for ...
2019/11/07
[ "https://math.stackexchange.com/questions/3425319", "https://math.stackexchange.com", "https://math.stackexchange.com/users/97835/" ]
It's the [radix$+1$ divisibility test](https://math.stackexchange.com/a/16015/242) for radix $10^3,\,$ i.e. the analog of casting out $11's$ in radix $10,\,$ viz. $\!\!\!\begin{align}\bmod 10^{\large 3}\!+\!1\!:\,\ \color{#0a0}{10^{\large 3}}\equiv \color{#c00}{\bf -1}\, \ \Rightarrow\!\!\!\! &\ \ \ \ \ \ \overbrace{d...
$1001$ divides $999,999$ and $999,999 = 1,000,000 - 1$ $270,060,340 = (270,000,000 - 27) + (60,000 + 60) + 340 + 27 -60$ The first two terms are divisible by $1001$ (and hence 7,11, and 13)
3,425,319
Prove the divisibility test by $7,11,13$ for numbers more than six digits --- **Attempt:** We know that $7\cdot 11 \cdot 13 = 1001$. The for a six-digit number, for example, $120544$, we write it as $$ 120544 = 120120 + 424 = 120\cdot1001 + 424 $$ thus we just check the divisibility of $424$ by $7,11,13$. Know for ...
2019/11/07
[ "https://math.stackexchange.com/questions/3425319", "https://math.stackexchange.com", "https://math.stackexchange.com/users/97835/" ]
It's the [radix$+1$ divisibility test](https://math.stackexchange.com/a/16015/242) for radix $10^3,\,$ i.e. the analog of casting out $11's$ in radix $10,\,$ viz. $\!\!\!\begin{align}\bmod 10^{\large 3}\!+\!1\!:\,\ \color{#0a0}{10^{\large 3}}\equiv \color{#c00}{\bf -1}\, \ \Rightarrow\!\!\!\! &\ \ \ \ \ \ \overbrace{d...
For 9-digit number: $abcdefghi$, $$ abcdefghi = abc000000 + defghi = abc000000 + def \cdot 1001 - def + ghi $$ so we check divisibility of $$ abc000000 - def + ghi = abc \cdot 1001000 - abc000 - def + ghi$$ so we cehck divisibility of $$ -abc000 - def + ghi = -(abc \cdot 1001 - abc) - def + ghi$$ in the end we only...
2,716,498
> > Does a closed form of the following sum exist?$$\sum\_{n=0}^\infty \frac{1}{{2}^{2n}}\frac{\binom{2n}{n}}{{(2n+1)}^2}$$ > > >
2018/03/31
[ "https://math.stackexchange.com/questions/2716498", "https://math.stackexchange.com", "https://math.stackexchange.com/users/534404/" ]
Yes. Starting with $$ \frac1{\sqrt{1-4x^2}} = \sum\_{n=0}^\infty \binom{2n}n x^{2n}, $$ you can perform the following steps to obtain your sum: * multiply by $x$ * integrate * divide by $x$ * integrate again * divide by $x^2$ * set $x=\frac12$ Mathematica says that the ultimate answer is $\frac{\pi\log4}4$.
$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \new...
155,797
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
2018/02/14
[ "https://codegolf.stackexchange.com/questions/155797", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/56656/" ]
[Jelly](https://github.com/DennisMitchell/jelly), 5 bytes ========================================================= ``` IṠIỊẠ ``` Returns **0** if there's a bump, **1** if not. [Try it online!](https://tio.run/##y0rNyan8/9/z4c4Fng93dz3cteD/4fZHTWsi//@PjtVRiDYEEzpGUEoHxkeIGMNFkCQRonC9xhCGkY4BUB0A "Jelly – Try It Onl...
[APL (Dyalog)](https://www.dyalog.com/), ~~15~~ ~~19~~ 20 bytes =============================================================== *2 bytes saved thanks to @EriktheOutgolfer* ```apl {2>≢⍵:0⋄2∊|2-/×2-/⍵} ``` [Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24RqI7tHnYse9W61MnjU3WL0qKOrxkhX//B0IAEUrAUqUnjUu4YrTcGQi...
155,797
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
2018/02/14
[ "https://codegolf.stackexchange.com/questions/155797", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/56656/" ]
[Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 40 bytes ================================================================================== ``` MatchQ[{___,x_,y_,z_,___}/;x<y>z||x>y<z] ``` [Try it online!](https://tio.run/##y00syUjNTSzJTE78n6Zg@983sSQ5IzC6Oj4@XqciXqcyXqcqXgfIqdW3rrCptKuqqam...
[Python 2](https://docs.python.org/2/), 60 bytes ================================================ ```python lambda l:any(p>c<n or p<c>n for p,c,n in zip(l,l[1:],l[2:])) ``` [Try it online!](https://tio.run/##HcY7DoAgEAXAq7wSkm3AjqAXUQrEEElw3RgbvTx@msnIda4725b7qdW4zUtEdZEvJUPyjP2A@DQw8jdKxCiMu4iqVEfjwqt1QesmR@ETWY2GY...
155,797
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
2018/02/14
[ "https://codegolf.stackexchange.com/questions/155797", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/56656/" ]
[Perl 6](http://perl6.org/), 39 bytes ===================================== ``` {so~(.[1..*]Zcmp$_)~~/'re L'|'s M'/} ``` [Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/uji/TkMv2lBPTys2Kjm3QCVes65OX70oVcFHvUa9WMFXXb/2f3FipYKSSryCrZ1CdZqCSnytkkJafpFCdKyOgo2hHYhQMIJSCjA@QsQYLoIkiRCF6zWGMIwUDIDq/gMA "Perl 6 – Tr...
[Julia 0.6](http://julialang.org/), 57 56 bytes =============================================== ```julia l->any(p>c<n||p<c>n for(p,c,n)=zip(l,l[2:end],l[3:end])) ``` Basically just totallyhuman's python answer. -1 byte from user71546 [Try it online!](https://tio.run/##yyrNyUw0@59mm5Sanpn3P0fXLjGvUqPALtkmr6amwCbZLk8...
155,797
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
2018/02/14
[ "https://codegolf.stackexchange.com/questions/155797", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/56656/" ]
[Jelly](https://github.com/DennisMitchell/jelly), 5 bytes ========================================================= ``` IṠIỊẠ ``` Returns **0** if there's a bump, **1** if not. [Try it online!](https://tio.run/##y0rNyan8/9/z4c4Fng93dz3cteD/4fZHTWsi//@PjtVRiDYEEzpGUEoHxkeIGMNFkCQRonC9xhCGkY4BUB0A "Jelly – Try It Onl...
[Perl 5](https://www.perl.org/), 54 + 2 (`-pa`) = 56 bytes ========================================================== ```perl map$\|=$F[$_-1]!=(sort{$a-$b}@F[$_-2..$_])[1],2..$#F}{ ``` [Try it online!](https://tio.run/##K0gtyjH9/z83sUAlpsZWxS1aJV7XMFbRVqM4v6ikWiVRVyWp1gEsaqSnpxIfqxltGKsDYiq71Vb//2@oYASEBv/yC0oy8/OK/...
155,797
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
2018/02/14
[ "https://codegolf.stackexchange.com/questions/155797", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/56656/" ]
[Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~37~~ 36 bytes ========================================================================================= ``` FreeQ[(d=Differences)@Sign@d@#,-2|2]& ``` Gives the opposite of the test case answers (False and True reversed). Prepend a `!` to swi...
[Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 43 bytes ====================================================================================================================== ``` .+ $* 1`(1+)1¶\1¶1\1|¶(1+)(?<!\2¶\2)¶(?!\2) ``` [Try it online!](https://ti...
155,797
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
2018/02/14
[ "https://codegolf.stackexchange.com/questions/155797", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/56656/" ]
[Brachylog](https://github.com/JCumin/Brachylog), 10 bytes ========================================================== ``` s₃.¬≤₁∧¬≥₁ ``` [Try it online!](https://tio.run/##SypKTM6ozMlPN/r/v/hRU7PeoTWPOpc8amp81LEcxFwKZP7/H22oY6QDxLEA "Brachylog – Try It Online") Succeeds (`true.`) if there is a bump, and fails (`fal...
[Husk](https://github.com/barbuz/Husk), 9 bytes =============================================== ``` ▼mεẊ-Ẋo±- ``` [Try it online!](https://tio.run/##yygtzv7//9G0Pbnntj7c1aULxPmHNur@//8/2kgHCGMB "Husk – Try It Online") Uses Dennis's algorithm.