qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
1,244,621
When I try to redirect to a new page after downloading a file it doesn't work. Do I have to remove or modify anything in this code? the debugger doesnt reach it ``` byte[] fileData = (byte[])sqlRead[3]; Response.Clear(); Response.AppendHeader("content-disposition", "attachment; filename=" + sqlRead[2]); Response.Cont...
2009/08/07
[ "https://Stackoverflow.com/questions/1244621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132640/" ]
Take out ``` Response.End(); ``` [`Response.End`](http://msdn.microsoft.com/en-us/library/ms524629.aspx) kills the entire response, nothing after that will run. > > The End method causes the Web server > to stop processing the script and > return the current result. The > remaining contents of the file are not...
I'm not ASP guy, but you also need to move the Redirect call above any call that writes something to the body of the response. Try to put the `Redirect()` call right after `Response.Clear()` The redirect URL is transferred in header of HTTP response, thus calling it afterwards the body was generated (and thus the hea...
25,627,953
I have two fields of type `varchar` that contain numeric values or blank strings, the latter of which I have filtered out to avoid `Divide by Zero` errors. I am attempting to determine the percentage value that num2 represents in relation to num1, i.e. (Num\_2 \* 1 / Num\_1). Relatively simple math. The problem I am ...
2014/09/02
[ "https://Stackoverflow.com/questions/25627953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1059832/" ]
You didn't interpret the error correctly. It is not about casting the result of your math to float, it is about implicit type casting **before** the equation is evaluated. You have in your table some values that cannot be converted to numeric, because they are not valid numbers or numbers out of range. It is enough...
you said that can be number or blank string. son try something like this: ``` SELECT (CASE WHEN NUM_2 = '' THEN 0 ELSE CAST(NUM_2 AS NUMERIC(15,4)) END) / (CASE WHEN NUM_1 = '' THEN 1 ELSE CAST(NUM_1 AS NUMERIC(15,4)) END) ``` you test if string is blank. if it is, you use 0 (or 1, to avoid division by ...
16,224,515
I've found similar questions, but no clear answer for this question. I have this table: ``` CREATE DATABASE testDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE TABLE testTable ( firstName binary(32) not null, lastName binary(32) not null /* Other non-binary fields omitted */ ) engine=INNODB DEFAULT CHA...
2013/04/25
[ "https://Stackoverflow.com/questions/16224515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1091949/" ]
The answer is that the columns are `binary` when they should be `varbinary`. [This article](http://thinkdiff.net/mysql/encrypt-mysql-data-using-aes-techniques/) explains it: > > Because if AES\_DECRYPT() detects invalid data or **incorrect > padding**, it will return NULL. > > > With `binary` column types being ...
Did you try different values other than 'Testname'? Do other values work? I ask because I had a situation while testing 2 test credit card numbers where one decrypted fine and the other returned null. The answer was to hex and unhex as suggested by "abhinai raj"
3,913,736
I'm sorry if this is a duplicate, I've searched google and SO and couldn't find anything similar since it's a fairly generic set of words to search for! What I want is to have the .git directory be outside of the working tree. I need to do this because it's a 'stealth' git repository inside a project using other vers...
2010/10/12
[ "https://Stackoverflow.com/questions/3913736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40834/" ]
You can specify the path to the git repository explicitly with the `--git-dir` global option for all git commands. When you use this option with `init` it usually creates a bare repository but if you supply `--work-tree` as well you can initialize a non-bare repository with a 'detached' working tree. ``` git --git-dir...
You can link to a gitdir in an arbitrary location by creating a file called `.git` in the root of the work tree, containing the following: ``` gitdir: <path-to-gitdir> ``` Naturally you need to have first moved the original .git directory to its exterior location. All well-behaved git tools will honour this, withou...
21,565
The massive Golems are nearly impervious to harm. Thanks to the New Golem Army, the nascent Dutch Republic's castles and forts are now safe from harm. The century-long external threat has been finally and permanently put to rest, as the bones of our enemies are bleaching in the sun by our castle's walls. A decision h...
2015/07/30
[ "https://worldbuilding.stackexchange.com/questions/21565", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/3510/" ]
Lightning is quite conceivably a good source of power for the golems. An average bolt of negative lightning delivers 500MJ of energy, and a large negative bolt could deliver 35GJ of energy. Positive lightning bolts are very much rarer, but could deliver up to 3.5TJ. In terms of watt-hours, this equates to 138kWh for an...
I would not base my strategies on that. Seeing how they power their golems, we can safely assume that they have some knowledge of electricity. Technology isn't too complex, you need metallic rods and connect them to some batteries or directly to the golems. **However**, I would recommend to think about another alter...
48,414,782
I've 2 tables DeviceType Table ``` id Name 1 Device Type 1 2 Device Type 2 ``` Device Table ``` id Name Device Type Id (fk) 1 Device1 1 2 Device2 1 3 Device3 2 ``` What I want is to query the data from device table with device type name using `LINQ Methods`. I couldn't find the `Incl...
2018/01/24
[ "https://Stackoverflow.com/questions/48414782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2430556/" ]
You do not need to use `.Include` unless you want to get the related entities as well. You can do something like this: ``` context.Devices.Where(your conditions here) .Select(d=>new {Id = d.id, Name = d.Name, DeviceTypeName = d.DeviceType.Name}) ``` You do not need to do `join` since there's a FK relationship ...
``` List<DeviceType> deviceTypeList = new List<DeviceType>() { new DeviceType { id = 1, Name = "Device Type 1" }, new DeviceType { id = 2, Name = "Device Type 2" } }; List<Device> deviceList = new List<Device>() { new Device { id = 1, Name = "Device1", DeviceTypeId = 1 }, ...
54,850,318
So this is more of a trivial problem of writing a clean Python3 code. Let's say I have a class `function` which can create many function types based on the user input. ``` import numpy as np class functions(object): def __init__(self, typeOfFunction, amplitude, omega, start = None, stop = None, ...
2019/02/24
[ "https://Stackoverflow.com/questions/54850318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8560127/" ]
<https://dev.mysql.com/doc/refman/8.0/en/optimize-table.html> says: > > For InnoDB tables, `OPTIMIZE TABLE` is mapped to `ALTER TABLE ... FORCE`, which rebuilds the table to update index statistics and free unused space in the clustered index. > > > This does do some good in cases when you had too much fragmenta...
Don't bother. InnoDB almost never needs either `ANALYZE` or `OPTIMIZE`; don't waste your time unless you have identified a need. An exception is a `FULLTEXT` index on an InnoDB table. Such can benefit from `DROP INDEX`, then `ADD INDEX`. If you are "reloading" the table from new data, then the following avoids downti...
28,751,783
I am using digits by twitter for login through phone number. <http://digits.com/> How can I set the default country code? As I dont want users to scroll through all list of country codes as my major customers are from same geographical reason ?
2015/02/26
[ "https://Stackoverflow.com/questions/28751783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3196981/" ]
When you send object through an Intent's bundle (`i.putExtra("playersList", playersList);`), it is marshalled and then unmarshalled on the other side (the new activity). This mean you have 2 instances of ArrayList and its content (one in each activity). If you wish to share data between activity A and activity B, I sug...
Not sure if this is the best way to accomplish this but i'm going to share with you. I move the `arrayList` with the players back and forth in between the activities. Once the player is sent back it's removed from it and kept in an object `player1`,`player2`,`player3` etc etc. So if the user clicks the button that ha...
39,514,730
I need to read spaces (present before string and after String) given as input using Scanner Note : if there is no spaces given in input it should not add space in output Please find the below code: ``` package practise; import java.util.Scanner; public class scanccls { public static void main(String[] args) ...
2016/09/15
[ "https://Stackoverflow.com/questions/39514730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5672019/" ]
Your code work fine. I just add little modification: ``` package practise; import java.util.Scanner; public class scanccls { public static void main(String[] args) { System.out.println("Enter your name:"); Scanner scan = new Scanner(System.in); String name=""; name+=scan.nextL...
``` package practise; import java.util.Scanner; public class scanccls { public static void main(String[] args) { System.out.println("Enter your name:"); Scanner scan = new Scanner(System.in); String name = ""; name += scan.nextLine(); // Can also be done like //...
70,469,506
hope you're doing good. I'm working on an Advent / Chocolate Box Calendar in ReactJS and am trying to iterate over a for Loop for the number of days in December. I have an issue understanding how to render it to my container in my return statement. [Code Snapshot](https://i.stack.imgur.com/pYgmA.png) Here is the co...
2021/12/24
[ "https://Stackoverflow.com/questions/70469506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17752882/" ]
Thanks everyone for taking your time to help, I found that this code below worked via @jspcal reference to this link for a more concise answer: [React render multiple buttons in for loop from given integer](https://stackoverflow.com/questions/64655265/react-render-multiple-buttons-in-for-loop-from-given-integer) Here ...
In React, it is done using [map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map). Check out react docs on [rendering multiple components](https://reactjs.org/docs/lists-and-keys.html#rendering-multiple-components) ``` <Grid container spacing={1}> {days.map((day) => { retu...
10,070,027
I have created a spring-batch job. My reader class reads the data from the DB and gives back the dataset object having the below structure. ``` @XmlRootElement @XmlType(propOrder = { "start", "end", "users"}) public class DataSet implements Serializable { /** * Start datetime of this data set */ pr...
2012/04/09
[ "https://Stackoverflow.com/questions/10070027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1320554/" ]
I set the root to `!-- --` finally got a valid xml. ``` <bean id="delegateWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter"> <property name="marshaller" ref="someMarshaller" /> <property name="overwriteOutput" value="true" /> <property name="RootTagName" value="!-- --"/> </bean> ```
I override the method endDocument(XMLEventWriter writer), when I set rootTagName = "!-- --" and then ignore the end root tag. ``` protected void endDocument(XMLEventWriter writer) throws XMLStreamException { // if(this.getRootTagName().equalsIgnoreCase("!-- --")){ return; } String nsPre...
46,043,666
as I described on the title, I want to write a trigger that defines to add a new staff by all giving attributes except ID, I want to trigger generate and insert it automatically. How can I do that? I've written a code like below in PL/SQL, but it's including the sequence and I couldn't find how can I get the current m...
2017/09/04
[ "https://Stackoverflow.com/questions/46043666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5675275/" ]
Perhaps you can use something like the following to find the maximum value for STAFF\_ID and then redefine the sequence based on that value: ``` DECLARE nMax_staff_id NUMBER; BEGIN SELECT MAX(STAFF_ID) INTO nMax_staff_id FROM STAFF; EXECUTE IMMEDIATE 'DROP SEQUENCE BEFORE_INSERTING'; EXECUTE IMMEDIA...
Using the sequence guarantees uniqueness of STAFF\_ID but does not guarantee no gaps in assigning STAFF\_ID. You might end up with STAFF\_ID like 100, 101, 103, 106.. First, get the max(STAFF\_ID) while the system is not running. Something like ``` select max(staff_id) from staff; ``` Then, create the sequence to s...
39,681,371
Like the subject says, I've suddenly lost the ability to view class members (properties and methods, or any structure at all) from the Solution Explorer. I've looked in settings unsuccessfully (not that I changed anything), and have tried cleaning the solution, rebuilding, restarting Visual Studio, etc. to no avail. Wh...
2016/09/24
[ "https://Stackoverflow.com/questions/39681371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2346932/" ]
Is it website project or web application project? We couldn't see any class member hierarchy in website project.
You can find it in view dropdown menu! and if not then clear your question more please
19,323,990
I have the following models in file `listpull/models.py`: ``` from datetime import datetime from listpull import db class Job(db.Model): id = db.Column(db.Integer, primary_key=True) list_type_id = db.Column(db.Integer, db.ForeignKey('list_type.id'), nullable=False) list_type ...
2013/10/11
[ "https://Stackoverflow.com/questions/19323990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/134484/" ]
When you call the `migrate` command Flask-Migrate (or actually Alembic underneath it) will look at your `models.py` and compare that to what's actually in your database. The fact that you've got an empty migration script suggests you have updated your database to match your model through another method that is outside...
For anyone coming who comes across this, my problem was having `db.create_all()` in my main flask application file which created the new table without the knowledge of alembic Simply comment it out or delete it altogether so it doesn't mess with future migrations. but unlike @Miguel's suggestion, instead of dropp...
58,514,008
How can you get say a number `99123412341234` to `99-1234-1234-1234`? * First two characters are in a group (`99`). * The rest are separated into groups of 4 characters (`1234, 1234, 1234`). * The groups are joined with a `-`. My frankenstein version works (see below), but **there must be a more elegant solution.** ...
2019/10/23
[ "https://Stackoverflow.com/questions/58514008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1903339/" ]
You can do this without a for-loop by reducing every character onto a sub-array and then joining the results. ```js console.log(formatNumber(99123412341234, '-', 4, 2)); /** * Formats * @param {int} n - a number * @param {String} d - delimiter * @param {int} p - partition size * @param {int} o - ...
One approach is to use [slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice). ```js let number = 99123412341234; number = number.toString(); // Convert number to string. let parsedNumber = number.slice(0, 2); // Get first two characters. let length = number.slice(2...
1,060,081
I'm trying to allow my php pages to run inside a content page of the master page. I'd like to run php somehow inside a master page. Besides frames is there another way? I've read you can use a frame, but would prefer not to. If I have to go with frames to get it done, should I be using an asp.net frame class of some so...
2009/06/29
[ "https://Stackoverflow.com/questions/1060081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57883/" ]
Check out [Phalanger](http://www.codeproject.com/KB/cross-platform/phalanger-intro.aspx), a php compiler for the CLR
Unfortunately, you won't be able to get php to run within an ASP.NET page. You can run PHP on an IIS7 install, but it would have to be separate pages, and I don't think that things such as application or session state are transferrable (you would have to store all of that externally, in a DB for example).
57,911,585
I got a problem when I wanted to put my large-sized photos from my storage into small imageViews. I´m wondering how to put these kind of photos inside a small imageViews without decreasing app speed or crashing. I have a RecyclerView that shows some pictures from storage in a list. Here is my recycler adapter code. Tha...
2019/09/12
[ "https://Stackoverflow.com/questions/57911585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10192418/" ]
The better way is using this code: ``` Glide.with(imageView.context) .load(imageFile) .apply(RequestOptions().centerCrop()) .into(imageView) ``` Glide class is faster and more optimized.
i suggest you using **[picasso](https://square.github.io/picasso/)** with resize methode ,it will avoid you the lack of speed and crashes ``` Picasso.get().load(new File(...)).resize(50, 50).centerCrop().into(imageView); ```
14,862,289
I have read the documentation and various tutorials online but I'm still confused on how regex works in Java. What I am trying to do is create a function which takes in argument of type string. I then want to check if the passed string contains any characters other than MDCLXVIivxlcdm. So for example, string "XMLVID" s...
2013/02/13
[ "https://Stackoverflow.com/questions/14862289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2002059/" ]
You will need to use [Java's character class](http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#cc) intersection operator inside a character class, otherwise it literally matches `&&`. Btw, your first character class from `A` to (lowercase) `z` also includes `[\]^_`, which you certainly do not want;...
you can use a function like this, with two arguments, viz., * `origingalString` the original string to check * `searchString` the string to be searched the code exactly, ``` public boolean checkCompletelyExist(String origingalString,String searchString){ boolean found = false; String regex = ""; try{ f...
30,523,370
I'm trying to create a toggle content button that loads with the content already hidden. This is the code I'm using but I'm not sure how to make the content appear as hidden (making the toggle button function more used for expanding content) ```js $(function() { var b = $("#button"); var w = $("#wrapper"); va...
2015/05/29
[ "https://Stackoverflow.com/questions/30523370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4274897/" ]
jQuert toggle method will help you, if you want it hidden for the first time apply style like this -> style="display:none" If you want it visible then don't add this style Basically what toggle function does is, if your component visible then hides it and if it is hidden then shows it... ``` $('#button').click(funct...
using CSS ========= You can accomplish this with just CSS: ```css div#wrapper { transition: max-height 1000ms; overflow: hidden; } #toggle:not(:checked) ~ div#wrapper { max-height: 0; } #toggle:checked ~ div#wrapper { max-height: 200px; } #toggle:checked ~ label:after { content: "hide" } #toggl...
70,472,848
I'm using [Swift Playgrounds App](https://www.apple.com/swift/playgrounds/) on Mac, which is different than Swift Playgrounds inside the Xcode. I'm interested in using a UIKit-based Swift Package in my Playground, but couldn't find anything similar to Package.swift file or a menu item to add a package: Is there an op...
2021/12/24
[ "https://Stackoverflow.com/questions/70472848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3667264/" ]
What I would try do is open the playground file in the finder. You can open the playground book as a folder and see the contents of the playgrounds there and paste the swift package there.
I add the GitHub hosted packages by tapping the add file button and selecting package from the menu and pasting the GitHub link into the pop up. It will ask you to select the version you want to use. I’m guessing in the Mac interface that will be in the File menu.
51,352,655
I can not get out of my application, I'm using the auth out of box login for laravel 5, but when I get out of my account, I'm not successful. **EDIT:** the problem is that dropdown menu does not open for me to logout. Can someone help me ? this is my app.blade.php -> ``` @guest <li><a href="{{ route('login') }...
2018/07/15
[ "https://Stackoverflow.com/questions/51352655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9796809/" ]
With the classes you have shown us here, there is nothing shorter than ``` Person p2 = Person() ..name = p1.name ..surname = p1.surname ..city = (City()..name = p1.city.name..state = p1.city.state); ``` If you add a `clone` method to `Person` and `City`, then you can obviously use that. There is nothing built ...
Using a package like [freezed](https://pub.dev/packages/freezed#going-further-deep-copy), you could make deep copies of the complex objects. Although one downside is that the objects are immutable and you cannot make shallow copies of it. But again, it depends on your use case and how you want your objects to be.
177,126
Playing on the 1.8 snapshots, I came across a very rare rabbit known as the Killer Rabbit of Caerbannog. He looked a little bit like this: ![enter image description here](https://i.stack.imgur.com/MiLHC.png) If I make him a cage, how can I catch him and get him into it?
2014/07/16
[ "https://gaming.stackexchange.com/questions/177126", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/77290/" ]
Although the other answers both work, I found it inconvenient to transport the rabbit to his cage after he was caught. I ended up using a mine-cart to pick up my rabbit and transport him to his new home: ![enter image description here](https://i.stack.imgur.com/Gq8KJ.png) Leading my evil friend to his trap: ![enter...
The Killer Rabbit is hostile towards players so luring it around isn't tricky- it will try to move towards you and attack if it can. Just stand near enough that it can chase you (but keep enough distance that it doesn't hit you- it does more than twice the damage of a zombie). Trapping it is not difficult. It doesn't ...
10,741,831
I want to format selected text to a heading, the way I am doing it works fine in Firefox and Google Chrome but it doesn't work in IE9, here is how I do it: ``` document.execCommand('formatBlock',false,'h1'); ``` Does anyone know how to achieve the same task in Internet Explorer 9?
2012/05/24
[ "https://Stackoverflow.com/questions/10741831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1117672/" ]
Internet Explorer supports only heading tags `H1` - `H6`, `ADDRESS`, and `PRE`, which must also include the tag delimiters `<` and `>`, such as in `<H1>`.
works perfect for me in IE9 your codes probably wrong, mines more like: ``` var contentWindow = editor.contentWindow; contentWindow.focus(); contentWindow.document.execCommand('formatBlock', false, '<h1>'); contentWindow.focus(); ```
225,968
In [my answer](https://scifi.stackexchange.com/a/53787/19561) to a question on the SF & Fantasy stack, I assumed that "half a dozen" is imprecise enough to mean anywhere from 5 to 7. Another user challenged that assumption and stated that since a dozen is 12, a half dozen is necessarily 6 and nothing else. In [the ans...
2015/02/06
[ "https://english.stackexchange.com/questions/225968", "https://english.stackexchange.com", "https://english.stackexchange.com/users/59244/" ]
A 'dozen' is absolute. It means **twelve**. No generalities apply.
A gross is always 144, a score is always 20, a bakers dozen is always 13, a dozen is always 12, and half a dozen is always six, and so on and so forth, but . . . We do not always use numbers precisely, leaving aside errors (including fencepost errors like the mentioned supermarket line) there are three ways that numbe...
16,346,632
I have an asp.net application (created by a previous developer) that uses a RadGrid control to display data. However, the RadGrid does not show data if there is an on the page. The radGrid works fine soon as I remove the UpdatePanel. If I remove the Updatepanel, then RadCombobox makes a whole page submit (instead of us...
2013/05/02
[ "https://Stackoverflow.com/questions/16346632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72324/" ]
You are generating the controls dynamically, so the compiler has no idea what `textBox4` is BEFORE it is even created. What you can do though is to search for that control by its name during runtime: ``` TextBox textbox4 = (TextBox)this.Controls.Find("textbox4", false).FirstOrDefault(); if (textbox4 == null) { th...
you can find the textbox by name: ``` var textbox = this.Controls.OfType<TextBox>().Single(ctr => ctr.Name == "textboxname"); ```
48,230,830
I want to add a CSS dropdown menu to my header. It's works in part... but when you mouse over it, this element escapes up. How to set it correctly? It should stay in place and dropdown should be under the `<li>` element. ```css * { margin: 0px; padding: 0px; font-family: 'Advent Pro', sans-serif; } body { ...
2018/01/12
[ "https://Stackoverflow.com/questions/48230830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7839727/" ]
You need to set position:relative to the parent item, then position:absolute on the dropdown. Without touching the HTML, that'd be ``` .navbar-list > li{ position:relative; } .navbar-list ul{ position:absolute; width:100%; } ``` The second rule sets any `<ul>` that's a descendant from the .navbar-list as ab...
try this ```css * { margin: 0px; padding: 0px; font-family: 'Advent Pro', sans-serif; } body { display: flex; -ms-flex-direction: column; flex-direction: column; min-height: 100vh; } .wrapper { display: flex; flex-direction: column; } .navbar-list, .navbar-list a, .navbar, .logo ...
11,195,333
I know documentation is lacking for this mysterious module, but Im running Strawberry Perl and would be happy just with being able to install it. I typically run something like the following from the command line to get a module: ``` cpan WWW::Selenium ``` To get WWW::Selenium, for example. Yet when I run ``` cpan ...
2012/06/25
[ "https://Stackoverflow.com/questions/11195333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1222564/" ]
See, some Perl modules are just wrappers around some libraries and/or system tools, allowing to use them naturally within Perl program (using the familiar syntax constructs, etc.) [Lucene](https://metacpan.org/module/Lucene) is built the same way: it's a wrapper around CLucene indexing library. So you have (as quite o...
Looking at the Makefile.PL, the module is not designed to work under Windows, if you look at the Makefile.PL under "C:\Strawberry\cpan\build\" (on my machine), you should see something like this on lines ~8: ``` ## Hash that specifies for each OS all possible directories to look ## for CLucene/clucene-config.h my $rh_...
7,056,472
I'd like to use protocol buffer in my program to read data from a file. I also would like to be able to edit the data file with any text editor, for a start (I'll write a data editor later on, and switch to full binary). Is there a way to parse a human-readable format ? (debug string provided by protobuf itself, or so...
2011/08/14
[ "https://Stackoverflow.com/questions/7056472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/893790/" ]
There is a text based format too, but support for this is implementation specific. For example, I don't support it *at all* in protobuf-net. But yes: such is defined, and discussed (for example) here: <http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google.protobuf.text_format.html> Personally, I'd rath...
If you don't mind using command-line tools, the [Piqi project](http://piqi.org) includes [piqi convert](http://piqi.org/doc/tools/#piqiconvert) command for converting between 4 formats: binary Protocol Buffers, JSON, XML and [Piq](http://piqi.org/doc/piq). The Piq format is specially designed for viewing and editing da...
1,386,367
I'm interested in the definite integral \begin{align} I\equiv\int\_{-\infty}^{\infty} \frac{1}{x^2-b^2}=\int\_{-\infty}^{\infty} \frac{1}{(x+b) (x-b)}.\tag{1} \end{align} Obviously, it has two poles ($x=b, x=-b$) on the real axes and is thus singular. I tried to apply the contour integration methods mentioned [here](...
2015/08/06
[ "https://math.stackexchange.com/questions/1386367", "https://math.stackexchange.com", "https://math.stackexchange.com/users/259225/" ]
If $0 \neq 2$ in the field and $P^2=P$, then the minimal Polynomial of $P$ divides $f := x^2-x$, which means it is $f$, $x$, or $x-1$. If it is $x$, $P=0$, and if it is $x-1$, $P=1$. Those cases are clear. So suppose it is $x^2-x$. Then $I+P$ has minimal polynomial $(x-1)(x-2)=x^2-3x+2$. This means that $I$ is $((I+P)...
Hint: $$ (I+P)(P-2I)=P-2I+P-2P=-2I $$
25,761,232
I am trying to use sitefinity *Staging & Synchronization* feature. I did exactly what is told in this youtube video <https://www.youtube.com/watch?v=O-mbXODZ0MI> But receiving following error. **You cannot sync the data, because the destination doesn't contain a site with name 'SFDev'.** ![enter image description he...
2014/09/10
[ "https://Stackoverflow.com/questions/25761232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2739418/" ]
The site names have to be the same. When you make the first move it is all "manual". The code and DBs must match from the beginning. The sync tool is NOT a database mover it only sync specific areas of it. Please reference these instructions. <http://www.sitefinity.com/documentation/documentationarticles/installation...
I don't think the source or destination site can be running Casini Web server while executing a SiteSync. Have a look here: <http://www.sitefinity.com/documentation/documentationarticles/prerequisites-and-restrictions> > > All sites must be deployed on IIS. > > >
1,196,703
We get into unnecessary coding arguments at my work all-the-time. Today I asked if conditional AND (&&) or OR (||) had higher precedence. One of my coworkers insisted that they had the same precedence, I had doubts, so I looked it up. According to MSDN AND (&&) has higher precedence than OR (||). But, can you prove i...
2009/07/28
[ "https://Stackoverflow.com/questions/1196703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39013/" ]
Wouldn't this get you what you're after? Or maybe I'm missing something... ``` bool result = true || false && false; ```
You cannot just show the end result when your boolean expressions are being short-circuited. Here's a snippet that settles your case. It relies on implementing & and | operators used by && and ||, as stated in [MSDN 7.11 Conditional logical operators](http://msdn.microsoft.com/en-us/library/aa691310(VS.71).aspx) ```...
8,132,074
Here's the PowerShell script I am using to add "segment99" to the beginning of all the text files (one by one) within a folder: ``` Set Environmental Variables: $PathData = '<<ESB_Data_Share_HSH>>\RwdPnP' Go to each text file in the specified folder and add header to the file: Get-ChildItem $PathData -filter 'test_...
2011/11/15
[ "https://Stackoverflow.com/questions/8132074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1046901/" ]
Copying a header file + a large file to a new file will be less prone to outofmemory exceptions (for files of that size): ``` $header = '"segment99"' $header | out-file header.txt -encoding ASCII $pathdata = "." Get-ChildItem $PathData -filter 'test_export.txt' | %{ $newName = "{0}{1}{2}" -f $_.basename,"_99",$_.ext...
This is not optimal code but it solves the task without reading all text to memory: it adds the header to the first line and then outputs other lines. Also, note that it does nothing if the input file is empty. ``` Get-ChildItem $PathData -Filter 'test_export.txt' | %{ $header = $true Get-Content $_.FullName |...
29,375,512
I'm trying to build up some regular expressions to validate a textbox on c# wpf. I build the following to validate a number from 6 to 3600: ``` ^([6-9]|[1-9][0-9]{1,2}|[12][0-9]{3}|3[0-5][0-9]{2}|3600)$ ``` Now I need to validate from 15 to 250. I am new on regex and I am having a hard time getting it. Thanks
2015/03/31
[ "https://Stackoverflow.com/questions/29375512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614070/" ]
A direct translation would be: ``` ^(1[5-9]|[2-9][0-9]|1[0-9]{2}|2[0-4][0-9]|250)$ ``` Split up it is `1[5-9]` or 15-19, `[2-9][0-9]` or 20-99, `1[0-9]{2}` or 200-199, `2[0-4][0-9]` or 100-249, `250`.
The following RegEx should satisfy all numbers in the range 15-250. However, as I have cautioned you in the comments, a NumericUpDown is a far superior choice for this kind of stuff: ``` \b(2[0-4]\d)|(1\d\d)|(250)|([2-9]\d)|(1[5-9])\b ```
19,027,324
I'm trying to install numpy using pip. When I type `pip install numpy` in the command prompt it goes to work but won't install the file and returns an error code `1`. I am using windows 8 64-Bit and python 2.7.This is the final bit of the error message ``` Cleaning up... Removing temporary dir c:\users\pim\appdata\lo...
2013/09/26
[ "https://Stackoverflow.com/questions/19027324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2747359/" ]
Make sure you have python-dev installed (as you'll definitely see this same error if you don't). ``` dpkg -l python-dev ```
I downloaded python 37, and I customized install location. Then I tried to install numpy using pip: failed error code 1. Then I deleted python 37, downloaded python 36 without customizing install location. Then I installed numpy using pip: successful. Perhaps customizing install location caused the error.
2,647,999
I have created a toolbar with some controls on it using ReBar within a window. Can anyone please tell me, 1. How to get the HWND of a **buttons/combobox/etc** (not normal buttons in a window) if I know (only) the Id of it ? 2. How to obtain the HBITMAP if I know the id of the resource ? 3. How to set the bitmap to th...
2010/04/15
[ "https://Stackoverflow.com/questions/2647999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/134804/" ]
You could download [ControlSpy](http://msdn.microsoft.com/en-us/library/bb773165(VS.85).aspx) and try it in there to get a feel for it. I checked the Rebar and saw that RB\_SETBANDINFO (under *Messages*) could be what you are looking for.
[GetDlgItem](http://msdn.microsoft.com/en-us/library/ms645481(VS.85).aspx) will work just as well with a Rebar as it does with a Dialog. > > You can use the GetDlgItem function with any parent-child window pair, not just with dialog boxes. As long as the hDlg parameter specifies a parent window and the child window h...
64,624,106
I need to access the `fileHandler` object of my logger so I can flush the buffer to the file. This is my program: ``` import * as log from "https://deno.land/std@0.75.0/log/mod.ts" import { Application } from "https://deno.land/x/oak@v6.3.1/mod.ts"; const app = new Application() const port = 7001 await log.setup...
2020/10/31
[ "https://Stackoverflow.com/questions/64624106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2432478/" ]
Well, I found a solution. I just have to import the FileHandler class and cast my handler down from BaseHandler to FileHandler. So I added this line among the imports: ``` import { FileHandler } from "https://deno.land/std@0.75.0/log/handlers.ts" ``` And then after creating the logger: ``` logger.debug("hi there...
Let us just recap with the help of Santi's answer. In my experience logs in file work fine in an ending program. I mean a program which dies by itself or with Deno.exit(0). Problem occurs in a never ending loop. In this case logs don't append in their files. Below is how to overcome this situation : ``` // dev.js : "...
56,893,911
`hg bookmarks --delete` can be used to remove a bookmark. Is there any way I can remove all bookmarks in a Mercurial repo through some bash script? I think that this may be possible using awk - but it's a bit beyond me. The format of the `hg bookmarks` output is (for example): ``` 2018.02.706 Customer App 5255:c1321...
2019/07/04
[ "https://Stackoverflow.com/questions/56893911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/448337/" ]
If you really just want to delete all bookmarks, just delete the `.hg/bookmarks` file from your repo's hidden `.hg` directory. The bookmarks may come back if you pull them from a remote location, so you'd have to also do `hg book push -B 'your bookmark name'` to also remove the bookmark from the remote location, but t...
Assuming the spaces in your input are blank chars as it appears in your sample input, to do what you asked for in your question portably and robustly is: ``` $ sed 's/ [^ ]*$//' file 2018.02.706 Customer App 2018.02.707 Customer App ``` and to get the output the command line in [your answer](https://stackoverflow.co...
39,552,333
I'm new in Ethereum, so probably that's a silly question. Now I'm trying to install serpent and pyethereum according to this [tutorial](https://github.com/ethereum/wiki/wiki/Serpent). Everything works well, but when I'm launching Python's code: ``` import serpent import pyethereum ``` There is an error: `No module ...
2016/09/17
[ "https://Stackoverflow.com/questions/39552333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6843935/" ]
The module's name is `ethereum`, not `pyethereum`. Using the following: ``` import serpent import ethereum ``` should work just fine.
Follow the installation instructions from [Pytherium's Readme](https://github.com/ethereum/pyethereum), which read: ``` git clone https://github.com/ethereum/pyethereum/ cd pyethereum python setup.py install ``` In the tutorial's instructions, `develop` branch is used, which seems to be failing according to the cont...
23,476,257
Say I have an algorithm in Java where I want to do something on a monthly basis based off the time associated with each object. So for example, if `Object a` has time `long t`, and `t` is in milliseconds since the epoch, how would I find out that `t` is a time in 03/2014? As a secondary question, how can I iterate ov...
2014/05/05
[ "https://Stackoverflow.com/questions/23476257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3475234/" ]
The easiest way to do this is to use the [`java.util.Calendar`](http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html) class as you mention in your question. You can easily get an instance by using ``` //use whatever time zone your milliseconds originiate from //there is another getter that takes a Locale, ...
Using the Java 8 API in `java.time` you could do the following: ``` import java.time.Instant; import java.time.Month; import java.time.MonthDay; import java.time.OffsetDateTime; public static void main(String[] args) { long ms_since_epoch = 1_500_000_000_000L; Instant instant = Instant.ofEpochMilli(ms_since_e...
2,098,135
I'd like to increase the height of an NSPathControl as well as make the font size larger. Is there any way to do it without subclassing the control as discussed [here](http://www.cocoabuilder.com/archive/cocoa/226871-design-advice-bread-crumbs-nspathcontrol.html)?
2010/01/20
[ "https://Stackoverflow.com/questions/2098135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1512/" ]
To get a list of all model classes, you can use `ActiveRecord::Base.subclasses` e.g. ``` ActiveRecord::Base.subclasses.map { |cl| cl.name } ActiveRecord::Base.subclasses.find { |cl| cl.name == "Foo" } ```
You can use `rails dbconsole` to view the database that your rails application is using. It's alternative answer `rails db`. Both commands will direct you the command line interface and will allow you to use that database query syntax.
11,462,768
When seeing an instance variable's address in the debugger, how can one get the class by entering in the given memory address? I know that the opposite (getting the address from an instance) is possible with `p someObjectInstance` in the debugger or `NSLog(@"%p", someObjectInstance);` from within the code. Is there a ...
2012/07/13
[ "https://Stackoverflow.com/questions/11462768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/205926/" ]
What you are asking for is VERY unsafe. Accessing an unknown memory location is generally a bad idea, but since you asked: EDIT: If inside `gdb` or `lldb`, you can do the following: ``` po [(id)(0xDEADBEEF) class] ``` If running from code, however, use the following; ``` NSString *input = @"0xFAFAFA"; unsigned ad...
In Swift, you can use `unsafeBitCast` ``` (lldb) e let $vc = unsafeBitCast(0x7fd0b3e22bc0, GooglyPuff.PhotoCollectionViewController.self) (lldb) po $vc.navigationItem.prompt = "WOOT!" ``` Reading from [Grand Central Dispatch Tutorial for Swift: Part 2/2](http://www.raywenderlich.com/79150/grand-central-dispatch-tuto...
18,353,830
I am working on a Quiz Application where I need to get all the selected elements or the user answers . These elements can be radio input, check-box input or the text field. every element is assigned a question\_id attribute, answer\_id and a mark attribute with it. What I want to do is I have to get these all question\...
2013/08/21
[ "https://Stackoverflow.com/questions/18353830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1765969/" ]
I have solved this problem by getting all the elements available in the DOM by their name, using getElementsByName('answer') method. It returns me a list then looping over this list i checked if the element is check or not if it is checked i get their attributes. ``` attributes_list=new Array() var answers=document.g...
its very simple, you just have to use `element.attr( attributeName )` function [JQuery documentation](http://api.jquery.com/attr/) A little [JSFIddle](http://jsfiddle.net/Y8K9A/) to get you going ``` alert("Radio Mark " + $("#one").attr('mark') + ", Radio Value " + $("#one").attr('value')); alert("check Mark " + $(...
16,521,029
Suppose I have some html like this -: ``` <div style="blah...blah">Hey Nice</div> <a style="blah...blah">Great</a> ``` How do I remove all the inline styling applied to the above elements in my stylesheet considering I don't know what all inline styling exists. Currently I am trying this, but in vain -: ``` div[sty...
2013/05/13
[ "https://Stackoverflow.com/questions/16521029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1952015/" ]
You must reset **all** css properties for elements that have `style` attribute: ``` [style] { position: static !important; float: none !important; border: 0 none !important; margin: 0 !important; padding: 0 !important; outline: 0 none !important; // and so on } ```
There are several determining factors determining which CSS property prevails in any situation. In order, these are: 1. Whether the property value has the `!important` flag or not. 2. If the style declaration is applied inline via the `style` attribute. 3. The strength of the CSS rule selector * If the rule has any I...
33,442,951
I built this code as a test to delete a range of records from an Access 2013 database based upon a range of dates. I'm getting a missing operator error in query expression 'START\_DATE >= .....etc. I have tried the select statement with apostrophes as well. NOTE: the CALL line is all one line in the actual code. Also,...
2015/10/30
[ "https://Stackoverflow.com/questions/33442951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4538449/" ]
First work out the query logic and syntax in the Access query designer. Assuming *START\_DATE* is Date/Time datatype, pick a couple static values for the start and end of your target date range: ```sql SELECT START_DATE FROM TEMP_DATE_RANGE WHERE START_DATE BETWEEN #2015-1-1# AND #2015-10-30# ``` Adjust as needed. ...
Your date comparison syntax is a little off, remove `IS` in `IS >=` and remember to add `START_DATE <=` rather than just `<=` With the corrections, it becomes: ``` Call objectrecordset.Open("select START_DATE from TEMP_DATE_RANGE where START_DATE >= " & begdt & " AND START_DATE <= " & enddt, , , adLockBatchOptimist...
13,906
If the time signature is 8/8 or 4/4 and let's say we have 8 eighth notes in a bar the picking should just be down up down up down up, etc. But what happens if we have 7/8? Particularly in the next bar. After we play the first bar the 7th eighth note was played downwards so should the first note of the next bar be playe...
2013/11/29
[ "https://music.stackexchange.com/questions/13906", "https://music.stackexchange.com", "https://music.stackexchange.com/users/8608/" ]
While, as said by the previous answers, such meters can normally be sudivided into little chunks, it is in my experience not a good idea to let this influence strumming patterns etc. to directly: this is prone to give exactly the experience that many people associate, dislikingly, with odd meters – a "jumpy" sound, as ...
Watch any good rhythm player, and notice how the strumming arm flows with a regular motion. The up/down movements are not jerky. With some of the above answers, the strum pattern, whatever it is, will result in jerks. By playing the main beats all with downstrokes, the 'ands' are with upstrokes. This will keep a stead...
40,747,397
I'm creating a pennies game, which has now already been created in C++, however I am having some trouble converting it to Python. It seems I can't figure out how to convert something such as this loop into Python. ``` void penniesLeftOver(int amountOfPenniesCurrent) //Displays the amount of Pennies left to the ...
2016/11/22
[ "https://Stackoverflow.com/questions/40747397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7195717/" ]
In python you can multiply a string by an int, it will create a new string which is the initial string repeated n times. And you can `print()` multiples things at once. Which gives: ``` def penniesLeftOver(amountOfPenniesCurrent): print("Pennies Remaining:", amountOfPenniesCurrent, " o"*amountOfPenniesCurrent) ``...
while it makes more sense to modify the string beforehand so you only make one call to `print` there are other ways to accomplish your task. `sys.stdout.write(string)` will write the variable `string` to stdout (buffered) and calling `sys.stdout.flush()` will flush that buffer to write immediately. (you can also defin...
55,690,307
I got some question and hopefully you can help me out. :) What I have is a table like this: ``` ID Col1 Col2 ReverseID 1 Number 1 Number A 2 Number 2 Number B 3 Number 3 Number C ``` What I want to achieve is: * Create duplicate of every record with switched columns and ad...
2019/04/15
[ "https://Stackoverflow.com/questions/55690307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11363139/" ]
Currently `Wrapper<A>` and `Wrapper<B>` are structurally compatible. If you'll store the passed constructor as a field (for example) you'll get an error: ``` type Constructor<T> = new (...args: any[]) => T; class Wrapper<T> { constructor(private c: Constructor<T>){} public static forConstructor<T>(construc: ...
A static method can not use the instance type argument `Wrapper<T>` since static is not instance bounded. Your method signature `<S extends Object` essentially means `any` Object. So there is no type safety at all. That's why the tscompiler does not complain at ``` const wrapper: Wrapper<A> = Wrapper.forConstructor(B...
4,087,325
If $\sum a\_n$ is convergent then the power series $\sum a\_n z^n$ has a positive radius of convergence. Prove or disprove. I am unable to connect the convergence of the series and the corresponding power series. Help please.
2021/04/02
[ "https://math.stackexchange.com/questions/4087325", "https://math.stackexchange.com", "https://math.stackexchange.com/users/201051/" ]
There are * $\binom{25}{0} = 1$ ways to toss the coin 25 times, obtaining zero "cross"s, * $\binom{25}{1} = 25$ ways to toss the coin 25 times, obtaining one "cross", and * $2^{25} = 33\,554\,432$ possible sequences of 25 coin tosses. So the probability of getting $0$ or $1$ "cross"s is $$ \frac{\binom{25}{0} + \bino...
If I understand your question correctly... Take cases on if $x=0,1$. If $x=0$, then every flip must be head, so $$\frac{1}{2^{25}}$$ chance. If $x=1$ then there must be one cross and all others heads. This happens with chance $$\frac{25}{2^{25}}.$$ Thus the answer is $$\frac{26}{2^{25}}.$$
6,970,921
I'm trying to set up a basic web page, and it has a small music player on it (niftyPlayer). The people I'm doing this for want the player in the footer, and to continue playing through a song when the user navigates to a different part of the site. Is there anyway I can do this without using frames? There are some tu...
2011/08/07
[ "https://Stackoverflow.com/questions/6970921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/882442/" ]
Wrap the content in a div, and wrap the player in a separate div. Load the content into the content div. You'd have something like this: ``` <div id='content'> </div> <div id='player'> </div> ``` If you're using a framework, this is easy: `$('#content').html(newContent)`. EDIT: This syntax works with jQuery and e...
What you're looking for is called the 'single page interface' pattern. It's pretty common among sites like Facebook, where things like chat are required to be persistent across various pages. To be honest, it's kind of hard to program something like this yourself - so I would recommend standing on top of an existing fr...
24,249,320
I have a table (Table1) that has an ID that is shared from multiple-inserts: > > > ``` > ID | RefID | Field_Name | Field_Value | Type > 1 | 1 | NumbAmt | 1111 | INT > 2 | 1 | LocAdd | 123 Street | String > 3 | 1 | LocDesc | Something | String > 4 | 1 | LocHidden | Useles...
2014/06/16
[ "https://Stackoverflow.com/questions/24249320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1368835/" ]
You have several options: * Join the table to itself * Use PIVOT * Subquery all fields in the SELECT list * Use OUTER APPLY for each field * Use CTE * **Consider to rethink your scheme!** **JOINS** ``` SELECT T1_RefID.RefID, T1_NumbAmt.FieldValue AS NumbAmt, T1_LocAdd.FieldValue AS LocAdd FROM (SELECT DIST...
Use group by on the key field, and some aggregate function to promote the correct value over the nulls (I believe max will do, but cannot test this where I sit presently) ``` SELECT RefID, MAX( CASE WHEN Field_Name = 'NumbAmt' THEN Field_Value ELSE NULL END ) Amt, MAX( CASE WHEN Field_Name = 'LocAdd' THEN Field...
337,449
I need to declare an array of pointers to functions like so: ``` extern void function1(void); extern void function2(void); ... void (*MESSAGE_HANDLERS[])(void) = { function1, function2, ... }; ``` However, I want the the array to be declared as constant -- both the data in the array and the pointer to the ...
2008/12/03
[ "https://Stackoverflow.com/questions/337449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1491/" ]
`cdecl` says: ``` cdecl> explain void (* const foo[])(void) declare foo as array of const pointer to function (void) returning void ``` Is it what you need?
I am not sure if this will work in 'C'. it does work in 'C++': * First define MESSAGE\_HANDLERS as a type: `typedef void (*MESSAGE_HANDLER)();` * Then, use the type definition to declare your array a constant: `MESSAGE_HANDLER const handlers[] = {function1, function2};` The trick is in the `typedef`, if you can do ...
28,867,024
I am using ``` void Update() {`for (var i = 0; i < Input.touchCount; ++i) { if (Input.GetTouch(i).phase == TouchPhase.Began) { // Construct a ray from the current touch coordinates Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(i).position); if (Physics.Ra...
2015/03/04
[ "https://Stackoverflow.com/questions/28867024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4220797/" ]
An attribute has its own syntax. It uses the `name=value` form for named parameters. For a normal method you can't use that form, you are stuck with the `name:value` form. It would not be possible to use the `name=value` form for normal methods. The compiler would not be able to tell if you were trying to use a named...
Despite this syntax looking like a method call: ``` [Required(ErrorMessage="Something")] ``` An Attribute is a *class*, not a method. You aren't specifying an argument in the line above, you are initializing a property. See the example on the [Attribute base class documentation](https://msdn.microsoft.com/en-us/libr...
51,848
Whats the difference between using: ``` ENTITY MyDemo is PORT(X: IN STD_LOGIC; F: OUT STD_LOGIC ); END MyDemo; ``` and ``` ENTITY MyDemo is PORT(X: IN BIT; F: OUT BIT ); END MyDemo; ``` What are the limitations of using BIT over STD\_LOGIC and vice-versa? Are they completely interchange able? I under...
2012/12/20
[ "https://electronics.stackexchange.com/questions/51848", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/1623/" ]
**`std_logic` has a resolution function** Not only does `std_logic` have more useful states besides `1` and `0`, it also has a resolution function defined. A resolution function is a VHDL language concept. It is a function that is associated to a type, and it determines what happens when multiple values of that type ...
*std\_logic* is richer than *bit*, and should basically be used most of the time. There is also the *boolean* type, which, like *bit*, has two values. It is the result type of comparisons, the type expected after an IF *[bool]* or a WHEN *[bool]*, often used for selection constants : `constant ENABLE_DEBUG_INTERFACE :...
58,534,956
i am getting an error when i trying to run the app. please help. The error in cmd is below - Error running Gradle: ProcessException: Process "C:\Flutter projects\FlatApp-Firebase-Flutter-master\android\gradlew.bat" exited abnormally: FAILURE: Build failed with an exception. * Where: Build file 'C:\Flutter projects\Fl...
2019/10/24
[ "https://Stackoverflow.com/questions/58534956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12172062/" ]
The answer from [Mahmoud Ben Hassine](https://stackoverflow.com/a/58538544/6043279) and the comments pretty much covers all aspects of the solution and is the accepted answer. Here is the implementation I used if anyone is interested : ``` public class JdbcCustomBatchSizeItemWriter<W> extends JdbcDaoSupport implemen...
I wouldn't do this. It presents issues for restartability. Instead, modify your reader to produce individual items rather than having your processor take in an object and return a list.
4,703,028
I'm trying to get futures running for Mvc3 RTM. There is no .dll included after installing mvc3 from webPI. I've downloaded the source and have tried to build it myself, but when I drop it into my solution and add the namespace to the web.config under the Views folder I get the following error on every page: ``` S001...
2011/01/16
[ "https://Stackoverflow.com/questions/4703028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/178211/" ]
It's been added to the MVC 3 RTM release now : <http://aspnet.codeplex.com/releases/view/58781#DownloadId=211128> The direct link is here : <http://aspnet.codeplex.com/releases/view/58781#DownloadId=211128>
You need to include the assembly in the web.config as well as the namespace - if you started with an mvc2 project you probably have a line in there like That will need to change to 3.0 of course, and you may also need to update the binding redirect. When you say there is no dll included, have you checked the gac? If ...
271,110
I would like to extract 2D mesh of outer surface of 3D meshed object. Let's say I have 3D mesh data from [here](https://www.dropbox.com/sh/2ogwd26rk2daogu/AADiFuYQn0EG88kIgnWmg9JCa?dl=0) and I import the data into Mathematica. ``` Needs["NDSolve`FEM`"]; SetDirectory[NotebookDirectory[]]; nodes3Dmesh = Imp...
2022/07/21
[ "https://mathematica.stackexchange.com/questions/271110", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/38112/" ]
Here's the different approach (not sure how fast it will be though). First, construct the mesh region and convert it to a boundary mesh: ``` mesh = MeshRegion[nodes3Dmesh, Hexahedron[conn3Dmesh]]; bmesh = BoundaryMesh[mesh]; ``` Compute normal vectors of polygons: ``` enormal = Chop[Region`Mesh`MeshCellNormals[bme...
Another possible approach. Use `ConvexHullMesh` to get the 7 surfaces and collect the polygons. ``` Clear[bmesh, chmesh, bmeshNormal, chmeshNormal, indexs, regs, meshs]; bmesh = BoundaryMeshRegion[mesh3D]; chmesh = ConvexHullMesh[bmesh]; bmeshNormal = Region`Mesh`MeshCellNormals[bmesh, 2]; chmeshNormal = Region`Mesh`M...
17,252,076
I am developing a feature that needs a variant of read/write lock that can allow concurrent multiple writers. Standard read/write lock allows either multiple readers or single writer to run concurrently. I need a variant that can allow multiple readers or multiple writers concurrently. So, it should never allow a read...
2013/06/22
[ "https://Stackoverflow.com/questions/17252076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/972209/" ]
The concept you are looking for is a Reentrant lock. You need to be able to try to acquire the lock and not get blocked if the lock is already taken (this is known as reentrant lock). There is a native implementation of a reentrant lock in java so I will illustrate this example in Java. (<http://docs.oracle.com/javase/...
If you are using pthreads, take a look at the synchronization approach in [this question](https://stackoverflow.com/questions/2136169/synchronization-among-2-threads-in-linux-pthreads). You could use a similar approach with two variables `readerCount` and `writerCount` and a mutex. In a reader thread you would lock th...
9,867,005
I recently read an article about `c#-5` and new & nice asynchronous programming features . I see it works greate in windows application. The question came to me is if this feature can increase ASP.Net performance? consider this two psudo code: ``` public T GetData() { var d = GetSomeData(); return d; } ``` ...
2012/03/26
[ "https://Stackoverflow.com/questions/9867005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/648723/" ]
Define 'performance'. Ultimately the application is going to be doing the same amount of work as it would have done synchronously, it's just that the calling thread in the asynchronous version will wait for the operation to complete on another, whereas in the synchronous model it's the same thread performing the task....
It would only increase performance if you needed to do multiple things, that can all be done without the need for any other information. Otherwise you may as well just do them in sequence. In terms of your example, the answer is no. The page needs to wait for each one regardless.
28,287,021
I have read somewhere that MongoDB and Redis server shouldn't be executed in the same host because the way that Redis manages the memory damages MongoDb. This is before Docker.io. But now thing seems are pretty different or not? Is is convenient running Redis server and MongoDB on two different containers on the same h...
2015/02/02
[ "https://Stackoverflow.com/questions/28287021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1055637/" ]
Would this work for you? **XSLT 1.0** ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="/SHOP"> <xsl:copy> <xsl:copy-of select="SHOPITEM[YEAR=2015...
You can nest predicates - try `//SHOPITEM[YEAR[text() = 2015]]`
49,325
I have been growing B16F10 Mouse Melanoma cells. I need to extract the genomic DNA and do PCR to amplify a specific region. However, no matter what temperature or magnesium concentration I use, I have no luck. I obtained mouse DNA from someone who was genotyping mice. I tested the PCR oligos with that DNA, and the rea...
2016/08/01
[ "https://biology.stackexchange.com/questions/49325", "https://biology.stackexchange.com", "https://biology.stackexchange.com/users/4747/" ]
Melanin is a potent inhibitor of PCR - when you use B16 cells (or any other cell line that produces melanin) you have to purify your sample from it. Unfortunately a simple Phenol-Chloroform extraction or an ethanol precipation won't do the magic, since melanin co-precipitates with the nucleic acids. I recommend follow...
There are many suggestions how to avoid melanin-caused PCR inhibition. Some we have found helpfull (like using smaller amount of DNA sample + increasing number of cycles or adding BSA to PCR reaction), other (like trying different DNA isolation and PCR kits, purification columns etc.) are good only for profits of biote...
253,361
Resources in MGS 5 shared between offline and online mode and most of resources are stored online. However offline funds spent first and dip into negative values. Andswer on [How does Mother Base staff morale work?](https://gaming.stackexchange.com/a/234256/20757) states that negative GMP values hurt morale. Will mor...
2016/01/27
[ "https://gaming.stackexchange.com/questions/253361", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/20757/" ]
The online resources can be viewed as a sort of "savings fund". It seems that you are given a set amount that you can keep offline at a time and once this set amount drops to zero it will transfer more to you the next time you connect to the servers or hit checkpoints in or between missions. So when your offline res...
If the servers need maintenance before you can get resources transferred you're boned unless you sell some stuff at mother base or whatever.
48,772,621
I have opencv-python installed and the .pyd file is added in the site-packages and the DLLs. The code works with images. When I want to read, show, write an image it works. But I get a warning that the functions' references cannot be found in **init**.py . Due to this, I can not use the auto-complete feature. Could som...
2018/02/13
[ "https://Stackoverflow.com/questions/48772621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7515891/" ]
The problem is caused by CV2 and how `__init__.py` does the imports. Just ignore the warnings the program will work all the same, or you can do an import with an alias like: ```py import cv2.cv2 as cv2 ``` If you have a warning on it press `Alt`+`Enter` to install and fix it. Now you will have the [code completion](...
I was using Python 3.10.2288.0 and OpenCV 1.6.0.66. I resolved the issue by rolling back the OpenCV version to 4.5.5.62.
18,889,494
I'm looking to create a new contact form for asking an offer on a Magento Eshop. This "**Ask for an Offer**" form will provide the option to a visitor to fill some fields and just sent an email exactly like the default **contact form** does. The only difference with the default contact form is that the visitor doesn...
2013/09/19
[ "https://Stackoverflow.com/questions/18889494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2567702/" ]
You have to create separate module for this. I have also create and sharing code here. Form submitting is by ajax. May be I have missed something to remove or renaming. try to correct it. app\etc\modules\namespace\_modulename.xml ``` <Namespace_Modulename> <active>true</active> <codePool>local</codePo...
you can use below documentation Custom Module with Custom Database Table <http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/custom_module_with_custom_database_table> Front-End Editor Extension for Magento Commerce <http://www.youtube.com/watch?v=ALgdsMCVuH4> please s...
12,571,852
I have a textbox, where i want the written text to be added to a UIImage. How can i draw NSString to a UIImage? I´ve searched, and found lots of examples, but non of them works. Xcode just gives me lots of errors. Simply put, i want to draw a NSString to a UIimage. The UIImage should be the same size as a predefined...
2012/09/24
[ "https://Stackoverflow.com/questions/12571852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1686319/" ]
UIImage is not a subview of UIView, so you cant add a subview to it. Also NSString is not a subview of UIView. If you want to show things on the screen, they should inherit from UIView. So try this: Create a UIImageView - set its image property to be your UIImage instance. Create a UILabel - set its text property to...
Emm, here is some thoughts. I think that one simple way is like this : 1. Put aUIImageView on aView; 2. Add aUITextView on aView; 3. Get ScreenShot from aView; This may works fine. Also, this may come with a problem that screenshot may be not clear. Then, After step1 and step2, we may get new image by UIGraphics. (W...
9,094
I have a requirment to have users be able to select button colors, I want that according to the background color they select, an appropriate, contrasted button text color will be determined automatically. for that - I need some sort of formula, and I was wondering if anyone knows what such formula might be, I looked a...
2012/08/22
[ "https://graphicdesign.stackexchange.com/questions/9094", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/2282/" ]
OK, I finally got around to looking at the [example image](https://i.stack.imgur.com/c4m02.png), and the trick is pretty simple: gamma correction. As others have noted, the image is composed of two interleaved pictures: out of every 2 × 2 pixel block, three pixels have RGB values in the range 0 to 210, and show the "r...
The image is two images interlaced. Interlacing is, very basically, where two images are displayed simultaneously by showing a single line (or pixel) of each one in an alternating pattern. Usually one finds this in TV and video broadcasting since the frame rates mask the interlacing effect. If one were to take this i...
17,367,192
I have this snippet of code and want to know if exist way to make it much more readable? My code: ``` public String getMonthName() { if (1 == this.monthNumber) { monthName = "January"; } else if (2 == this.monthNumber) { monthName = "February"; } else if (3 == this.monthNumber) { ...
2013/06/28
[ "https://Stackoverflow.com/questions/17367192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1498427/" ]
You should use the `Calendar` class, it was provided to save you from all this extra branching. You also won't have to determine if it is a Leap Year, the API will take of that for you. ``` final String[] months = new String[]{ "January", "February", ... }; public String getMonthName() { return months[Calendar.ge...
``` String[] months = String[] {"Jan", "Feb", ... , "Dec"}; String monthName = months[monthNumber - 1]; ```
10,186
I'm thinking about the basic types of convergence for sequences of functions: convergence in measure, almost uniform convergence, convergence in Lp and point wise almost everywhere convergence. I'm looking for examples of sequences of functions that converge in one or more of these ways, but fail for others. I keep see...
2009/12/30
[ "https://mathoverflow.net/questions/10186", "https://mathoverflow.net", "https://mathoverflow.net/users/2907/" ]
When it comes to complex analytic functions on open subsets of $\mathbb{C}$, it is hard to come up with examples of pointwise convergent sequences that do not converge uniformly on compact sets. That is partly because it doesn't take much for a family of analytic functions to be normal. There is much more to be said ab...
On $[0,1]$: $ f\_n = a\_n\chi\_{[\alpha n,\alpha n + \varepsilon n^{-2}]\ {\rm mod}\ 1 } $ with $\alpha$ irrational, and $a\_n = 1 $ or $ a\_n = n^2 $. This is, of course, also similar ... Transferred from my comments below, and corrected (TeX was not shown, so I did not see that some of the code did not work): Well...
12,878,012
I have a singleton class: ``` public class Singleton { private static Singleton istance = null; private Singleton() {} public synchronized static Singleton getSingleton() { if (istance == null) istance = new Singleton(); return istance; } public void work(){ ...
2012/10/13
[ "https://Stackoverflow.com/questions/12878012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1245466/" ]
As @amit stated in a comment your `getSingleton()` method should be `synchronized`. The reason for this is that it is possible for multiple threads to ask for an instance at the same time and the first thread will still be initializing the object and the reference will be null when the next thread checks. This will res...
You can use Locks around the shared resources. Use the `Reentrant` class. It prevents race conditions for multiple threads.
111,231
I think my question says it all. I want to do a full server backup of the entire machine (Windows Server 2008) using the OS's built in "Windows Server Backup". My server runs the SQL for Sharepoint and is also the domain controller. Do I need to stop Sharepoint Services first?
2014/08/07
[ "https://sharepoint.stackexchange.com/questions/111231", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/7452/" ]
Have you tried: ``` $("select [title='Option']".on('change', function(){ alert("yes"); }); ```
Try placing your code in "content place holder main" in editform.aspx
19,010
Were the Pharisees being sarcastic in John 7:52, when they claimed that "no prophet ever came out of Galilee"? It is written that Jonah came from Gath-hepher, in Galilee (2 Kings 14:25).
2013/09/12
[ "https://christianity.stackexchange.com/questions/19010", "https://christianity.stackexchange.com", "https://christianity.stackexchange.com/users/5525/" ]
Many commentators have enjoyed pointing out the Pharisees' mistake, which is just one of several errors they make in this chapter. A "pure" sarcasm would mean that the Pharisees considered Galilee to be *the* place where prophets came from - a bit like associating Washington, DC with politicians. But the context is th...
Their question is not just about whether a prophet *can* come from Galilee, but verse 42 gives more info about their reason for doubting Galilee as the source of the 'Christ'. The Christ should come from David's line and from Bethlehem (prophecy from [Micah 5:2](https://www.biblegateway.com/passage/?search=Micah%205%3A...
9,949,302
I have programmed a UIImageView that allows me to draw inside of it. It therefore tracks the users touches and records it. When used in a window it works great. However, I have then added it as a subView of a UIScrollView which resides in a View Controller. When I try and use it now, the touch gestures inside of the U...
2012/03/30
[ "https://Stackoverflow.com/questions/9949302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1190768/" ]
Set the `exclusiveTouch` property of the UIImageView to `YES` (This means that, when the UIImageView is touched, that touch will not have effects on any other views)
How do you want the app to decide whether a touch is supposed to scroll the scroll view or draw in the image view? Let's say you want one finger to draw and two fingers to scroll. If you're targetting iOS 5.0, it's easy: ``` self.scrollView.panGestureRecognizer.minimumNumberOfTouches = 2; ``` If you're targetting a...
3,137,674
This is a followup to: [MySQL - Is it possible to get all sub-items in a hierarchy?](https://stackoverflow.com/questions/3073614/mysql-is-it-possible-to-get-all-sub-items-in-a-hierarchy) I have an arbitrary-depth **adjacency list model** table (I am at the point that I *can* convert it into a **nested set model**. ...
2010/06/29
[ "https://Stackoverflow.com/questions/3137674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/344769/" ]
I would always go with the **Nested Set** for shear simplicity and convienience. I always suggest [this article](http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/). It shows excelent the queries that are needed for the work with such hierachrchical data. The only disadvantage I see here is that it ca...
I once had to store a complex hierarchical arbitrary-depth bill-of-material system in a SQL-like database manager that wasn't really up to the task, and it ended up forcing messy and tricky indicies, data definitions, queries, etc. After restarting from scratch, using the db manager to provide only an API for record re...
31,005,242
I have this code ```js $('#fancybox-wrap .caption').appendTo('#fancybox-outer #fancybox-content'); ``` ```html <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <div id="fancybox-wrap"> <div id="fancybox-outer"> <div id="fancybox-content"></div> </div> <...
2015/06/23
[ "https://Stackoverflow.com/questions/31005242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4875059/" ]
By writing it in [TryRoslyn](http://goo.gl/dmuV2i) it becomes quite evident that there is a difference based on where you put the property in the interface: Given: ``` interface ISub1A: IBaseA { int Prop3 { get; set; } } interface IBaseA { int Prop1 { get; set; } string Prop2 { get; set; } } interface I...
First, you should hide `ISub2.Prop2` by [implementing it explicitly](https://msdn.microsoft.com/en-us/library/ms173157.aspx). Then, depending on why `ISub2` should not contain `Prop2`, you should either deprecate that implementation using the [ObsoleteAttribute](https://msdn.microsoft.com/en-us/library/system.obsoletea...
34,627,561
I am adding posts in database and against each post there will be an image. For example there is a product table and against each product I've its id, quanitity and price. Now I store image like this in ``` if ( isset($_POST["uploadimg"]) ) { $file_name =$_FILES["image"]["name"]; $file_type=$_FILES["image"][...
2016/01/06
[ "https://Stackoverflow.com/questions/34627561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1760937/" ]
Remove all your subviews before adding a new one as below ``` NSArray *viewsToRemove = [self.view subviews]; for (UIView *v in viewsToRemove) { [v removeFromSuperview]; } ``` Above code should add before this below line, ``` [self.viewReview addSubview:titleLabel]; [self.viewReview addSubview:reviewLabel]; ...
ok - first create the arrays for your titles as members of your view controller ``` NSMutableArray *titleLabels = [NSMutableArray array]; NSMutableArray *reviewLabels = [NSMutableArray array]; ``` and then update your function to look more like this ``` for(int i = 0;i <= titleArray.count-1;i = i + 1){ _...
7,648,515
I'm trying to consume a WCF 4.0 service in my application. I built, tested, and deployed the service from the ground up. The service works in the WCF test client and can be consumed in any other test project I built. The problem is this one particular application... the only one that matters as it's the reason I built ...
2011/10/04
[ "https://Stackoverflow.com/questions/7648515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/978467/" ]
This one took me a while. Turned out, that `"The type name 'AAA' does not exist in the type 'YYY.YYY' "` was caused by the YYY.YYY - my consuming class sharing name with its containing namespace. Solution: rename the consuming class to something that is not equal to the full name of its namespace, i.e. `YYY.XXX`.
I have another issue. Imagine two projects with different namespaces and following classes Project 1 ``` [DataContract(Namespace="SomeNamespace")] public class A { [DataMember] public class B { get; set; } } ``` Project 2 ``` // Here no DataContract attribute public class B { //... } ``` In this case yo...
43,450
I've playing around with the google maps api and am puzzled at the following behavior. If I use `mPoint` as the LatLng for my marker, the marker is rendered on a different point on the map as opposed to putting the same value directly into the properties of the marker. Code chunk is as follows: ``` var mPoint ...
2012/12/07
[ "https://gis.stackexchange.com/questions/43450", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/8964/" ]
In your code: ``` var mPoint = [new google.maps.LatLng(38.991300,-76.936165)]; ``` You define an array as mPoint. And it absolutely makes no sense to pass this array to the marker object that you are creating since the position attribute expects a latlng object and not an array as argument. In your case `var marker...
Google Maps Marker Example (with drop/drag animation) reference: <https://developers.google.com/maps/documentation/javascript/examples/> ``` <script> var mPoint = new google.maps.LatLng(38.991300,-76.936165); var marker; var map; function initialize() { var mapOptions = { zoom: 13, mapTypeId: ...
3,465,465
In Java, the [`throws`](http://download.oracle.com/javase/tutorial/essential/exceptions/declaring.html) keyword allows for a method to declare that it will not handle an exception on its own, but rather throw it to the calling method. Is there a similar keyword/attribute in C#? If there is no equivalent, how can you ...
2010/08/12
[ "https://Stackoverflow.com/questions/3465465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/385387/" ]
The op is asking about the **C# equivalent of Java's [`throws` clause](http://java.sun.com/docs/books/jls/third_edition/html/classes.html#41401)** - not the `throw` keyword. This is used in method signatures in Java to indicate a checked exception can be thrown. In C#, there is no direct equivalent of a Java checked e...
Yes this is an old thread, however I frequently find old threads when I am googling answers so I figured I would add something useful that I have found. If you are using Visual Studio 2012 there is a built in tool that can be used to allow for an IDE level "throws" equivalent. If you use [XML Documentation Comments](...
158,668
Daily we have to fill timesheets and details on the project/task we have worked on upto hour level. Somedays I don't have any task that have been assigned to me. I have asked to my manager to assign task and he said ok he will do it. But it sometimes takes hours or he assigns the task next day or tells someone else to ...
2020/05/28
[ "https://workplace.stackexchange.com/questions/158668", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/43528/" ]
Some companies are struggling with a dissonance between theory and practice. In theory, all hours on the timesheet must be billable, either on an external or an internal customer. But in practice, they just don't have enough billable tasks for everyone. How is that problem solved in practice? * In some organizations...
Ask your manager directly. Ask what you should be doing between tasks and where to log that time. As a developer, you could be helping others in chat or via calls, reviewing code, answering emails. As a BA, you could be looking into project documentation to better understand what you are working on. Watching internal p...
18,822,890
Question: How do I go about setting the ActionListener of my Shuffle button to do just what the button declares it does, and that is, to shuffle the 3 cards (out of 54 in an image folder) displayed on the screen? They appear randomly each time I run the program, and that's fine and all, but I'm needing to add a shuffle...
2013/09/16
[ "https://Stackoverflow.com/questions/18822890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770639/" ]
I suggest you to parse the HTML code ([How do you parse and process HTML/XML in PHP?](https://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php)), then extract the domains from the appropriate attributes. For example: ``` <?php function getDomainFromEmbed($html, $all = false) { $res...
Try this code: ``` function getDomain($html) { preg_match('`<[^>]*src=["\'\s]?([^"^\'^\s]+)["\'\s][^>]*>`i', $html, $matches); if(isset($matches[1])) return parse_url($matches[1], PHP_URL_HOST); return false; } $html = '<iframe src="http://www.websites-test.com/video231/" frameborder=0 width=510...
23,491,377
How can I do that. This is the scenario: firstTextbox value: "firstString" secondTextbox value: "/secondString" Result I want to recive: secondTextbox value: "firstString/secondString" I've tried this solution: ``` <input id="A"> <input id="B"> A.onblur = function() { B.value = this.value; }; ``` But it only r...
2014/05/06
[ "https://Stackoverflow.com/questions/23491377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3228992/" ]
This can even be done using HTML5 **[output tag](http://www.w3schools.com/tags/tag_output.asp)** `***[js Fiddle](http://jsfiddle.net/wLy4E/)***` *HTML* ``` <form oninput="x.value=a.value + b.value"> <input type="text" id="a" value="" /> <input type="text" id="b" value="" /> <output name="x" for="a b"...
The code snippet looks so childish but if this is how you need it, then the possible solution may be out here <http://jsfiddle.net/e8vBj> . HTML: ``` <input type="text" id="t1"/> <input type="text" id="t2"/> <br/> <br/> <input type="text" id="t3"/> ``` JS: ``` $('#t1,#t2').blur(function(){ var t1 = $('#t1...
46,870,479
I want to convert String variable 'true' or 'false' to int '1' or '0'. To achieve this I'm trying like this ``` (int) (boolean) 'true' //gives 1 (int) (boolean) 'false' //gives 1 but i need 0 here ``` I now I can using array like `array('false','true');` or using `if($myboolean=='true'){$int=1;}` But this way is l...
2017/10/22
[ "https://Stackoverflow.com/questions/46870479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7228341/" ]
Strings always evaluate to boolean true unless they have a value that's considered "empty" by PHP. Depending on your needs, you should consider using filter\_var() with the FILTER\_VALIDATE\_BOOLEAN flag. ``` (int)filter_var('true', FILTER_VALIDATE_BOOLEAN); (int)filter_var('false', FILTER_VALIDATE_BOOLEAN); ```
``` $variable = true; if ($variable) { $convert = 1; } else { $convert = 0; } echo $convert ```
5,127,166
So, I am trying to make floated divs to hide in parent's div, but it isn't working... My code: css: ``` div.scrollarea { overflow: scroll; width: 400px; float: left; } div.td { float: left; width: 100px; he...
2011/02/26
[ "https://Stackoverflow.com/questions/5127166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/635538/" ]
Do you have the ability to install software on the computer you wish to run the executable on? If so, you can create an Adobe AIR application that launches your file. Have the user install that AIR app on their computer. Next, create a small flash widget to sit on your web page. Have the flash widget invoke the AIR ap...
I do it by linking to a .bat file that runs the .exe itself.
9,368,904
I have a webpage where I have a header section and then some content. In the content, I have a grid and some of the views show many columns which (depending on the screen size) will create a horizontal scroll bar on the browser) my html looks like sort of like this: ``` <head></head> <body> <div id="TopHeader...
2012/02/20
[ "https://Stackoverflow.com/questions/9368904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
As others have pointed out, you're looking for `exists`. Keep in mind that using `exists` with names used by R's base packages would return true regardless of whether you defined the variable: ``` > exists("data") [1] TRUE ``` To get around this (as pointed out by Bazz; see `?exists`), use the `inherits` argument: ...
If you don't mind using quotes, you can use: > > exists("x") > > > If you don't want to use quotes you can use: > > exists(deparse(substitute(x))) > > >
32,333,902
Trying to capture an image from webcam and wanted save on a drive Using Grails 2.3.7 **script code** ``` var video = document.querySelector("#videoElement"); var imageW; //check for getUserMedia support navigator.getUserMedia = navigator.getUserMedia || naviga...
2015/09/01
[ "https://Stackoverflow.com/questions/32333902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2446714/" ]
This example sure helpful ``` export default class Setup extends Component { _onPressButton() { Alert.alert('You tapped the button!') } render() { return ( <View style={styles.container}> <View> <Text h1>Login</Text> </View> <View> <Button onPress={t...
You have to use the ES6 way of doing a function or it will not work, specially for higher version such as 0.59. The code below should work, when calling functions within class. You have got it right for calling the function by using this.\_onRegionChangeComplete, ``` constructor(props) { super(props); this.st...
27,610,404
I am developing a Quiz game. I know about sqlite database creation and the use of DBhandler etc.. but, the problem is that I could not find how to **create a database file in assets folder** in my android project. Kindly help me. Thanks in advance
2014/12/22
[ "https://Stackoverflow.com/questions/27610404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3969131/" ]
Found the problem. when I did this: ``` echo strlen($hash) ``` it printed 90, which is strange because there were definitely no spaces at the end when I printed out the success/failure message, and the field has a varchar length of 255 I added this line: ``` $hash = substr( $hash, 0, 60 ); ``` And now it works f...
I had the same issue and it was still not working despite ensuring my database columns were varchar(255), that the hashes were 60 characters, and ensuring my encoding was UTF-8 all the way through. I'm pretty new to PHP and SQL so I won't pretend to understand exactly why it worked, but I managed to fix it so I hope th...
29,893,631
I successfully imported following file in database but my import method removes double quotes during saving process. but i want to export this file as it is , i.e add quotes to a string which contains delimiter so how to achieve this . **here is my csv file with headers and 1 record.** ``` PTNAME,REGNO/ID,BLOOD GRP,W...
2015/04/27
[ "https://Stackoverflow.com/questions/29893631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4696835/" ]
You can rely on base R structures and consider following approach based on building the hclust trees by yourself. ``` mtscaled = as.matrix(scale(mtcars)) row_order = hclust(dist(mtscaled))$order column_order = hclust(dist(t(mtscaled)))$order heatmap(mtscaled[row_order,column_order], Colv=NA, Rowv=NA, scale="none") ``...
Do the dendrogram twice using the basic R heatmap function. Take the output of the first run, which clusters but has mandatory drawing of the dendrogram and feed it into the heatmap function again. This time, without clustering, and without drawing the dendrogram. #generate a random symmetrical matrix with a little bi...
67,813,167
I have the following document structure ``` { "_id": "60b7b7c784bd6c2a1ca57f29", "user": "607c58578bac8c21acfeeae1", "exercises": [ { "executed_reps": [8,7], "_id": "60b7b7c784bd6c2a1ca57f2a", "exercise_name...
2021/06/02
[ "https://Stackoverflow.com/questions/67813167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6224201/" ]
So let's start with: ``` $ docker run --rm -it php:7.4-alpine -r 'var_dump($l = new Locale("en_CA"));' Fatal error: Uncaught Error: Class 'Locale' not found in Command line code:1 Stack trace: #0 {main} thrown in Command line code on line 1 ``` Yep, that tracks. So then: ``` FROM php:7.4-alpine RUN apk add icu-d...
Thank you @Ovinz Just adding to my Dockerfile ``` RUN apk add --no-cache icu-libs RUN apk add --no-cache icu-data-full ``` And everything goes well (twig intl in my case)
40,626,410
Trying to execute in SQLAssitant (v 15.x Teradata): ``` WITH TEMP1 (EMP_ID,E_NAME,E_SAL) AS (WITH TEMP (EMP_ID,E_NAME,E_SAL) AS (SELECT EMP_ID,E_NAME,E_SAL FROM EMP_TABLE_TEST) SELECT EMP_ID,E_NAME,E_SAL FROM TEMP) SELECT EMP_ID,E_NAME,E_SAL FROM TEMP1 ``` Error: SELECT Failed. 6926: definitions, views, triggers o...
2016/11/16
[ "https://Stackoverflow.com/questions/40626410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6518278/" ]
The syntax is different (and is the same as in other databases) `With t1 as (...),t2 as (...), t3 as (...) select ...` --- Currently the reference order is upside-down - t2 can refer t3 and t1 can refer t2 and t3. The "right" order will be supported in TD16.
This has been fixed in Teradata 16. Please see the release summary chapter 2. <http://www.info.teradata.com/doclist.cfm?RetainParams=Y&FilterCall=Y&selDocType=100> > > Previously, when a nonrecursive WITH clause defined multiple CTEs, a CTE could only reference a > subsequent CTE in the WITH clause. Now, a CTE can ...
8,277,979
As per the instructions here: <http://developer.apple.com/library/mac/#documentation/MusicAudio/Conceptual/CoreAudioOverview/WhatisCoreAudio/WhatisCoreAudio.html#//apple_ref/doc/uid/TP40003577-CH3-SW1> It says: The Core Audio SDK assumes you will use Xcode as your development environment. You can download the latest S...
2011/11/26
[ "https://Stackoverflow.com/questions/8277979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129089/" ]
The documentation is out of date. Core Audio SDK is included with current Xcode 4.2. You need to link to it like this: ![enter image description here](https://i.stack.imgur.com/ObsLF.jpg) and of course include its header file.
It seems the CoreAudio SDK was renamed Core Audio Utility Classes, and can be found there: <http://developer.apple.com/library/mac/#samplecode/CoreAudioUtilityClasses/Introduction/Intro.html>
6,189,522
Backbone configure url once for all when a Collection is created. Is there a way to change this url later? The following sample shows 2 POST at `/product` and 2 `POST` at `/product/id/stock`. The last `POST` won't work, Backbone concatenate the id and try to `PUT` it, but I don't know why. ``` products.create({ name:...
2011/05/31
[ "https://Stackoverflow.com/questions/6189522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/535184/" ]
Backbone.js will use the url of the model when saving existing models. Its not quite clear what you are trying to do -- I don't know what stocks is, for instance. Anyway, your code probably needs to look similar to the below and you should not be dynamically changing the url: ``` Product = Backbone.Model.extend({ ...
I have run into what is essentially the same problem. It seems that Backbone's pattern is to lock down relative URI's in models and collections and allow the framework to use these to build final the final URI for a given resource. This is great for Restful URI's templates that don't change. But in a pure RESTful servi...
34,614,579
I'm trying to implement an AngularJS directive which has it own isolated scope in order to make it reusable in the same page. This directive is described by a template which is in another file so I use the templateUrl option. ``` app.directive('inputSettings', function () { return { restrict: 'E', ...
2016/01/05
[ "https://Stackoverflow.com/questions/34614579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3511736/" ]
Generally in a directive , to set the validity of a element we require ngModel for the directive and then we try to set the $validity of the element using the ngModelController
Use $rootScope. It`s global. It contains all $scopeS.. Like ``` $rootScope.data = data; $scope.data = $rootScope.data ```
242,713
Make a program that outputs a sequence of integers so that every finite sequence of positive integers is a substring (continuous subsequence) of the output. For example, the following sequence satisfies the rules: `1,1,1,2,1,1,1,1,2,2,1,3,1,1,1,1,1,1,2,1,2,1,1,3,2,1,1,3,1,4,...` To see the underlying pattern, let's ...
2022/02/11
[ "https://codegolf.stackexchange.com/questions/242713", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/84290/" ]
[Haskell](https://www.haskell.org/), 39 bytes ============================================= ```hs do y<-[1..];q<-mapM id$[1..y]<$[1..y];q ``` [Try it online!](https://tio.run/##y0gszk7Nyfn/P902JV@h0kY32lBPL9a60EY3N7HAVyEzRQUkUBlrA6WtC//nJmbm2RYUZeaVqJQkZqcqGBoAgYKKQvp/AA "Haskell – Try It Online") Start with the po...
[Pari/GP](http://pari.math.u-bordeaux.fr/), 39 bytes ==================================================== ``` for(i=1,oo,[print(p[2])|p<-factor(i)~]) ``` [Try it online!](https://tio.run/##K0gsytRNL/j/Py2/SCPT1lAnP18nuqAoM69EoyDaKFazpsBGNy0xuQQkq1kXq/n/PwA "Pari/GP – Try It Online") A port of [@Command Master's 05A...
16,442,565
So, I load a file at the start of a form. I have "Save button" in that form.When I click it, I want to overwrite the file with richtextbox.Savefile method. but I get "Access to path.. is denied" I checked and got this: 1. Permissions for current user are all granted 2. The debug folder has "Read-Only" -- tried to re...
2013/05/08
[ "https://Stackoverflow.com/questions/16442565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1789415/" ]
Just a minor problem with your code my friend, you just need to add only one following line to your code, forget to `setUserInteractionEnabled:NO` to `UIView` it will allow you to click the button ``` UILabel *lbl1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)]; [lbl1 setText:@"ONe"]; UILabel *lbl2 = [[UI...
**Swift 4.2 Solution** This is the solution of the problem (based on previous answers) with the last version of Swift: ``` func customButton() { // Label Creation let firstLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 30)) firstLabel.text = "first" let secondLabel = UILabel(frame: CG...
16,721,157
I have this map, as an answer of [this other question](https://stackoverflow.com/q/16346000/1546946). It uses geocodezip and works well, but it is not working in Internet Explorer. Can you suggest me any solution? This is the link of the map: <http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmltest_linktoB.html?file...
2013/05/23
[ "https://Stackoverflow.com/questions/16721157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1546946/" ]
Your rewrite rules have two major problems: * the order of them matters. Right now, your second and third will never match stuff * two of them could be simplified into one. Consider using this: ``` RewriteEngine on RewriteBase /ansjc # Remove file extension RewriteRule images/album_id/(.+)/?$ images.php?album_id...
Use this code ``` RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]*)$ $1.php [NC,L] RewriteRule ^images/(.*)$ images.php?album_id=$1 [L] ``` and try ``` http://localhost/images http://localhost/images/ http://localhost/images/album_id ``` it will call ...
18,832
`:scriptnames` outputs a (not convenient) list with more at the bottom. I'd like to have all the output in a buffer so i can search, edit ... How do i do that?
2019/02/08
[ "https://vi.stackexchange.com/questions/18832", "https://vi.stackexchange.com", "https://vi.stackexchange.com/users/19908/" ]
You can also directly paste it into the current buffer using ``` :put =execute(':scriptnames') ```
You could redirect the output to a register like: ``` :redir @a | silent scriptnames | redir END ``` And then past the content of the register wherever you want with `"ap`. The `silent` is used here, to prevent a "-- More --" prompt. You could also redirect to file or a script variable. See `:help :redir`.
30,619,221
i am having the value in column Description , 'TRANSPORT' , in that particular table the same value has two times, i need to make it as a single value , in that i am using group by . but its not assigning. my query ``` SELECT CONVERT(date, UC.USGDATE) as USGDATE, SG.DESCRIPTION, SG.SERVICEGRP FROM APP_SYUTILITYCH...
2015/06/03
[ "https://Stackoverflow.com/questions/30619221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3643560/" ]
Updated details following release of .Net Core 1.0.0 startup.cs ``` public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(config => { // Add XML Content Negotiation config.RespectBrowserAcceptHeader = true; config.InputFormatters.Ad...
Updated answer for ASP.NET Core 1.1: Startup.cs: ```cs public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(config => { config.RespectBrowserAcceptHeader = true; config.InputFormatters.Add(new XmlSerializerInputFormatter()); config.Out...
94,226
I have 4 versions of file A.txt in my subversion repository, say: A.txt.r1, A.txt.r2, A.txt.r3 and A.txt.r4. My working copy of the file is r4 and I want to switch back to r2. I don't want to use "*svn update -r 2 A.txt*" because this will delete all the revisions after r2, namely r3 and r4. So is there any way that ...
2008/09/18
[ "https://Stackoverflow.com/questions/94226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8203/" ]
The command `svn up -r 4` only updates your *local* copy to revision 4. The server still has all versions 1 through to whatever. What you want to do, is create a *new* revision, revision number 5, which is identical to revision number 2. ``` cd /repo svn up -r 2 cp /repo/file /tmp/file_2 svn up -r 4 cp /tmp/f...
> > "I don't want to use "svn update -r 2 A.txt" because this will delete all the revisions after r2, namely r3 and r4." > > > Uh... it won't, actually. Try it: do a regular svn update after the -r 2 one and you'll see the working copy updated back to r4.
19,767,917
In Asp.net Entity Framework I need to forward to another page and pass some data processed by the second page along. In PHP I could do something like ``` <!-- page1.php --> <form action="page2.php" method="POST"> <input type="hidden" name="id" /> <input type="submit" value="Go to page 2" /> </form> <!-- page...
2013/11/04
[ "https://Stackoverflow.com/questions/19767917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2558051/" ]
There are, at least, two options: 1. Session state, like this: Putting data into `Session` (your first page) ``` Session["Id"] = HiddenFieldId.Value; ``` Getting data out of `Session` (your second page) ``` // First check to see if value is still in session cache if(Session["Id"] != null) { int id = Convert.T...
There's a lot of ways to do this, take a look at [`this link`](http://msdn.microsoft.com/en-us/library/6c3yckfw%28v=vs.100%29.aspx) for some guidance. HTML page: ``` <form method="post" action="Page2.aspx" id="form1" name="form1"> <input id="id" name="id" type="hidden" value='test' /> <input type="submit" va...
19,970,611
I want to select first 4 letters of the address string ignoring the numbers or P.O. box. For example, I have a database column "address" in "customers" table. ``` 51 church st ``` In a query, I only want "chur" ignoring the numbers. It can be any number. I am not interested in number. Also, I don't want this for ...
2013/11/14
[ "https://Stackoverflow.com/questions/19970611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2990687/" ]
Many correct answers here already, but since the OP still seems a little confused, I'd like to make this point as simple and clear as possible: You should use `Nullable<something>` with a `something` that can not, on it's own, have a value of `Null`. Take `DateTime` for example - it has a default value of `DateTime.Mi...
`decimal` is a ValueType. `string` is a Class. Null cannot be assigned to variables that are ValueTypes unless you wrap them in `Nullable<>`. Null can already be assigned to variables that are classes like `string`.
7,943,220
I am using ar.h for the defining the struct. I was wondering on how I would go about getting information about a file and putting it into those specified variables in the struct. ``` struct ar_hdr { char ar_name[16]; /* name of this member */ char ar_date[12]; /* file mtime */ char ar_uid[6]; ...
2011/10/30
[ "https://Stackoverflow.com/questions/7943220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/988728/" ]
You're looking for [`stat(2,3p)`](http://linux.die.net/man/2/stat).
For collecting data about a single file into an archive header entry, the primary answer is [`stat()`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatat.html); in other contexts (such as `ls -la`), you might also need to use `lstat()` and [`readlink()`](http://pubs.opengroup.org/onlinepubs/9699919799/fu...