prompt
stringlengths
48
2.37k
chosen
stringlengths
7
4.28k
rejected
stringlengths
11
4.44k
Question: I have a dictionary of variablenames and I want those to be the variablenames in another script. So I probably need to identify all variables in a Python script and then somehow replace those with the desired ones from the dictionary. Yet I cannot figure out what might be the most elegant way to do that. Do ...
Afaik no, signed pdfs can't be merged, cause the signature is applied to the document, not to its range. Changing the document invalidates the signature.
If you are not concerned about invalidating the signature you can always print to Adobe PDF again and then combine with other PDFs.
Question: I have a C# code that is using an external library which can throw exceptions. In three parts of my code, I want to process these exceptions the following way: ``` try { CallOtherLibrary(); } catch(ExceptionA) { ProcessErrorA(); } catch(ExceptionB) { ProcessErrorB(); } ``` Now I think that copy pa...
You can make a `Dictionary<Type, Action> exceptionHandlers` and then call `exceptionHandlers[exception.GetType()]()` in the catch block. ``` void ProcessErrorA() { } void Main() { Dictionary<Type, Action> exceptionHandlers = new Dictionary<Type, Action>(); exceptionHandlers.Add(typeof(Nu...
Maybe you could do something like this (adapt for own use): ``` class Program { public int Divide_InExternalLib(int a, int b) { Console.WriteLine(string.Format("a={0}, b={1}", a, b)); int result = a / b; Console.WriteLine(string.Format("Result = {0}", result)); return result; ...
Question: I have a C# code that is using an external library which can throw exceptions. In three parts of my code, I want to process these exceptions the following way: ``` try { CallOtherLibrary(); } catch(ExceptionA) { ProcessErrorA(); } catch(ExceptionB) { ProcessErrorB(); } ``` Now I think that copy pa...
You can make a `Dictionary<Type, Action> exceptionHandlers` and then call `exceptionHandlers[exception.GetType()]()` in the catch block. ``` void ProcessErrorA() { } void Main() { Dictionary<Type, Action> exceptionHandlers = new Dictionary<Type, Action>(); exceptionHandlers.Add(typeof(Nu...
Provide a common exception handler function ``` static void Main(string[] args) { try { CallOtherLibrary(); } catch (Exception ex) { HandleException(ex); } } private static void HandleExcep...
Question: I have a C# code that is using an external library which can throw exceptions. In three parts of my code, I want to process these exceptions the following way: ``` try { CallOtherLibrary(); } catch(ExceptionA) { ProcessErrorA(); } catch(ExceptionB) { ProcessErrorB(); } ``` Now I think that copy pa...
You are looking for a wrapper of the alien library. In C# this is commonly done by using an `interface` with a method acting as an [Facade](https://en.wikipedia.org/wiki/Facade_pattern)/[Adapter](https://en.wikipedia.org/wiki/Adapter_pattern). You create a new class acting as an adaptee, implementing the adapter inter...
Maybe you could do something like this (adapt for own use): ``` class Program { public int Divide_InExternalLib(int a, int b) { Console.WriteLine(string.Format("a={0}, b={1}", a, b)); int result = a / b; Console.WriteLine(string.Format("Result = {0}", result)); return result; ...
Question: I have a C# code that is using an external library which can throw exceptions. In three parts of my code, I want to process these exceptions the following way: ``` try { CallOtherLibrary(); } catch(ExceptionA) { ProcessErrorA(); } catch(ExceptionB) { ProcessErrorB(); } ``` Now I think that copy pa...
You are looking for a wrapper of the alien library. In C# this is commonly done by using an `interface` with a method acting as an [Facade](https://en.wikipedia.org/wiki/Facade_pattern)/[Adapter](https://en.wikipedia.org/wiki/Adapter_pattern). You create a new class acting as an adaptee, implementing the adapter inter...
Provide a common exception handler function ``` static void Main(string[] args) { try { CallOtherLibrary(); } catch (Exception ex) { HandleException(ex); } } private static void HandleExcep...
Question: I am trying to convert time zones from the usual format that `date +%z` is giving, to a 24 hour system. What I mean is that when I ask for ``` # date +%z +0300 ``` I want to get ``` # date +%z | something_in_awk_or_perl 3 ``` But, when I get ``` # date +%z -0700 ``` I want ``` # date +%z | somethi...
How about using awk: ``` $ TZ=UTC-1 date +%:::z | awk 'BEGIN{FS=OFS=":"}{$1=(24+$1)%24}1' 1 $ TZ=UTC+7:30 date +%:::z | awk 'BEGIN{FS=OFS=":"}{$1=(24+$1)%24}1' 17:30 ``` If you want decimal output, change the output separator and divide by 6: ``` $ TZ=UTC-1 date +%:::z | awk -F: 'BEGIN{OFS="."}{$1=(24+$1)%24;$2/=6...
``` for tz in America/Juneau America/St_Johns UTC Australia/Eucla Asia/Tokyo; do TZ=$tz date "+%z %Z" | gawk 'match($1,/([-+])([0-9][0-9])([0-9][0-9])/,a) { sign = (a[1] == "-" ? -1 : 1) print $2, $1, (sign*(a[2] + a[3]/60) + 24) % 24 }' done ``` ``` AKDT -0800 16 NDT -0230 22.5 UTC +0000...
Question: I have only access to db and read-only access to hbm.xml files. It is need to increase column size. I see that in table/column definition in hbm.xml files for this table no attribute length. Should application work with increased column size in this case? Answer:
Yes, it will. Hibernate doesn't care about the length of the columns. Why don't you simply test it?
Hibernate doesn't limit the length of it's attributes it's a limitation set at database level. Normally DB will allocate enough length for the relevant fields. Since you said you only have read access I don't think that it's relevant anyway...
Question: 1. I want to make certain. Can I create for example button programmatically in viewDidLoad, if this view is connect to the xib? 2. Can I customize view programmatically via IBOutlet. Answer:
I am not sure that what happening in your code but i guess You should add all subview programatically and refresh on button click event, or write code in viewDidAppear method.
May be this is helpful to you. One way is create on UI method that set default or required value for required controllers. And call it on button event.
Question: 1. I want to make certain. Can I create for example button programmatically in viewDidLoad, if this view is connect to the xib? 2. Can I customize view programmatically via IBOutlet. Answer:
Reloading them sounds like the wrong thing to do. You can easily reset them to their default state programmatically by setting the various properties to your defaults. Once you do that I would probably just create the whole view and subviews programmatically without using IB. I do everything programmatically now and fi...
May be this is helpful to you. One way is create on UI method that set default or required value for required controllers. And call it on button event.
Question: this is a code with MRTK to continuously get the position of my hand with Hololens 1. but it doesn't work because trygetposition is not recognized. how can i solve this problem ? ``` using System.Collections; using System.Collections.Generic; using UnityEngine; using Microsoft.MixedReality.Toolkit; u...
There's a syntax error in the computed property. Also, you only need a `computed` property to show the initials of the `name`: ```js const comp = Vue.component('comp', { template: '#myComp', props: { name: { type: String } }, computed: { computedInitial: { get() { let initials = this.na...
your computed option should be like ``` computed:{ computedInitial:{ get(){ return this.name } } } ``` But I recommend to define `showInitial` as another computed property in order to be changed : ``` <template> <div> {{ showInitial }} </div> </template> <...
Question: This is an FM transmitter that I built. I wanted to interface it with a microcontroller. The enable connection seems to work, but the range is extremely weak (about one inch), even when running off of a 9V battery. I know I didn't show it in the circuit, but I connected a 22uF capacitor across the 9V batte...
When you're working at VHF frequencies (like 100 MHz), parts layout is *very* important - all components around the oscillating transistor should have short leads, and be placed in a compact space. -It is also easy to **miss** the fundamental oscillating frequency when tuning your receiver...although the FM broadcas...
Antenna must have a ground plane if just a 1/4 wave. Square law Friis losses dictate you must have 4x the power to get twice the distance. antenna gain is the best way with directional Yagi. Rotor control improves range with directional error. <https://www.pasternack.com/t-calculator-friis.aspx>
Question: I am invoking a java process using Apache exec library. I need to do some operation if the process is forcefully stopped ( using task manager or some other way). Is there any option available in exec library ? I found a waitfor() operation in ResultHandler, which is doing a busy wait. Is there any notificatio...
Avoid to hardcode javascript handlers and inline events inside the output of php code: do instead ``` echo '<div class="overlay">'; echo "<button>Close</button>"; echo '</div>'; ``` and previously insert in your page this code that detects a click on your button using event delegation ``` <script> $(document).on(...
try: ``` <button onclick="this.parentNode.style.display = 'none'; return false;">Close</button> ```
Question: I am invoking a java process using Apache exec library. I need to do some operation if the process is forcefully stopped ( using task manager or some other way). Is there any option available in exec library ? I found a waitfor() operation in ResultHandler, which is doing a busy wait. Is there any notificatio...
Avoid to hardcode javascript handlers and inline events inside the output of php code: do instead ``` echo '<div class="overlay">'; echo "<button>Close</button>"; echo '</div>'; ``` and previously insert in your page this code that detects a click on your button using event delegation ``` <script> $(document).on(...
Try this code: ``` function myfunc() { //then I have a div... echo '<div class="overlay" id="overlay" >'; echo "<button onclick=\"hide()\">Close</button>"; echo '</div>'; } //using the javascript code: function hide() { document.getElementById("overlay").style.display="none"; } ```
Question: I am invoking a java process using Apache exec library. I need to do some operation if the process is forcefully stopped ( using task manager or some other way). Is there any option available in exec library ? I found a waitfor() operation in ResultHandler, which is doing a busy wait. Is there any notificatio...
Avoid to hardcode javascript handlers and inline events inside the output of php code: do instead ``` echo '<div class="overlay">'; echo "<button>Close</button>"; echo '</div>'; ``` and previously insert in your page this code that detects a click on your button using event delegation ``` <script> $(document).on(...
try: ``` $('.overlay button').live('click',function( $('.overlay').css({'display': 'none'}); )); ```
Question: I am invoking a java process using Apache exec library. I need to do some operation if the process is forcefully stopped ( using task manager or some other way). Is there any option available in exec library ? I found a waitfor() operation in ResultHandler, which is doing a busy wait. Is there any notificatio...
try: ``` <button onclick="this.parentNode.style.display = 'none'; return false;">Close</button> ```
try: ``` $('.overlay button').live('click',function( $('.overlay').css({'display': 'none'}); )); ```
Question: I am invoking a java process using Apache exec library. I need to do some operation if the process is forcefully stopped ( using task manager or some other way). Is there any option available in exec library ? I found a waitfor() operation in ResultHandler, which is doing a busy wait. Is there any notificatio...
Try this code: ``` function myfunc() { //then I have a div... echo '<div class="overlay" id="overlay" >'; echo "<button onclick=\"hide()\">Close</button>"; echo '</div>'; } //using the javascript code: function hide() { document.getElementById("overlay").style.display="none"; } ```
try: ``` $('.overlay button').live('click',function( $('.overlay').css({'display': 'none'}); )); ```
Question: In a portfolio web design which focuses on the mobile version design (because of the scenario in which users will use it) **does it make sense to keep a hamburger menu for the desktop version?** It's a responsive webpage, and when I am on the desktop version, the menu seems inexistent. (It's also located on t...
As [Evil Closet Monkey](https://ux.stackexchange.com/users/5591/evil-closet-monkey) said, it doesn't make sense that the hamburger icon is being used on a desktop version of the site. If you're using a responsive framework, like [Bootstrap](http://getbootstrap.com/) or [Foundation](http://foundation.zurb.com/), they sh...
I agree with the answer and comments above, it's like UX 101 and I won't argue with that but... let me add a different view to consider. You say this is for a portfolio. Portfolios are meant to display your work, but also who you are. It's a way to tell the world "Hey, I'm me. And additionally, I can do all of this!"....
Question: In a portfolio web design which focuses on the mobile version design (because of the scenario in which users will use it) **does it make sense to keep a hamburger menu for the desktop version?** It's a responsive webpage, and when I am on the desktop version, the menu seems inexistent. (It's also located on t...
As [Evil Closet Monkey](https://ux.stackexchange.com/users/5591/evil-closet-monkey) said, it doesn't make sense that the hamburger icon is being used on a desktop version of the site. If you're using a responsive framework, like [Bootstrap](http://getbootstrap.com/) or [Foundation](http://foundation.zurb.com/), they sh...
Context is everything. Maybe it matters, maybe it doesn't. The fact that it's a portfolio site has no real bearing in and of itself. Generically speaking, should you retain the hamburger menu on larger screens? Traditionally we haven't. But it's becoming an increasingly popular option. Some sites that retain the hamb...
Question: In a portfolio web design which focuses on the mobile version design (because of the scenario in which users will use it) **does it make sense to keep a hamburger menu for the desktop version?** It's a responsive webpage, and when I am on the desktop version, the menu seems inexistent. (It's also located on t...
The hamburger menu... I'm torn. ***The hamburger menu decreases discoverability because it hides what the user is more than likely going to use to... well... discover*** At a glance, the user can tell what's where and how to find what they are looking for. Being hidden underneath someplace isn't ideal for scanability...
I agree with the answer and comments above, it's like UX 101 and I won't argue with that but... let me add a different view to consider. You say this is for a portfolio. Portfolios are meant to display your work, but also who you are. It's a way to tell the world "Hey, I'm me. And additionally, I can do all of this!"....
Question: In a portfolio web design which focuses on the mobile version design (because of the scenario in which users will use it) **does it make sense to keep a hamburger menu for the desktop version?** It's a responsive webpage, and when I am on the desktop version, the menu seems inexistent. (It's also located on t...
Context is everything. Maybe it matters, maybe it doesn't. The fact that it's a portfolio site has no real bearing in and of itself. Generically speaking, should you retain the hamburger menu on larger screens? Traditionally we haven't. But it's becoming an increasingly popular option. Some sites that retain the hamb...
I agree with the answer and comments above, it's like UX 101 and I won't argue with that but... let me add a different view to consider. You say this is for a portfolio. Portfolios are meant to display your work, but also who you are. It's a way to tell the world "Hey, I'm me. And additionally, I can do all of this!"....
Question: In a portfolio web design which focuses on the mobile version design (because of the scenario in which users will use it) **does it make sense to keep a hamburger menu for the desktop version?** It's a responsive webpage, and when I am on the desktop version, the menu seems inexistent. (It's also located on t...
The hamburger menu... I'm torn. ***The hamburger menu decreases discoverability because it hides what the user is more than likely going to use to... well... discover*** At a glance, the user can tell what's where and how to find what they are looking for. Being hidden underneath someplace isn't ideal for scanability...
Context is everything. Maybe it matters, maybe it doesn't. The fact that it's a portfolio site has no real bearing in and of itself. Generically speaking, should you retain the hamburger menu on larger screens? Traditionally we haven't. But it's becoming an increasingly popular option. Some sites that retain the hamb...
Question: I'm having a arraylist which I need to specify the type in runtime. ``` ArrayList<String> alist = new ArrayList<String>(); ``` I need to specify the type "String" at runtime. how can I do that. It should not be static. Answer:
Thats no possible due to [type erasure](http://java.sun.com/docs/books/tutorial/java/generics/erasure.html) — a process where the compiler removes all information related to type parameters and type arguments within a class or method. It's only available during compile time, to check types. EDIT: As a workaround to ...
You mean you want to parameterize the type used to create the `ArrayList`? ``` public <T> List<T> interestingMethod(Class<T> type) { List<T> aList = new ArrayList<T>(); // do something interesting... return aList; } ``` Passing the `type` argument is only needed for type inference and I find this pattern...
Question: I'm having a arraylist which I need to specify the type in runtime. ``` ArrayList<String> alist = new ArrayList<String>(); ``` I need to specify the type "String" at runtime. how can I do that. It should not be static. Answer:
Thats no possible due to [type erasure](http://java.sun.com/docs/books/tutorial/java/generics/erasure.html) — a process where the compiler removes all information related to type parameters and type arguments within a class or method. It's only available during compile time, to check types. EDIT: As a workaround to ...
The generic type parameter is not compiled into the bytecode, therefore it is not available at runtime. An ArrayList<String> is simply an ArrayList at runtime. The closest thing you can achieve, is to add runtime checks yourself. For example, Collections class provides a [decorator](http://en.wikipedia.org/wiki/Decora...
Question: Consider the following piece of swift code ``` view1.autoPinEdge(.top, toEdge: .bottom, ofView: view2) ``` what is going on with `.top`, `.bottom`? 1) Why is this seemingly ambiguous way of specifying a variable allowed? 2) How does swift handle the situation where there are many possible `.top` and `...
The method is (most likely) declared as ``` func autoPinEdge(_ from: UIRectEdge, toEdge: UIRectEdge, ofView: UIView) ``` so the compiler knows that the type of the first two parameters is `UIRectEdge`. --- The full syntax to call the method is ``` view1.autoPinEdge(UIRectEdge.top, toEdge: UIRectEdge.bottom, ofVi...
This is just a shorthand way of using an enum value. for example, using the function... ``` func applyColour(_ colour: UIColor) { // apply the colour } ``` Could be called using the following syntax ``` applyColour(UIColor.red) ``` or ``` applyColour(.red) ``` Because the compiler knows that the function ...
Question: So I'm getting started with React Native. Honestly working with XCode has been one of the most miserable development experiences I've experienced in my life. The simulator literally takes 20+ minutes to boot up (is this normal??) and when it does I can't launch the app because it's on port 8081 which apparent...
Had the same problem, I found that the React library takes a user defined setting to change the default port : `RCT_METRO_PORT` in : -> Libraries -> React.xcodeproj -> Build Settings -> Add user defined setting i added this and it solved my problem
In `react-native: 0.60.5` Go to > [Your Project] > ios > [Your Project].xcodeproj > project.pbxproj. Search for 8081 and replace all the port 8081 to 8089(example) ``` shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8089}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_mod...
Question: my code is this ``` bv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if(mp.isPlaying()){ mp.pause(); bv.setImageResource(R.drawable.playzz); ...
You should do this in a separate thread (assuming mp is a field): ``` mp.setOnCompletionListener(new OnCompletionListener() { int n = 0; @Override public void onCompletion(MediaPlayer mp) { if (n < 10) { mp.start(); n...
I believe that the song starts 10 times without waiting for the first instance to end, so what you need to do is check if the song is still playing and start it again only after it has stopped playing. Maybe something like this - ``` for (int i=1; i<=10 ; i++){ mp.start(); while(mp.isPlayin...
Question: If you are building a large cloud based platform, you will have so many different modules/components within that platform. This ranges from web service configurations (address, ports,...) to domain specific configurations for every component that you have. One can configure such system by giving every compone...
Chef/Puppet are the standard ways to centralize provisioning of multiple stacks on various machines. The central server can bring up remote nodes, and then push required stack on that machine. While I have seen usage of same for provisioning of software, I think it very well can be extended to fulfill your needs!
[WCF Discovery Overview](http://msdn.microsoft.com/en-us/library/dd456791.aspx) Make a service and when a service announces, it adds to the list of services. Use Metadata to serve up configuration settings and such. To be fair, there is also [Mono.Zeroconf](http://www.mono-project.com/Mono.Zeroconf) which requires bo...
Question: This if for the C++ gurus out there. Consider the following code: ``` class X { }; template <class T> class Mistake { public: T x; Mistake(const T& k) : x(k) { } Mistake(const X&) : x(1) { } void print() { cout << x << endl; } }; template <class T> Mistake<T> operator+(const Mistake<T>& a, const...
I don't think there is a way. The purest you can achieve is ``` Mistake<int> foo = static_cast<Mistake<int>>(a) + static_cast<Mistake<int>>(b); ``` Or if you push it a little using an additional overload that matches assymetric operand types: ``` template <class T, class U> Mistake<T> operator+(const Mistake<T>& a...
I believe the compiler has a problem with deducing the type of `a + b`. You can define: ``` X operator+(const X & a, const X & b) { return a /* ??? or something else */; } ``` if you have any way to tell what the answer to `a + b` is in terms of `X`.
Question: This if for the C++ gurus out there. Consider the following code: ``` class X { }; template <class T> class Mistake { public: T x; Mistake(const T& k) : x(k) { } Mistake(const X&) : x(1) { } void print() { cout << x << endl; } }; template <class T> Mistake<T> operator+(const Mistake<T>& a, const...
While others have proposed possible solutions to your problem, I would like to point out what is going on, and why your expectation cannot be met. The problem here is that **user-defined conversions are not considered when performing type deduction**. When the compiler is presented with this expression: ``` a + b ``...
I don't think there is a way. The purest you can achieve is ``` Mistake<int> foo = static_cast<Mistake<int>>(a) + static_cast<Mistake<int>>(b); ``` Or if you push it a little using an additional overload that matches assymetric operand types: ``` template <class T, class U> Mistake<T> operator+(const Mistake<T>& a...
Question: This if for the C++ gurus out there. Consider the following code: ``` class X { }; template <class T> class Mistake { public: T x; Mistake(const T& k) : x(k) { } Mistake(const X&) : x(1) { } void print() { cout << x << endl; } }; template <class T> Mistake<T> operator+(const Mistake<T>& a, const...
While others have proposed possible solutions to your problem, I would like to point out what is going on, and why your expectation cannot be met. The problem here is that **user-defined conversions are not considered when performing type deduction**. When the compiler is presented with this expression: ``` a + b ``...
I believe the compiler has a problem with deducing the type of `a + b`. You can define: ``` X operator+(const X & a, const X & b) { return a /* ??? or something else */; } ``` if you have any way to tell what the answer to `a + b` is in terms of `X`.
Question: I just released my first ever application into the world and asked for feedback. I was surprised by the feedback, because the users are asking for a lot of detail. They seem to want a user interface filled with buttons, knobs and sliders that lets them tweak every little thing to their desire. Everything I've...
This is the kind of feedback that is the easiest to elicit from users - details on color choice or extra features. I think the "intention" part is the important one. The problem the users are trying to solve using your application. So if you have any way of contacting the users who has given you feedback - or even jus...
Actually, it is perfectly normal to receive very little feedback. So it's good you're hearing from your users. Try to organize these requests, filter them, prioritize them. You don't want to do anything to jeapordize the usability of your application. Some requests you'll simply have to say no to, but there may be ot...
Question: I just released my first ever application into the world and asked for feedback. I was surprised by the feedback, because the users are asking for a lot of detail. They seem to want a user interface filled with buttons, knobs and sliders that lets them tweak every little thing to their desire. Everything I've...
Actually, it is perfectly normal to receive very little feedback. So it's good you're hearing from your users. Try to organize these requests, filter them, prioritize them. You don't want to do anything to jeapordize the usability of your application. Some requests you'll simply have to say no to, but there may be ot...
When users give feedback, they are saying that there is an issue. It's your task to discover what they 'need'. To discover that, you have to ask the 'why' question loads of times. Why do you want that button? Why is that important? Why are you trying to do this? After asking loads of questions, you'll need to test ne...
Question: I just released my first ever application into the world and asked for feedback. I was surprised by the feedback, because the users are asking for a lot of detail. They seem to want a user interface filled with buttons, knobs and sliders that lets them tweak every little thing to their desire. Everything I've...
This is the kind of feedback that is the easiest to elicit from users - details on color choice or extra features. I think the "intention" part is the important one. The problem the users are trying to solve using your application. So if you have any way of contacting the users who has given you feedback - or even jus...
When users give feedback, they are saying that there is an issue. It's your task to discover what they 'need'. To discover that, you have to ask the 'why' question loads of times. Why do you want that button? Why is that important? Why are you trying to do this? After asking loads of questions, you'll need to test ne...
Question: I just released my first ever application into the world and asked for feedback. I was surprised by the feedback, because the users are asking for a lot of detail. They seem to want a user interface filled with buttons, knobs and sliders that lets them tweak every little thing to their desire. Everything I've...
This is the kind of feedback that is the easiest to elicit from users - details on color choice or extra features. I think the "intention" part is the important one. The problem the users are trying to solve using your application. So if you have any way of contacting the users who has given you feedback - or even jus...
Bear in mind that the people who feedback are a self selecting group who want changes. There may well be another, larger, group who are perfectly happy with your original interface, and may become unhappy if you start adding lots of extra controls. The only way you'll know whether this is the case is by organising so...
Question: I just released my first ever application into the world and asked for feedback. I was surprised by the feedback, because the users are asking for a lot of detail. They seem to want a user interface filled with buttons, knobs and sliders that lets them tweak every little thing to their desire. Everything I've...
Bear in mind that the people who feedback are a self selecting group who want changes. There may well be another, larger, group who are perfectly happy with your original interface, and may become unhappy if you start adding lots of extra controls. The only way you'll know whether this is the case is by organising so...
When users give feedback, they are saying that there is an issue. It's your task to discover what they 'need'. To discover that, you have to ask the 'why' question loads of times. Why do you want that button? Why is that important? Why are you trying to do this? After asking loads of questions, you'll need to test ne...
Question: Recently on [Reddit ReverseEngineering](http://www.reddit.com/r/ReverseEngineering) I stumbled on a [self-modifying code in Python](http://www.reddit.com/r/ReverseEngineering/comments/1da222/selfmodifying_python_bytecode/). Looking at the [Github](https://github.com/0vercl0k/stuffz/tree/master/Python%27s%20in...
There are several tools dedicated to Python's bytecode reversing: * [Uncompyle](https://github.com/gstarnberger/uncompyle) and [Uncompyle2](https://github.com/fry/uncompyle2) > > 'uncompyle' converts Python byte-code back into equivalent Python > source. It accepts byte-code from Python version 2.7 only. The genera...
[Maynard](https://bitbucket.org/larry/maynard) is a (dis)assembler for Python byte code written by a member of Python core and the release manager for Python 3.4. Reading material [here](https://lwn.net/Articles/544787/) and [here](https://www.youtube.com/watch?v=CKu6d_v4Pqo). I'm not aware of a public tool (besides th...
Question: Recently on [Reddit ReverseEngineering](http://www.reddit.com/r/ReverseEngineering) I stumbled on a [self-modifying code in Python](http://www.reddit.com/r/ReverseEngineering/comments/1da222/selfmodifying_python_bytecode/). Looking at the [Github](https://github.com/0vercl0k/stuffz/tree/master/Python%27s%20in...
[Maynard](https://bitbucket.org/larry/maynard) is a (dis)assembler for Python byte code written by a member of Python core and the release manager for Python 3.4. Reading material [here](https://lwn.net/Articles/544787/) and [here](https://www.youtube.com/watch?v=CKu6d_v4Pqo). I'm not aware of a public tool (besides th...
The [Flare-bytecode graph](https://github.com/fireeye/flare-bytecode_graph) project can help with graphical bytecode CFG representation. Taken from the project `README`: > > ... > > It is also possible to create control flow diagrams using GraphViz. The disassembly within the graph can include the output from a s...
Question: Recently on [Reddit ReverseEngineering](http://www.reddit.com/r/ReverseEngineering) I stumbled on a [self-modifying code in Python](http://www.reddit.com/r/ReverseEngineering/comments/1da222/selfmodifying_python_bytecode/). Looking at the [Github](https://github.com/0vercl0k/stuffz/tree/master/Python%27s%20in...
There are several tools dedicated to Python's bytecode reversing: * [Uncompyle](https://github.com/gstarnberger/uncompyle) and [Uncompyle2](https://github.com/fry/uncompyle2) > > 'uncompyle' converts Python byte-code back into equivalent Python > source. It accepts byte-code from Python version 2.7 only. The genera...
[pyREtic](http://www.immunitysec.com/resources-freesoftware.shtml) from [Immunity Sec](http://www.immunitysec.com/) can also provide some help in looking into original source code and perform modifications as well. You may be interested in review the capabilities of the tool in this document: **"[pyREtic, In memory r...
Question: Recently on [Reddit ReverseEngineering](http://www.reddit.com/r/ReverseEngineering) I stumbled on a [self-modifying code in Python](http://www.reddit.com/r/ReverseEngineering/comments/1da222/selfmodifying_python_bytecode/). Looking at the [Github](https://github.com/0vercl0k/stuffz/tree/master/Python%27s%20in...
[pyREtic](http://www.immunitysec.com/resources-freesoftware.shtml) from [Immunity Sec](http://www.immunitysec.com/) can also provide some help in looking into original source code and perform modifications as well. You may be interested in review the capabilities of the tool in this document: **"[pyREtic, In memory r...
The [Flare-bytecode graph](https://github.com/fireeye/flare-bytecode_graph) project can help with graphical bytecode CFG representation. Taken from the project `README`: > > ... > > It is also possible to create control flow diagrams using GraphViz. The disassembly within the graph can include the output from a s...
Question: Recently on [Reddit ReverseEngineering](http://www.reddit.com/r/ReverseEngineering) I stumbled on a [self-modifying code in Python](http://www.reddit.com/r/ReverseEngineering/comments/1da222/selfmodifying_python_bytecode/). Looking at the [Github](https://github.com/0vercl0k/stuffz/tree/master/Python%27s%20in...
There are several tools dedicated to Python's bytecode reversing: * [Uncompyle](https://github.com/gstarnberger/uncompyle) and [Uncompyle2](https://github.com/fry/uncompyle2) > > 'uncompyle' converts Python byte-code back into equivalent Python > source. It accepts byte-code from Python version 2.7 only. The genera...
The [Flare-bytecode graph](https://github.com/fireeye/flare-bytecode_graph) project can help with graphical bytecode CFG representation. Taken from the project `README`: > > ... > > It is also possible to create control flow diagrams using GraphViz. The disassembly within the graph can include the output from a s...
Question: If necessary, a factory can access elements of the infrastructure to build an object?. In a particular case, I have an object that I need to add email signature that is stored as a parameter in the configuration layer of the application. Answer:
In DDD, a Factory is at the same architectural level as a Repository, but for creating new objects instead of loading existing objects. So it can call infrastructure services just like the repository.
There is no one correct answer to this problem. If the factory itself is part of your application layer this should be fine. You can also add an application service that hands the email signature down into your domain when needed.
Question: Suppose i have my mailbox configured and i have a special folder for mails with attachments in outlook 2007. What i want to do is i. either configure outlook to save the attachment of mails coming in a specified folder (Mails with Attachments) to specific folder in my computer drive in a desired folder ii. ...
``` double milliseconds = 1000.0 * [[NSDate date] timeIntervalSince1970]; ```
``` CGFloat milliseconds = [NSDate timeIntervalSinceReferenceDate]*1000.0; ```
Question: What is the best way to backup a SQL Server 2005 database nightly? I'm looking for a solution/strategy that would make the database backup file, and place it in an "outgoing" directory. We're wanting our FTP software to move it out to an offsite server. Any suggestions on how to make this work as desired? ...
You can do this free. Create a maintenance plan to back up the DB, you can define the location you want to send the file, and add a clean up task. If it's express and you can't use maint plans, use this tool to run the backup job automatically: <http://www.codeplex.com/ExpressMaint> and use a simple VB script to clea...
Backup Exec System Recovery will do the backup and FTP it offsite on any schedule
Question: What is the best way to backup a SQL Server 2005 database nightly? I'm looking for a solution/strategy that would make the database backup file, and place it in an "outgoing" directory. We're wanting our FTP software to move it out to an offsite server. Any suggestions on how to make this work as desired? ...
An easy script (albiet using an undocumented procedure) is below. This will put it in the default backup directory, but if your service account has rights to other directories you can add that in front of the last question mark. The "init" will over write the last database backup so it doesn't fill up the drive. ``` s...
Backup Exec System Recovery will do the backup and FTP it offsite on any schedule
Question: What is the best way to backup a SQL Server 2005 database nightly? I'm looking for a solution/strategy that would make the database backup file, and place it in an "outgoing" directory. We're wanting our FTP software to move it out to an offsite server. Any suggestions on how to make this work as desired? ...
You can do this free. Create a maintenance plan to back up the DB, you can define the location you want to send the file, and add a clean up task. If it's express and you can't use maint plans, use this tool to run the backup job automatically: <http://www.codeplex.com/ExpressMaint> and use a simple VB script to clea...
An easy script (albiet using an undocumented procedure) is below. This will put it in the default backup directory, but if your service account has rights to other directories you can add that in front of the last question mark. The "init" will over write the last database backup so it doesn't fill up the drive. ``` s...
Question: What is the best way to backup a SQL Server 2005 database nightly? I'm looking for a solution/strategy that would make the database backup file, and place it in an "outgoing" directory. We're wanting our FTP software to move it out to an offsite server. Any suggestions on how to make this work as desired? ...
You can do this free. Create a maintenance plan to back up the DB, you can define the location you want to send the file, and add a clean up task. If it's express and you can't use maint plans, use this tool to run the backup job automatically: <http://www.codeplex.com/ExpressMaint> and use a simple VB script to clea...
Logshipping does this well too.
Question: What is the best way to backup a SQL Server 2005 database nightly? I'm looking for a solution/strategy that would make the database backup file, and place it in an "outgoing" directory. We're wanting our FTP software to move it out to an offsite server. Any suggestions on how to make this work as desired? ...
An easy script (albiet using an undocumented procedure) is below. This will put it in the default backup directory, but if your service account has rights to other directories you can add that in front of the last question mark. The "init" will over write the last database backup so it doesn't fill up the drive. ``` s...
Logshipping does this well too.
Question: I have a problem when trying removing a file with name something like `-h_some_file_name`, this is because of generated script that I made and forget to check the prefix. If I run the command `rm '-h_some_file_name'` it return an error `rm: invalid option -- 'h'`. If I try to change the name and then remove...
Just: ``` rm -- -h_some_file_name ``` Or: ``` rm ./-h_some_file_name ``` See the manpage of `rm`: ``` To remove a file whose name starts with a `-', for example `-foo', use one of these commands: rm -- -foo rm ./-foo ``` The `--` argument tells `rm` that all following argument shoul...
You can use wildcards. Here in this case you can use '\*' wildcard. Go to the directory where files of this type is to be deleted or you need to mention the complete path in the command. After setting to the terminal prompt to your directory, type in the following ``` rm ./-h* ``` For little bit more information y...
Question: After upgrading to 18.04 every time I start Ubuntu and the fire up Firefox I get a "Sorry. We’re having trouble getting your pages back." How to I fix this? Answer:
This should clear it ``` # sudo systemd-resolve --flush-cache ``` You can check with ``` # sudo systemd-resolve --statistics ``` * it should show 0 in Current cache size ``` DNSSEC supported by current servers: no Transactions Current Transactions: 0 Total Transactions: 93750 Cache Current Cache Size: 0 Ca...
Maybe this version also has two (2) DNS caches, like Ubuntu 20.10. Please check the full tutorial to flush DNS caches: <https://askubuntu.com/a/1315569/136919>
Question: My SQL Server table has a column defined as: ``` TicketNo varchar(5) ``` The rows in this table are inserted by some bulk load files from different sources. Now, depending on who prepared the bulk load input files, sometimes `TicketNo` has leading 0s, sometimes not. How can I enforce INSERTS to the tabl...
You can use a char(5) column with a check constraint. ``` create table YourTable ( TicketNo char(5) check (patindex('%[^0-9]%', TicketNo) = 0) ) ``` Update: Using [this answer](https://dba.stackexchange.com/a/34731/2103) by [Martin Smith](https://stackoverflow.com/users/73226/martin-smith) it could look like this...
How you enforce it is a tricky question. My first through would be to create a stored procedure and force all inserts to take place through that. Then you could use rs's solutions. Other than that you can create an insert/update trigger that checks for leading zeros.
Question: I have a program in c. Input of this program is the address of a file. This program gets the complete address of input file like d:\bin\files\examples\data\file.txt. How can I correct the program that gets input in form of data\file.txt ? and the d:\bin\files\examples\ add itself. Answer:
Ok, here is a little class that can parse your xml: ``` public class Parser { public List<Dictionary<string, object>> Parse(XElement root) { var result = new List<Dictionary<string, object>>(); foreach (var e in root.Elements()) { if (e.Name == "dict") { ...
I used Hakan's Parser class almost straight out of the box: I needed an integer element but no true or false - simple edits. This snippet might help people test their code. I have renamed some of Hakan's symbols to fit my project. ``` private void Button_Click_1(object sender, RoutedEventArgs e) { List<Dic...
Question: The set of complex numbers can be defined using the reals: $$\mathbb{C}=\{a+bi\,|\,a,b\in\mathbb{R}\}.$$ Could I do the opposite and define the reals using the complex numbers? $$\mathbb{R}=\{z\,|\,z\in\mathbb{C},\,\operatorname{Im}(z)=0\}.$$ Answer:
Yes, you could, in principle. The reason we usually go the other way is because we already know what the reals are (namely "Cauchy sequences of rationals", or "Dedekind cuts"), so going $\mathbb{R}$ to $\mathbb{C}$ allows us to build a more complicated object from something we already know about. There's no reason to g...
You could, see the caveat by Patrick, though. Another way would be to say $$\Bbb R=\{z \in \Bbb C: \bar{z}=z\}$$ or $$\Bbb R=\{z \in \Bbb C: |z|=z \lor |z|=-z \}$$ and a few others.
Question: The set of complex numbers can be defined using the reals: $$\mathbb{C}=\{a+bi\,|\,a,b\in\mathbb{R}\}.$$ Could I do the opposite and define the reals using the complex numbers? $$\mathbb{R}=\{z\,|\,z\in\mathbb{C},\,\operatorname{Im}(z)=0\}.$$ Answer:
Yes, you could, in principle. The reason we usually go the other way is because we already know what the reals are (namely "Cauchy sequences of rationals", or "Dedekind cuts"), so going $\mathbb{R}$ to $\mathbb{C}$ allows us to build a more complicated object from something we already know about. There's no reason to g...
Yes, you can represent the real numbers like this. If you are pedantic, you may want to distinguish between the real number $x$ and the complex number $x + 0i$. If this is a concern, you can write $$ \mathbb{R} = \bigl\{ \mathrm{Re}(z) \bigm| z \in \mathbb{C} \bigr\}. $$
Question: If I have an entity such as the following: ``` @Entity public class Customer { private Address address; } ``` And the Address is also an entity: ``` @Entity public class Address {...} ``` Does persisting the Customer in turn persist its contained Address? Or is this not possible at all? The idea was...
**Graft** uses Mercurial internal merging, while **transplant** relies on patch mechanism. Therefore **graft** should be able to handle three-way-merges better than **transplant** currently does.
From the documentation of hg graft it looks like opposite to the transplant extension graft only handles branches within the same repository but can't handle different repositories.
Question: I want to create a text area on the mouse hover in given link. What I've tried is there in this [fiddle code.](http://jsfiddle.net/viralshah/nmZb9/5/) But I want to create text area dynamically when mouse over on the link. This text area will set on the **right side** (when click on the link) and also de...
TL:DR ----- For OAuth 2 tokens if you login... * At `login.salesforce.com` use <https://login.salesforce.com/services/oauth2/token> * At `test.salesforce.com` use <https://test.salesforce.com/services/oauth2/token> Story: ------ 1. I was following [Salesforce "Set Up OAuth 2.0"](https://developer.salesforce.com/doc...
Make sure your password *only* has alphanumeric characters in it.
Question: I want to create a text area on the mouse hover in given link. What I've tried is there in this [fiddle code.](http://jsfiddle.net/viralshah/nmZb9/5/) But I want to create text area dynamically when mouse over on the link. This text area will set on the **right side** (when click on the link) and also de...
We had this issue as well. Check your `Connected App` settings - under `Selected OAuth Scopes`, you may need to adjust the selected permissions. Our app primarily uses *Chatter*, so we had to add both: * Access and manage your Chatter feed (`chatter_api`) * Perform requests on your behalf at any time (`refresh_token`...
I had this problem and after trying several failed tutorials I came across a post that said Salesforce won't accept a password with special characters in it (!, @ ,#). I changed my password in Salesforce to one without special characters and finally got it to work.
Question: I want to create a text area on the mouse hover in given link. What I've tried is there in this [fiddle code.](http://jsfiddle.net/viralshah/nmZb9/5/) But I want to create text area dynamically when mouse over on the link. This text area will set on the **right side** (when click on the link) and also de...
To whitelist an IP address range follow these steps: 1. Click `Setup` in the top-right 2. Select `Administer` > `Security Controls` > `Network Access` from the left navigation 3. Click `New` 4. Add your ip address range 5. Click `Save`
I tried many solutions above which did not work for me. However the trick that actually worked for me was to stop using curl and to use [postman](https://www.getpostman.com/) application to make the request instead. By replicating the request in postman, with a POST request and the following params 1. grant\_type 2. ...
Question: I want to create a text area on the mouse hover in given link. What I've tried is there in this [fiddle code.](http://jsfiddle.net/viralshah/nmZb9/5/) But I want to create text area dynamically when mouse over on the link. This text area will set on the **right side** (when click on the link) and also de...
To whitelist an IP address range follow these steps: 1. Click `Setup` in the top-right 2. Select `Administer` > `Security Controls` > `Network Access` from the left navigation 3. Click `New` 4. Add your ip address range 5. Click `Save`
I was banging my head against the desk trying to get this to work. Turns out my issue was copying and pasting, which messed up the " character. I went and manually typed " pasted that into the command line and then it worked.
Question: I want to create a text area on the mouse hover in given link. What I've tried is there in this [fiddle code.](http://jsfiddle.net/viralshah/nmZb9/5/) But I want to create text area dynamically when mouse over on the link. This text area will set on the **right side** (when click on the link) and also de...
To whitelist an IP address range follow these steps: 1. Click `Setup` in the top-right 2. Select `Administer` > `Security Controls` > `Network Access` from the left navigation 3. Click `New` 4. Add your ip address range 5. Click `Save`
Make sure your password *only* has alphanumeric characters in it.
Question: I want to create a text area on the mouse hover in given link. What I've tried is there in this [fiddle code.](http://jsfiddle.net/viralshah/nmZb9/5/) But I want to create text area dynamically when mouse over on the link. This text area will set on the **right side** (when click on the link) and also de...
TL:DR ----- For OAuth 2 tokens if you login... * At `login.salesforce.com` use <https://login.salesforce.com/services/oauth2/token> * At `test.salesforce.com` use <https://test.salesforce.com/services/oauth2/token> Story: ------ 1. I was following [Salesforce "Set Up OAuth 2.0"](https://developer.salesforce.com/doc...
I was banging my head against the desk trying to get this to work. Turns out my issue was copying and pasting, which messed up the " character. I went and manually typed " pasted that into the command line and then it worked.
Question: I want to create a text area on the mouse hover in given link. What I've tried is there in this [fiddle code.](http://jsfiddle.net/viralshah/nmZb9/5/) But I want to create text area dynamically when mouse over on the link. This text area will set on the **right side** (when click on the link) and also de...
We had this issue as well. Check your `Connected App` settings - under `Selected OAuth Scopes`, you may need to adjust the selected permissions. Our app primarily uses *Chatter*, so we had to add both: * Access and manage your Chatter feed (`chatter_api`) * Perform requests on your behalf at any time (`refresh_token`...
You can call your APEX controller using [Postman](https://www.getpostman.com) if you enter the Consumer Key and Consumer Secret in the Access Token settings - you don't need the Security Token for this. Set up the Authorization like this screenshot... [Postman OAuth 2.0](https://i.stack.imgur.com/uf2EZ.png) And ente...
Question: I want to create a text area on the mouse hover in given link. What I've tried is there in this [fiddle code.](http://jsfiddle.net/viralshah/nmZb9/5/) But I want to create text area dynamically when mouse over on the link. This text area will set on the **right side** (when click on the link) and also de...
To whitelist an IP address range follow these steps: 1. Click `Setup` in the top-right 2. Select `Administer` > `Security Controls` > `Network Access` from the left navigation 3. Click `New` 4. Add your ip address range 5. Click `Save`
You can call your APEX controller using [Postman](https://www.getpostman.com) if you enter the Consumer Key and Consumer Secret in the Access Token settings - you don't need the Security Token for this. Set up the Authorization like this screenshot... [Postman OAuth 2.0](https://i.stack.imgur.com/uf2EZ.png) And ente...
Question: This is a comprehension cloze question for 11 year olds: > > His only hope for cure was a bone marrow transplant. His brother was chosen to donate some of his bone marrow. The \_\_\_\_\_\_\_\_ would take place in the States. > > > Was told that 'transplant' and 'procedure' can be accepted but 'operation...
The relevant definition of *operation* in *Merriam-Webster's Eleventh Collegiate Dictionary* (2003) doesn't mention cutting as a prerequisite: > > **operation** *n* ... **4 :** a procedure performed on a living body usu. with instruments esp. for the repair of damage or the restoration of health > > > Under the *...
An operation is generally understood to be a procedure that is performed by a surgeon. And a surgeon is the person who generally does the cutting, as you put it. So with that in mind, I would agree with the person who gave you the advice.
Question: This is a comprehension cloze question for 11 year olds: > > His only hope for cure was a bone marrow transplant. His brother was chosen to donate some of his bone marrow. The \_\_\_\_\_\_\_\_ would take place in the States. > > > Was told that 'transplant' and 'procedure' can be accepted but 'operation...
As answered by @SvenYargs, "operation" is fine. However, you may say: > > "The **transplantation** would take place in the States". > > > Comparing the 2 nouns "transplant" and "transplantation", my feeling is that the noun "transplant" better fits to the therapeutic method and that "transplatation" relates more...
An operation is generally understood to be a procedure that is performed by a surgeon. And a surgeon is the person who generally does the cutting, as you put it. So with that in mind, I would agree with the person who gave you the advice.
Question: This is a comprehension cloze question for 11 year olds: > > His only hope for cure was a bone marrow transplant. His brother was chosen to donate some of his bone marrow. The \_\_\_\_\_\_\_\_ would take place in the States. > > > Was told that 'transplant' and 'procedure' can be accepted but 'operation...
Eh, kinda. ---------- If these were all given as multiple choice answers, > > A. Transplant B. Procedure C. Operation D. [Sth Obviously Wrong] > > > then—having just looked up [what actually occurs during a bone marrow transplant](https://www.hopkinsmedicine.org/health/treatment-tests-and-therapies/bone-marrow-t...
An operation is generally understood to be a procedure that is performed by a surgeon. And a surgeon is the person who generally does the cutting, as you put it. So with that in mind, I would agree with the person who gave you the advice.
Question: This is a comprehension cloze question for 11 year olds: > > His only hope for cure was a bone marrow transplant. His brother was chosen to donate some of his bone marrow. The \_\_\_\_\_\_\_\_ would take place in the States. > > > Was told that 'transplant' and 'procedure' can be accepted but 'operation...
The relevant definition of *operation* in *Merriam-Webster's Eleventh Collegiate Dictionary* (2003) doesn't mention cutting as a prerequisite: > > **operation** *n* ... **4 :** a procedure performed on a living body usu. with instruments esp. for the repair of damage or the restoration of health > > > Under the *...
As answered by @SvenYargs, "operation" is fine. However, you may say: > > "The **transplantation** would take place in the States". > > > Comparing the 2 nouns "transplant" and "transplantation", my feeling is that the noun "transplant" better fits to the therapeutic method and that "transplatation" relates more...
Question: This is a comprehension cloze question for 11 year olds: > > His only hope for cure was a bone marrow transplant. His brother was chosen to donate some of his bone marrow. The \_\_\_\_\_\_\_\_ would take place in the States. > > > Was told that 'transplant' and 'procedure' can be accepted but 'operation...
The relevant definition of *operation* in *Merriam-Webster's Eleventh Collegiate Dictionary* (2003) doesn't mention cutting as a prerequisite: > > **operation** *n* ... **4 :** a procedure performed on a living body usu. with instruments esp. for the repair of damage or the restoration of health > > > Under the *...
Eh, kinda. ---------- If these were all given as multiple choice answers, > > A. Transplant B. Procedure C. Operation D. [Sth Obviously Wrong] > > > then—having just looked up [what actually occurs during a bone marrow transplant](https://www.hopkinsmedicine.org/health/treatment-tests-and-therapies/bone-marrow-t...
Question: This is a comprehension cloze question for 11 year olds: > > His only hope for cure was a bone marrow transplant. His brother was chosen to donate some of his bone marrow. The \_\_\_\_\_\_\_\_ would take place in the States. > > > Was told that 'transplant' and 'procedure' can be accepted but 'operation...
Eh, kinda. ---------- If these were all given as multiple choice answers, > > A. Transplant B. Procedure C. Operation D. [Sth Obviously Wrong] > > > then—having just looked up [what actually occurs during a bone marrow transplant](https://www.hopkinsmedicine.org/health/treatment-tests-and-therapies/bone-marrow-t...
As answered by @SvenYargs, "operation" is fine. However, you may say: > > "The **transplantation** would take place in the States". > > > Comparing the 2 nouns "transplant" and "transplantation", my feeling is that the noun "transplant" better fits to the therapeutic method and that "transplatation" relates more...
Question: I have a digital elevation model and a shapefile containing point features for the location of wind turbines. These two layers appear to be aligned in QGIS but when I open them in openWind, they are not aligned. I am guessing this has something to do with CRS but I am unsure how to align these layers? Answe...
You may need to include a [Collect Values](http://resources.arcgis.com/en/help/main/10.2/index.html#//004000000005000000) tool between the Iterate output and the next processing step (CreateFeaturesFromText). [Example from ArcMap's Help Page](http://resources.arcgis.com/en/help/main/10.2/index.html#/Examples_of_using_...
It appears as though I had to use the Iterate Tables rather than Iterate Files, and then it worked just fine.
Question: I have a `Vote` domain class from my grails application containing properties like `article_id` and `note` I want to HQL query the `Vote` domain class in order to retrieve the 5 best rated articles having at least 10 votes. I tried : ``` SELECT v.article_id, avg(v.note), count(*) FROM vote v where count(*)...
From the comments, you say that you are inserting these into a map like so: ``` modelMap[id] = Model(id, model, SOLDIER); ``` `std::map::operator[]` requires that the mapped type be default constructible. When you call `operator[]` on a map, if there is no mapped value with the given key, the map default constructs ...
You do: ``` Model soldier(id, model, SOLDIER); //1 modelMap[id] = soldier; //2 ``` What happens here? 1. New object is created, using consructor you have provided. 2. The ~~so-called copy-constructor~~ copy assignment operator is called to copy `soldier` to `modelMap[id]`. You haven't defined your ...
Question: I have a `Vote` domain class from my grails application containing properties like `article_id` and `note` I want to HQL query the `Vote` domain class in order to retrieve the 5 best rated articles having at least 10 votes. I tried : ``` SELECT v.article_id, avg(v.note), count(*) FROM vote v where count(*)...
This lines: ``` modelMap[id] = soldier; ``` First default constructs the Model inside the map. The returned reference is then used with the assignment operator to copy the value of soldier into the value contained inside the map. To test if it is working try: ``` Model soldier(id, model, SOLDIER); std::cout << ...
From the comments, you say that you are inserting these into a map like so: ``` modelMap[id] = Model(id, model, SOLDIER); ``` `std::map::operator[]` requires that the mapped type be default constructible. When you call `operator[]` on a map, if there is no mapped value with the given key, the map default constructs ...
Question: I have a `Vote` domain class from my grails application containing properties like `article_id` and `note` I want to HQL query the `Vote` domain class in order to retrieve the 5 best rated articles having at least 10 votes. I tried : ``` SELECT v.article_id, avg(v.note), count(*) FROM vote v where count(*)...
This lines: ``` modelMap[id] = soldier; ``` First default constructs the Model inside the map. The returned reference is then used with the assignment operator to copy the value of soldier into the value contained inside the map. To test if it is working try: ``` Model soldier(id, model, SOLDIER); std::cout << ...
You do: ``` Model soldier(id, model, SOLDIER); //1 modelMap[id] = soldier; //2 ``` What happens here? 1. New object is created, using consructor you have provided. 2. The ~~so-called copy-constructor~~ copy assignment operator is called to copy `soldier` to `modelMap[id]`. You haven't defined your ...
Question: i have list of element when i click in one of them, i fill the template then i copy it to the new DIV, i got an empty template, when i use `$scope.$apply()` i got an error. ``` $scope.tache_list.forEach(element => { $scope.var1 = element; $scope.$apply(); $('#div2').append($("#div1").html()); }); ...
Wrap your $scope.$apply call inside a $timeout function. ``` $timeout(function(){ $scope.$apply() }); ``` Reason: Digest cycle will be moved to event loop and execute when the existing cycle completes.
Please take a look at the following [article](http://jimhoskins.com/2012/12/17/angularjs-and-apply.html) about $digest and $apply Your `inprogress` error is because you call `$apply()` from inside an `$apply block`. You only want to call the $apply from `outside` angular code that starts a new turn. So if you have a `...
Question: i have list of element when i click in one of them, i fill the template then i copy it to the new DIV, i got an empty template, when i use `$scope.$apply()` i got an error. ``` $scope.tache_list.forEach(element => { $scope.var1 = element; $scope.$apply(); $('#div2').append($("#div1").html()); }); ...
Please take a look at the following [article](http://jimhoskins.com/2012/12/17/angularjs-and-apply.html) about $digest and $apply Your `inprogress` error is because you call `$apply()` from inside an `$apply block`. You only want to call the $apply from `outside` angular code that starts a new turn. So if you have a `...
i resovle this probleme by ``` $timeout(function(){ $scope.$apply() }) .then(function(){ ... }); ``` thanks for all.
Question: i have list of element when i click in one of them, i fill the template then i copy it to the new DIV, i got an empty template, when i use `$scope.$apply()` i got an error. ``` $scope.tache_list.forEach(element => { $scope.var1 = element; $scope.$apply(); $('#div2').append($("#div1").html()); }); ...
Wrap your $scope.$apply call inside a $timeout function. ``` $timeout(function(){ $scope.$apply() }); ``` Reason: Digest cycle will be moved to event loop and execute when the existing cycle completes.
i resovle this probleme by ``` $timeout(function(){ $scope.$apply() }) .then(function(){ ... }); ``` thanks for all.
Question: Are there efficient practices for leveraging an HTML IDE with Python (No Framework) instead of the typical outputting of hand coded HTML in python programs that you can't use HTML IDE's with? I loved the way PHP, JSP, Classic ASP, and .net allow you to include server side code in HTML with the <% tags. I kno...
Django (<https://www.djangoproject.com/>) and Flask (<http://flask.pocoo.org/>) both let you use template languages which let you manipulate and customize HTML pages. However, these processes differ from PHP-style systems in that the code in the HTML page is only related to how you view the data in the page. The bulk o...
Have a look at [Mako](http://www.makotemplates.org) template library. It is very easy to use, and yet powerful ([usage documentation](http://docs.makotemplates.org/en/latest/usage.html)). Also, I believe that other popular template libraries can be used outside of a framework as well.
Question: I have a dll called Test.dll in which I have a class called ABC which has a method FindTYpe. Now, I have a project called TestB and I have added the reference of Test.dll in TestB. Now, if I am trying to find a type XYZ in TestB, from `Test.ABC.FindTYpe()`, it's throwing an exception, `TypeNotLaoded Exception...
You'll need to post your code for FindType(). My guess is that you're doing something like; ``` System.Reflection.Assembly.GetExecutingAssembly().GetTypes() ``` to find a list of types to search through, and the type in TestB.dll isn't in Test.dll, so the item isn't found. You might want to try something like this...
Mos probably the type **XYZ** that you are trying to find is not loaded or not present in the paths your app looks for assemblies. The Test.dll and ABC should be present it you added the reference in your project to Test.dll.
Question: I have a dll called Test.dll in which I have a class called ABC which has a method FindTYpe. Now, I have a project called TestB and I have added the reference of Test.dll in TestB. Now, if I am trying to find a type XYZ in TestB, from `Test.ABC.FindTYpe()`, it's throwing an exception, `TypeNotLaoded Exception...
You'll need to post your code for FindType(). My guess is that you're doing something like; ``` System.Reflection.Assembly.GetExecutingAssembly().GetTypes() ``` to find a list of types to search through, and the type in TestB.dll isn't in Test.dll, so the item isn't found. You might want to try something like this...
What does the code look like in FindType? Assuming you are creating the type from the type name (a string), then you must be sure to supply the "assembly qualified" type name, not just the "local" type name. e.g. to retrieve the type you are about to create: ``` Type testB = Type.GetType("TestB.XYZ, TestB"); ``` ra...
Question: I am currently using Heroku's Memcached in a Rails 3 app and would like to move over to Elasticache because the pricing is much more favorable. Is this possible? Is the configuration relatively straightforward? Is there anything that I should be aware of as regards the performance? Answer:
**DANGER: I do NOT recommend using this solution for production use. While this does work, @btucker pointed out that it allows *any* Heroku-hosted app to access your ElastiCache cluster.** Yes you can. The setup is similar to the guide Heroku has on [Amazon RDS](https://devcenter.heroku.com/articles/amazon_rds). The s...
No, it isn't recommended you use Elasticache as there is no authentication mechanism with it. As such, **anyone** can access your cache! This is normally fine as you would use AWS security rules to restrict what machines can access it to yours. However, this obviously doesn't work with Heroku since your app is run on a...
Question: I am currently using Heroku's Memcached in a Rails 3 app and would like to move over to Elasticache because the pricing is much more favorable. Is this possible? Is the configuration relatively straightforward? Is there anything that I should be aware of as regards the performance? Answer:
No, it isn't recommended you use Elasticache as there is no authentication mechanism with it. As such, **anyone** can access your cache! This is normally fine as you would use AWS security rules to restrict what machines can access it to yours. However, this obviously doesn't work with Heroku since your app is run on a...
It's worth noting that while @ssorallen's answer above will work as described, it also allows *ANY* heroku-deployed app to access your memcached server. So if you store anything at all confidential, or you're concerned about other people making use of your ElatiCache cluster, don't do it. In the context of RDS you have...
Question: I am currently using Heroku's Memcached in a Rails 3 app and would like to move over to Elasticache because the pricing is much more favorable. Is this possible? Is the configuration relatively straightforward? Is there anything that I should be aware of as regards the performance? Answer:
No, it isn't recommended you use Elasticache as there is no authentication mechanism with it. As such, **anyone** can access your cache! This is normally fine as you would use AWS security rules to restrict what machines can access it to yours. However, this obviously doesn't work with Heroku since your app is run on a...
There are several Heroku addons that will kinda solve this problem. They provide a SOCKS5 proxy with a static IP address that you can whitelist. * <https://elements.heroku.com/addons/proximo> * <https://elements.heroku.com/addons/quotaguardstatic> * <https://elements.heroku.com/addons/fixie-socks> You can also do thi...
Question: I am currently using Heroku's Memcached in a Rails 3 app and would like to move over to Elasticache because the pricing is much more favorable. Is this possible? Is the configuration relatively straightforward? Is there anything that I should be aware of as regards the performance? Answer:
No, it isn't recommended you use Elasticache as there is no authentication mechanism with it. As such, **anyone** can access your cache! This is normally fine as you would use AWS security rules to restrict what machines can access it to yours. However, this obviously doesn't work with Heroku since your app is run on a...
If you are using Heroku Private spaces, then it should be possible to do using VPC peering. Follow the instructions here so that your AWS VPC and Heroku VPC can access each other's resources: <https://devcenter.heroku.com/articles/private-space-peering> Once you have the above setup working, just create an elastic cac...
Question: I am currently using Heroku's Memcached in a Rails 3 app and would like to move over to Elasticache because the pricing is much more favorable. Is this possible? Is the configuration relatively straightforward? Is there anything that I should be aware of as regards the performance? Answer:
**DANGER: I do NOT recommend using this solution for production use. While this does work, @btucker pointed out that it allows *any* Heroku-hosted app to access your ElastiCache cluster.** Yes you can. The setup is similar to the guide Heroku has on [Amazon RDS](https://devcenter.heroku.com/articles/amazon_rds). The s...
It's worth noting that while @ssorallen's answer above will work as described, it also allows *ANY* heroku-deployed app to access your memcached server. So if you store anything at all confidential, or you're concerned about other people making use of your ElatiCache cluster, don't do it. In the context of RDS you have...
Question: I am currently using Heroku's Memcached in a Rails 3 app and would like to move over to Elasticache because the pricing is much more favorable. Is this possible? Is the configuration relatively straightforward? Is there anything that I should be aware of as regards the performance? Answer:
**DANGER: I do NOT recommend using this solution for production use. While this does work, @btucker pointed out that it allows *any* Heroku-hosted app to access your ElastiCache cluster.** Yes you can. The setup is similar to the guide Heroku has on [Amazon RDS](https://devcenter.heroku.com/articles/amazon_rds). The s...
There are several Heroku addons that will kinda solve this problem. They provide a SOCKS5 proxy with a static IP address that you can whitelist. * <https://elements.heroku.com/addons/proximo> * <https://elements.heroku.com/addons/quotaguardstatic> * <https://elements.heroku.com/addons/fixie-socks> You can also do thi...
Question: I am currently using Heroku's Memcached in a Rails 3 app and would like to move over to Elasticache because the pricing is much more favorable. Is this possible? Is the configuration relatively straightforward? Is there anything that I should be aware of as regards the performance? Answer:
**DANGER: I do NOT recommend using this solution for production use. While this does work, @btucker pointed out that it allows *any* Heroku-hosted app to access your ElastiCache cluster.** Yes you can. The setup is similar to the guide Heroku has on [Amazon RDS](https://devcenter.heroku.com/articles/amazon_rds). The s...
If you are using Heroku Private spaces, then it should be possible to do using VPC peering. Follow the instructions here so that your AWS VPC and Heroku VPC can access each other's resources: <https://devcenter.heroku.com/articles/private-space-peering> Once you have the above setup working, just create an elastic cac...
Question: I am currently using Heroku's Memcached in a Rails 3 app and would like to move over to Elasticache because the pricing is much more favorable. Is this possible? Is the configuration relatively straightforward? Is there anything that I should be aware of as regards the performance? Answer:
It's worth noting that while @ssorallen's answer above will work as described, it also allows *ANY* heroku-deployed app to access your memcached server. So if you store anything at all confidential, or you're concerned about other people making use of your ElatiCache cluster, don't do it. In the context of RDS you have...
There are several Heroku addons that will kinda solve this problem. They provide a SOCKS5 proxy with a static IP address that you can whitelist. * <https://elements.heroku.com/addons/proximo> * <https://elements.heroku.com/addons/quotaguardstatic> * <https://elements.heroku.com/addons/fixie-socks> You can also do thi...
Question: I am currently using Heroku's Memcached in a Rails 3 app and would like to move over to Elasticache because the pricing is much more favorable. Is this possible? Is the configuration relatively straightforward? Is there anything that I should be aware of as regards the performance? Answer:
It's worth noting that while @ssorallen's answer above will work as described, it also allows *ANY* heroku-deployed app to access your memcached server. So if you store anything at all confidential, or you're concerned about other people making use of your ElatiCache cluster, don't do it. In the context of RDS you have...
If you are using Heroku Private spaces, then it should be possible to do using VPC peering. Follow the instructions here so that your AWS VPC and Heroku VPC can access each other's resources: <https://devcenter.heroku.com/articles/private-space-peering> Once you have the above setup working, just create an elastic cac...
Question: I have a cable modem from Spectrum (Ubee ddw36c) in bridge mode (you have to pay $5/month extra for router mode) so only one port is active which has the internet connection. I have this connected to my router (Netgear R6700v2) by long cable to another rooom and everything works fine.It's in another locatio...
The problem is you split your network in the wrong spot. You put the switch between the modem and the router. Anything in this area will get an IP address from your ISP, not the router. You will need to run another cable from the router back to where the printer is (and either plug int into the switch, or into the pr...
With the current setup, you can't get correct IP address since the cable modem's DHCP server is handling IP addresses (which in this case you always get one from your ISP). The easiest workaround is having the printer directly connected to the router (i.e move the printer to the router room) then you can get correct I...
Question: I have a cable modem from Spectrum (Ubee ddw36c) in bridge mode (you have to pay $5/month extra for router mode) so only one port is active which has the internet connection. I have this connected to my router (Netgear R6700v2) by long cable to another rooom and everything works fine.It's in another locatio...
The problem is you split your network in the wrong spot. You put the switch between the modem and the router. Anything in this area will get an IP address from your ISP, not the router. You will need to run another cable from the router back to where the printer is (and either plug int into the switch, or into the pr...
As others have pointed out, the way you have configured the network is putting your printer outside of your local network and directly connected to the internet. This is problematic from many regards, not the least of which is that anyone can hack into your printer and play around with it, potentially without you even ...
Question: At first I heard it and thought i could soar like a bird! And oh what i heard! I’ll zoom so fast, my image will be blurred. And now I see it, it’s flat as can be! Oh woe is me. And how lonely, just one single tree. --- What is this riddle referring to? **Hints:** > > The answer is a single word > ...
I think the word you're looking for is > > plain. > > > "thought I could soar like a bird" > > You misheard it as "plane". Planes (aeroplanes) fly. > > > "I'll zoom so fast, my image will be blurred." > > Just a reference to the rapid motion of aeroplanes? Or perhaps also a reference to the focal plane...
This is more like a poem then a riddle. It could be > > A Dream > > > At first I heard it and thought i could soar like a bird! > > At start you saw something exciting in the dream thats what *"i heard it"* is referring to. And then you decided to fly into the dream like a bird. > > > And oh what i heard...
Question: I'm trying to acquire the most recent entry into DynamoDB or to parse out the results I get, so I can skim the most recent item off the top. This is my code ``` from __future__ import print_function # Python 2/3 compatibility import boto3 import json import decimal from boto3.dynamodb.conditions import Key,...
at the end of my code where it says "print(json.dumps(i, cls=DecimalEncoder))" I changed that to "d = ast.literal\_eval((json.dumps(i, cls=DecimalEncoder)))" I also added import ast at the top. It worked beautifully. ``` import ast table = dynamodb.Table('footable') response = table.scan( Select="ALL_ATTRIBUTES",...
``` import boto3 import json import decimal from boto3.dynamodb.conditions import Key, Attr # Helper class to convert a DynamoDB item to JSON. class DecimalEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, decimal.Decimal): return str(o) if isinstance(o, set): #<---reso...
Question: I want to develop a application. Say for example on Phone7/iPhone/android, this application shall get data from a server. My problem is that I dont know where to start. For the first I got a mac mini that I would love to use as the server, but I got no server operating system on it, does this mean I have to ...
``` class Conversation < ActiveRecord::Base has_many :conversation_users has_many :users, :through => :conversation_users has_many :messages # NEXT LINE IS CHANGED! accepts_nested_attributes_for :conversation_users accepts_nested_attributes_for :messages end ``` Controller ``` def new @conversation = C...
Replace: ```    <% f.fields_for :users do |builder| %> ``` With: ```    <%= f.fields_for :users do |builder| %> ``` Same missing '=' a bit lower.
Question: I want to develop a application. Say for example on Phone7/iPhone/android, this application shall get data from a server. My problem is that I dont know where to start. For the first I got a mac mini that I would love to use as the server, but I got no server operating system on it, does this mean I have to ...
``` class Conversation < ActiveRecord::Base has_many :conversation_users has_many :users, :through => :conversation_users has_many :messages # NEXT LINE IS CHANGED! accepts_nested_attributes_for :conversation_users accepts_nested_attributes_for :messages end ``` Controller ``` def new @conversation = C...
``` <% form_for([current_user, @conversation]) do |f| %> ``` should be ``` <%= form_for([current_user, @conversation]) do |f| %> ``` And ``` <% f.fields_for :messages do |builder| %> # and <% f.fields_for :users do |builder| %> ``` should be ``` <%= f.fields_for :messages do |builder| %> # and <%= f.fields_for...
Question: If I have 2 `int` arrays a and b and they contain data like this.. ``` a[0] = 1 a[1] = 3 a[2] = 7 b[0] = 6 b[1] = 3 b[2] = 5 ``` How can I check if all the pairs of numbers are unique e.g. that each combination of `a[i]` and `b[i]` at the same index is not repeated in the rest of the array... So the above...
If the order of the values in the pairs over the two arrays is significant (i.e. `a[0] == 1, b[0] == 2` is considered different from `a[0] == 2, b[0] == 1`) then one way to check for uniqueness using Linq is as follows: ``` bool unique = a.Zip(b).Distinct().Count() == a.Length; ``` If the order of the values in the ...
try this sample : ``` int [] aa = a.Distinct().ToArray(); ``` or : ``` public static bool HasDuplicates<T>(IList<T> items) { Dictionary<T, bool> map = new Dictionary<T, bool>(); for (int i = 0; i < items.Count; i++) { if (map.ContainsKey(items[i])) { ...
Question: If I have 2 `int` arrays a and b and they contain data like this.. ``` a[0] = 1 a[1] = 3 a[2] = 7 b[0] = 6 b[1] = 3 b[2] = 5 ``` How can I check if all the pairs of numbers are unique e.g. that each combination of `a[i]` and `b[i]` at the same index is not repeated in the rest of the array... So the above...
I've managed to work this out and solve this with : ``` a.Zip(b, (aPos, bPos) => new { aPosition = aPos, bPosition = bPos }).Distinct().Count() ``` This will tell me how many distinct sets of both values at the same index and so I can work the rest out from here. Apologies if my question wasn't clear.
try this sample : ``` int [] aa = a.Distinct().ToArray(); ``` or : ``` public static bool HasDuplicates<T>(IList<T> items) { Dictionary<T, bool> map = new Dictionary<T, bool>(); for (int i = 0; i < items.Count; i++) { if (map.ContainsKey(items[i])) { ...
Question: If I have 2 `int` arrays a and b and they contain data like this.. ``` a[0] = 1 a[1] = 3 a[2] = 7 b[0] = 6 b[1] = 3 b[2] = 5 ``` How can I check if all the pairs of numbers are unique e.g. that each combination of `a[i]` and `b[i]` at the same index is not repeated in the rest of the array... So the above...
If the order of the values in the pairs over the two arrays is significant (i.e. `a[0] == 1, b[0] == 2` is considered different from `a[0] == 2, b[0] == 1`) then one way to check for uniqueness using Linq is as follows: ``` bool unique = a.Zip(b).Distinct().Count() == a.Length; ``` If the order of the values in the ...
I've managed to work this out and solve this with : ``` a.Zip(b, (aPos, bPos) => new { aPosition = aPos, bPosition = bPos }).Distinct().Count() ``` This will tell me how many distinct sets of both values at the same index and so I can work the rest out from here. Apologies if my question wasn't clear.
Question: Given two sample dataframes: ``` df0 = pd.DataFrame([('a', 1, 1000), ('b', 2, 1200), ('d', 100, 1500)], columns=['L','A','ADA']) df1 = pd.DataFrame([('a', 1, 2, 1000), ('b', 2, 100, 1200), ('d', 100, 2, 15...
You can use [`numpy.where`](https://numpy.org/doc/stable/reference/generated/numpy.where.html) to replace all your `duplicate` columns: ``` In [2405]: df1 Out[2405]: L A A ADA 0 a 1 2 1000 1 b 2 100 1200 2 d 100 2 1500 In [2405]: import numpy as np In [2406]: df1.A = np.where(df1.A.gt...
If you want to absolutely retain the duplicate column names, then please try the following. Here, we are trying to access the index of the column and then manipulating it. ``` df = df1 df['A'] = df['A'].astype(float) df.iloc[:,1].values[df.iloc[:,1] > 10] = np.nan df.iloc[:,2].values[df.iloc[:,2] > 10] = np.nan ```
Question: I am thinking of using base64 encoded images for a site I am working on to optimize the load time. Anyways, before I start, I was wondering: what are the advantages and disadvantages of doing this? At the moment, I don't see any disadvantage but also I noticed that it is not a technique used very often and ...
It's only useful for very tiny images. Base64 encoded files are larger than the original. The advantage lies in not having to open another connection and make a HTTP request to the server for the image. This benefit is lost very quickly so there's only an advantage for large numbers of very tiny individual images.
> > the actual length of MIME-compliant Base64-encoded binary data is > usually about 137% of the original data length, though for very short > messages the overhead can be much higher due to the overhead of the > headers. Very roughly, the final size of Base64-encoded binary data is > equal to 1.37 times the original...
Question: I am thinking of using base64 encoded images for a site I am working on to optimize the load time. Anyways, before I start, I was wondering: what are the advantages and disadvantages of doing this? At the moment, I don't see any disadvantage but also I noticed that it is not a technique used very often and ...
It's only useful for very tiny images. Base64 encoded files are larger than the original. The advantage lies in not having to open another connection and make a HTTP request to the server for the image. This benefit is lost very quickly so there's only an advantage for large numbers of very tiny individual images.
Some of downsides as below are already mentioned in this post at [How much faster is it to use inline/base64 images for a web site than just linking to the hard file?](https://stackoverflow.com/questions/1574961/how-much-faster-is-it-to-use-inline-base64-images-for-a-web-site-than-just-linki) * Most forms of caching ...
Question: I am thinking of using base64 encoded images for a site I am working on to optimize the load time. Anyways, before I start, I was wondering: what are the advantages and disadvantages of doing this? At the moment, I don't see any disadvantage but also I noticed that it is not a technique used very often and ...
It's only useful for very tiny images. Base64 encoded files are larger than the original. The advantage lies in not having to open another connection and make a HTTP request to the server for the image. This benefit is lost very quickly so there's only an advantage for large numbers of very tiny individual images.
also the response time of the HTML page will increase, because images loads asyn in normal scenario. even if images loads late you can start seeing text. Another advantage of CDN would lost if only media is being cached in CDN that advantage will be lost.