qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
26,559,840
I'm using Visual Studio 2010 and SQL Server 2012. When I try to connect to SQL Server through Visual Studio, I don't get my server name on Add connection drop down menu.
2014/10/25
[ "https://Stackoverflow.com/questions/26559840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3786234/" ]
Insert machine\_name/SqlServerName
For people using sql server 2014+ and using the local db on your pc. simply set the server name to be (localdb)\ name of your database. It worked for me.
26,559,840
I'm using Visual Studio 2010 and SQL Server 2012. When I try to connect to SQL Server through Visual Studio, I don't get my server name on Add connection drop down menu.
2014/10/25
[ "https://Stackoverflow.com/questions/26559840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3786234/" ]
run services.msc find " SQL server browser " , it might be disabled , start that service and set it to automatic.
For people using sql server 2014+ and using the local db on your pc. simply set the server name to be (localdb)\ name of your database. It worked for me.
210,285
I'm using KiCAD to create a nested series of PCB rings - each two layer with copper fill on the front and back. The problem is when I add edge cuts defining the inner and outer edges of the outer ring, it removes the copper fill from the center area where I'm going to nest the inner ring. Is there a way to add a nested copper fill area within the inside diameter of the outer ring and still maintain the edge clearance of the copper fill that the fab requires (ie, using the edge cuts layer, KiCAD automatically create a standoff so the copper doesn't go all the way to the edge of the cut, thus avoiding possible shorts).
2016/01/08
[ "https://electronics.stackexchange.com/questions/210285", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/49821/" ]
KiCAD is an interesting animal - its a series of separate applications (Eeschema, Pcbnew, etc) that are launched and loosely integrated through a project management executable called KiCAD. When KiCAD launches these executables, it hides some of their built-in features. One of these features is within Pcbnew - the ability to append other PCB files to another PCB file. If you launch the Pcbnew executable manually, you can create a new PCB file and append (file-menu Append menu item) other PCB files to it. In this way, you can create panelized PCB designs or in my case, create a nested ring design where the individual nested PCB's are electrically isolated.
KiCad only supports one board per file. Optimal use of available space is up to the manufacturing house, they can tell whether it is possible to place small boards inside larger ones, because they know the size of the router head they use to separate the boards. The alternative is to connect the boards, and define V-Grooves to separate the boards later. This could be more expensive to fabricate though, and concerns about the router head side still apply. For this, your board outline should be a single line, and the board should be connected still.
336,474
When I try to delete all files from two or more subdirectories in `zsh`, and a directory is already empty, the following directories are ignored, and files remain. Example: ``` $ mkdir dir1 $ mkdir dir2 $ touch dir2/blah # avoid the zsh safety prompt; this may not be necessary for this # example, just for ease of use here $ setopt rm_star_silent $ rm -r dir1/* dir2/* zsh: no matches found: dir1/* $ ls dir2 blah ``` In bash, the already empty directory does not stop `rm` from proceeding to `dir2`, and `dir2/blah` is removed. What is this `zsh` feature, and is there a way to let `rm` behave like in `bash`?
2017/01/11
[ "https://unix.stackexchange.com/questions/336474", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/-1/" ]
Unlike `bash`, `zsh` by default reports an error in case a filename generation pattern has no matches. This behavior can be changed globally or on a per-pattern basis. To prevent error messages from non-matching pattern globally, you can set either of the options `NULL_GLOB` or `CSH_NULL_GLOB`: * ``` setopt nullglob ``` If a pattern has no matches it will be removed from the argument list. No error message will be printed. In your example ``` rm dir1/* dir2/* ``` would be just expanded to ``` rm dir2/blah ``` * ``` setopt cshnullglob ``` Also removes non-matching patterns and does not print an error message, unless none of the patterns have a match. To prevent error messages for single patterns, you can use the glob qualifier `N`, which behaves as if the `NULL_GLOB` option was activated for this pattern: ``` rm dir1/*(N) dir2/*(N) ``` This also would be expanded to ``` rm dir2/blah ```
A good explanation can be found here: <https://superuser.com/questions/584249/using-wildcards-in-commands-with-zsh> The gist is: ``` By default, ZSH will generate the filenames and throw an error before executing the command if it founds no matches. ``` Your empty directory is going to generate no matches and thus an error. As the answer indicates, you can either: 1. Enclose the argument in quotes (e.g. `rm -r "dir1/*" "dir2/*"`) OR 2. Setting `unsetopt nomatch` in your `.zshrc` file OR 3. Prefacing you can command with the `noglob` environment variable (e.g. `noglob rm -r dir1/* dir2/*`)
336,474
When I try to delete all files from two or more subdirectories in `zsh`, and a directory is already empty, the following directories are ignored, and files remain. Example: ``` $ mkdir dir1 $ mkdir dir2 $ touch dir2/blah # avoid the zsh safety prompt; this may not be necessary for this # example, just for ease of use here $ setopt rm_star_silent $ rm -r dir1/* dir2/* zsh: no matches found: dir1/* $ ls dir2 blah ``` In bash, the already empty directory does not stop `rm` from proceeding to `dir2`, and `dir2/blah` is removed. What is this `zsh` feature, and is there a way to let `rm` behave like in `bash`?
2017/01/11
[ "https://unix.stackexchange.com/questions/336474", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/-1/" ]
The best way is to make it a single glob that matches files in both directories. ``` rm (dir1|dir2)/* ``` That way, the command is still not run if no file is found. Note however that `dir1`/`dir2` can't contain `/`. In those cases, you could do instead: ``` files=(foo/bar/*(N) bar/baz/*(N)) if ((#files)); then rm $files else echo >&2 No matching file fi ``` Or use `cshnullglob` to get the csh or pre-Bourne sh behaviour. That's still better than reverting to the bogus (IMO) behaviour of `bash` (where non-matching globs are passed asis to the command) which you can do with: ``` set +o nomatch ```
A good explanation can be found here: <https://superuser.com/questions/584249/using-wildcards-in-commands-with-zsh> The gist is: ``` By default, ZSH will generate the filenames and throw an error before executing the command if it founds no matches. ``` Your empty directory is going to generate no matches and thus an error. As the answer indicates, you can either: 1. Enclose the argument in quotes (e.g. `rm -r "dir1/*" "dir2/*"`) OR 2. Setting `unsetopt nomatch` in your `.zshrc` file OR 3. Prefacing you can command with the `noglob` environment variable (e.g. `noglob rm -r dir1/* dir2/*`)
336,474
When I try to delete all files from two or more subdirectories in `zsh`, and a directory is already empty, the following directories are ignored, and files remain. Example: ``` $ mkdir dir1 $ mkdir dir2 $ touch dir2/blah # avoid the zsh safety prompt; this may not be necessary for this # example, just for ease of use here $ setopt rm_star_silent $ rm -r dir1/* dir2/* zsh: no matches found: dir1/* $ ls dir2 blah ``` In bash, the already empty directory does not stop `rm` from proceeding to `dir2`, and `dir2/blah` is removed. What is this `zsh` feature, and is there a way to let `rm` behave like in `bash`?
2017/01/11
[ "https://unix.stackexchange.com/questions/336474", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/-1/" ]
Unlike `bash`, `zsh` by default reports an error in case a filename generation pattern has no matches. This behavior can be changed globally or on a per-pattern basis. To prevent error messages from non-matching pattern globally, you can set either of the options `NULL_GLOB` or `CSH_NULL_GLOB`: * ``` setopt nullglob ``` If a pattern has no matches it will be removed from the argument list. No error message will be printed. In your example ``` rm dir1/* dir2/* ``` would be just expanded to ``` rm dir2/blah ``` * ``` setopt cshnullglob ``` Also removes non-matching patterns and does not print an error message, unless none of the patterns have a match. To prevent error messages for single patterns, you can use the glob qualifier `N`, which behaves as if the `NULL_GLOB` option was activated for this pattern: ``` rm dir1/*(N) dir2/*(N) ``` This also would be expanded to ``` rm dir2/blah ```
The best way is to make it a single glob that matches files in both directories. ``` rm (dir1|dir2)/* ``` That way, the command is still not run if no file is found. Note however that `dir1`/`dir2` can't contain `/`. In those cases, you could do instead: ``` files=(foo/bar/*(N) bar/baz/*(N)) if ((#files)); then rm $files else echo >&2 No matching file fi ``` Or use `cshnullglob` to get the csh or pre-Bourne sh behaviour. That's still better than reverting to the bogus (IMO) behaviour of `bash` (where non-matching globs are passed asis to the command) which you can do with: ``` set +o nomatch ```
22,318,678
``` <div id="feedback"></div> <form id="myForm" action="controller.php" method="post"> location1: <input type="checkbox" name="location1" id="location1" value="location1"/> location2: <input type="checkbox" name="location2" id="location2" value="location2"/><br> <input type="submit" id="submit" value="Submit" /> </form> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#submit').click(function(e){ var locations = []; $('input:checkbox:checked').each(function(){ locations.push($(this).val()); }); locations.join(" ! "); $('#feedback').text(locations); e.preventDefault(); }); }); </script> ``` In the code above output is always comming with comma(,) seperator. Also why $('#feedback').html(locations); is not making any seperation among locations' elements ? [JSFiddle](http://jsfiddle.net/LPP5P/)
2014/03/11
[ "https://Stackoverflow.com/questions/22318678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1906399/" ]
You have to assign the return value of `join()` to a variable, it will not change the array ``` var loc = locations.join(" ! "); $('#feedback').text(loc); ```
The [join](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join) operation (which is core JavaScript, not jQuery) does not update the variable you're calling it on, i.e. ``` locations.join(" ! "); ``` is joining your array then throwing away the result. You'll need to save the result of this operation or just pass it straight into the .text, e.g. ``` $('#feedback').text(locations.join(" ! ");) ```
34,314,184
The SonarQube Jenkins plugin makes an initial HTTP request for /api/server/version which responds 200 OK but then makes a request for /api/server/key which is not a valid action. The build then fails as the session is terminated with a 404 Not Found. Can anyone explain why an API request is made for key when it is invalid ? The plugin is version 2.3 and the server is version 5.2. Here is the actual response : ``` <error><code>404</code><msg>No action responded to key. Actions: admin_required, authorized?, available_locales, current_user, current_user=, error_to_json, error_to_xml, format_datetime, handle_remember_cookie!, has_role?, index, is_admin?, is_user?, java_facade, json_not_supported, jsonp, kill_remember_cookie!, load_resource, logged_in?, login_from_basic_auth, login_from_cookie, login_from_session, login_required, logout_keeping_session!, logout_killing_session!, parse_datetime, redirect_back_or_default, render_access_denied, render_bad_request, render_error, render_java_exception, render_not_found, render_response, render_success, resource_required, select_authorized, send_remember_cookie!, setup, store_location, text_not_supported, valid_remember_cookie?, version, and xml_not_supported</msg></error> ```
2015/12/16
[ "https://Stackoverflow.com/questions/34314184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5686987/" ]
I put together an example below that will hopefully help you out. You just have to specify the source from where the shoot is fired (`sourceX`,`sourceY`), calculate the angle to where the mouse is clicked (done below, so should just be to copy/paste) and adjust the `transform: rotate(Xdeg);` to the new angle. Make sure to set the orgin in css with `transform-origin`, so that the flame rotates around the source and not the flame itself. Try it out at the bottom. ```js var game, flame, sourceX = 310, sourceY = 110; window.onload = function() { game = document.getElementById('game'); flame = document.getElementById('flame'); game.addEventListener('click', function(e) { var targetX = e.pageX, targetY = e.pageY, deltaX = targetX - sourceX, deltaY = targetY - sourceY, rad = Math.atan2(deltaY, deltaX), deg = rad * (180 / Math.PI), length = Math.sqrt(deltaX*deltaX+deltaY*deltaY); fire(deg,length); }, false); }; function fire(deg,length) { flame.style.opacity = 1; flame.style.transform = 'rotate(' + deg + 'deg)' flame.style.width = length + 'px'; setTimeout(function() { flame.style.opacity = 0; },300); }; ``` ```css #game { position: relative; width: 400px; height: 200px; background-color: #666; overflow: hidden; } #source { border-radius: 50%; z-index: 101; width: 20px; height: 20px; background-color: #ff0000; position: absolute; left: 300px; top: 100px; } #flame { width: 300px; height: 3px; background-color: #00ff00; position: absolute; left: 310px; top: 110px; opacity: 0; transform-origin: 0px 0px; transform: rotate(180deg); transition: opacity .2s; } ``` ```html <div id="game"> <div id="source"> </div> <div id="flame"> </div> </div> ```
I would not recommend building games in this manner, Canvas and SVG are the preferred methods of building browser games, with that said it can be done. Try this <https://jsfiddle.net/b77x4rq4/> ``` $(document).ready(function(){ var middleOfElementTop = 250; // margin from top + half of height var middleOfElementLeft = 125; // margin from left + half of width $("#main").mousemove(function(e){ var mouseX = e.offsetX; var mouseY = e.offsetY; var angle = Math.atan2(mouseY - middleOfElementTop, mouseX - middleOfElementLeft) * 180 / Math.PI; $(".box").css({"transform": "rotate(" + angle + "deg)"}) }) }); ```
73,473
I am no longer able to start my 2010 Ford Focus. The key is not able to turn at all. Importantly, the car beeps when I open the driver side door as if the key was still in the ignition. This has happened before, but I would simply reinsert and remove the key. Then I would feel/hear something mechanically click into place and the beeping would stop. The problem is I can't make the click happen this time. Any suggestions? What part will need to be replaced?
2019/12/24
[ "https://mechanics.stackexchange.com/questions/73473", "https://mechanics.stackexchange.com", "https://mechanics.stackexchange.com/users/54270/" ]
Could be your key is extremely worn or the ignition lock cylinder is extremely worn. I suggest calling a local locksmith to replace key and code a new lock cylinder to oem biting for your car. Ford ignition locks are common failures. You could also try flushing it out with some wd40 but it would be a temporary fix at best.
Often the dust cover fails to close leaving the key hole exposed and this causes the issue described. Sometimes a **tiny** bit of lubrication is sufficient (clean first) and then the cover closes smartly.
26,753,541
Well, it seems strange that no one has asked this question before and it has been bothering me for hours but here's what I am trying to do. I need to reverse the order of a text file, show the last 10 entries and print the contents but not from the last entry showing first. Rather I wish to maintain the order. ie. the first entry should show first and the last entry should show last. I already have the PHP code to reverse and show the last 10 entries which I posted below with the help of a user. Thanks a ton for your help in advance! Code ``` <?php $text = file('user.txt'); $text= array_reverse($text); $counter=0; while ($counter < 10) { if (isset($text[$counter])) { echo $text[$counter] . ""; } $counter++; } ?> ```
2014/11/05
[ "https://Stackoverflow.com/questions/26753541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4217848/" ]
You have three problems. --- First: You have configured JS Fiddle to wrap all your code in an onload handler. This stops the function being a global so when you call `addFunc` it can't be found. --- Second: You are calling jQuery but haven't included the jQuery library. --- Third: The value of `this` depends on how you call the function. When the `onclick` function is called, `this` is the element. When `addFunc` is called (if you fix the other problems), since you haven't specified a context, `this` is `window` (the default object). --- Don't use intrinsic event attributes. Bind your event handlers with JavaScript. ``` jQuery(".add-link").on('click', addFunc); ``` And if you use jQuery, then [include the library](http://jquery.com/download/) in your page.
try to call it with class name : ``` $('.add-link').click(function() { var username = $(this).attr('title'); alert(username); $('#content').html(username); }); ```
26,753,541
Well, it seems strange that no one has asked this question before and it has been bothering me for hours but here's what I am trying to do. I need to reverse the order of a text file, show the last 10 entries and print the contents but not from the last entry showing first. Rather I wish to maintain the order. ie. the first entry should show first and the last entry should show last. I already have the PHP code to reverse and show the last 10 entries which I posted below with the help of a user. Thanks a ton for your help in advance! Code ``` <?php $text = file('user.txt'); $text= array_reverse($text); $counter=0; while ($counter < 10) { if (isset($text[$counter])) { echo $text[$counter] . ""; } $counter++; } ?> ```
2014/11/05
[ "https://Stackoverflow.com/questions/26753541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4217848/" ]
You did not include jquery in your fiddle. Also if you use jquery bind your events with it like this: ``` $(".add-link").on("click", function addFunc(){ var username = $(this).attr('title'); $('#content').html(username); }); ``` <http://jsfiddle.net/0f4mun8r/4/>
try to call it with class name : ``` $('.add-link').click(function() { var username = $(this).attr('title'); alert(username); $('#content').html(username); }); ```
358,589
I share the picture of the schematic of my circuit. I want to use the LM350 variable voltage regulator to reduce the 40mV p-p ripple i have in my bridge rectified DC. Though it has no effect at all. Why could this be? My load draws current and i can adjust the voltage output of LM350. I couldn't make it to reduce the ripple. Would you point me to the right direction? Thank you. **In the below schematic there are some wrong values. The output voltage is 8.39 V and load draws 750mA.** The ripple frequency is around 250Hz. [![Schematic](https://i.stack.imgur.com/EPKOB.jpg)](https://i.stack.imgur.com/EPKOB.jpg)
2018/02/26
[ "https://electronics.stackexchange.com/questions/358589", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/152263/" ]
Notice in the TI datasheet, line regulation is spec'ed with \$V\_{in}-V\_{out}\ge 3\ {\rm V}\$. With 11.5 V at input and 8.4 V at output, you just barely meet that requirement. Possibly the input voltage at the LM350 is actually a bit lower than 11.5 V due to wire losses, or because your unregulated rectifier output has dropped under load. Anyway, what you told us about output voltage was off by 4 V, so I don't hardly trust what you've told us about input voltage. If that's the case, you are operating in drop-out. In drop-out, line regulation is practically non-existent, and any ripple on the input will transfer 1-to-1 to the output. If this is the issue, when you reduce the output voltage (by changing the adjustment resistor values), the line regulation should improve dramatically.
Added Problem: -------- Too much dropout for a high current LDO ( L is not low enough) Measurements and specs are unclear. Solution: --------- **Use a 1 ohm power PFET with heat sink. ( or a 100 mOhm PFET and switch it at 50kHz with 10uH choke with LC filter) OpAmp may be reversed and use NFET.** Dear Ali: You ought to say you want vacuum tube heater current at 6V with 1mV ripple with 300mA/tube or -75 dB in the first place. Is this for 2 tubes ? I would have created 13.5 or 13 V DC then used series heaters with 150mA/tube with a CC regulator that has > -80 dB line regulation error. Half the current also improves line regulation ripple by 6dB. Why 350Hz and why not 35kHz? Then you dont need 30mF caps. > > A better design may be to supply CC so that there is no 5x cold surge and 80dB loop gain at 350Hz or 3.5MHz GBW. > > > **Design specs.** ----------------- * -80 db min line regulation error @ 350Hz * 1A max CC mode set by user for 4W load (tungsten @ 6V) * R sense set for < 1/4W R. * High GBW and Ron ~1 Ohm ~5W dissipation . [![enter image description here](https://i.stack.imgur.com/p8Wxm.png)](https://i.stack.imgur.com/p8Wxm.png) You shall not use a 10mOhm FET because the feedthru capacitance is too high. Test Results ------------ tinyurl.com/yalvlj6b (Falstad sim) * using 1Vp square ripple input instead of 20mV ( to make it easier to measure low ripple out) * assumed 4W tungsten load at 6V * set CC to 0.11V/ 0.15 Ohm * with 0.1mA ripple out = -77dB from DC at 1V ripple input improved by 20 dB at 100mV input ripple. * Series pass FET dissipates as much as load near half voltage. * result: OK given mismatched supply source. --- You need to understand the datasheet. There is a complex Zout(f) and you have a complex load ZL(f). The ratio approximates the step load regulation error. ~~Since you have 100 Hz input ripple yet 350Hz output ripple, I presume your ripple is all load regulation error and not Vdrop related.~~ There must be a preload to reduce load regulation error and compensation at the Vadj and Vout to support a declining Zout(f) and Zadj( feedback). Without going over the datasheet examples in detail , I expect you to do this and see examples of 10mF on output with low ESR and and understand that 1% load regulation error on 10V means 100mV ripple. This can be reduced by above compensation caps, but I will not do all the work for you. Do you know Bode plots and impedance ratios? Can you define your transient load properly? Can you supply a tabe of step load current and f with ripple values with added trace photos so we can see spectral ripple? Most important -------------- Why do you need low ripple and what is your spec or acceptance criteria?
64,909
What are the pros and cons of different data formats (performance, file size, etc.) when considering open data distribution? Our organisation wants to publish data as open data. However, there is no clear idea on which data formats to use. Ofcourse, the more 'open' a data format is, the easier it is to use. Which data formats are the most 'open' and therefore most usable for the distribution of Open Data when taking the following types in consideration?: * raster data (I'm thinking: GeoTIFF, Erdas Imagine IMG?) * vector data (I'm thinking: GML, CSV, ESRI Shapefile, DXF?) * tabular data (I'm thinking: CSV?) * 3D data (I'm thinking: CityGML?) * 3D point coulds / LIDAR (I'm thinking: LAS?) * am I forgetting something here? Also, if there is documentation about open data formats I'm very interested if you would like to share.
2013/07/01
[ "https://gis.stackexchange.com/questions/64909", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/10132/" ]
The city of Vienna's open data initiative (<http://data.wien.gv.at>) uses Geoserver to provide access to raster and vector geodata via Geoserver **WMS and WFS** services. This has many advantages: Users can download data in different formats for offline use (e.g. geojson, KML, or zipped Shapefiles) or use the services live by embedding them in online maps or GIS projects.
I would say: * Shapefiles or GML for vector data * .obj-Files for 3D models * .xyz (simple CSV) for point clouds * CSV for tabular data * GeoTIFF for raster data These formats are easily readable by Open Source Software and are easily transformable to any other format needed for specific applications. Also +1 for making data open!
64,909
What are the pros and cons of different data formats (performance, file size, etc.) when considering open data distribution? Our organisation wants to publish data as open data. However, there is no clear idea on which data formats to use. Ofcourse, the more 'open' a data format is, the easier it is to use. Which data formats are the most 'open' and therefore most usable for the distribution of Open Data when taking the following types in consideration?: * raster data (I'm thinking: GeoTIFF, Erdas Imagine IMG?) * vector data (I'm thinking: GML, CSV, ESRI Shapefile, DXF?) * tabular data (I'm thinking: CSV?) * 3D data (I'm thinking: CityGML?) * 3D point coulds / LIDAR (I'm thinking: LAS?) * am I forgetting something here? Also, if there is documentation about open data formats I'm very interested if you would like to share.
2013/07/01
[ "https://gis.stackexchange.com/questions/64909", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/10132/" ]
For tabular csv. Excel is at best overly complicated and at worst totally inaccessible. Access is not accessible and PDF is a slap in the face. For geospatial use geojson, it's text it's well supported and doesn't have the technical restrictions that the only other viable format (shapefile) has. Also unless you have a very good reason it should be in WGS84, bearing in mind that most users will be in another state and will not want state plane.
I would say: * Shapefiles or GML for vector data * .obj-Files for 3D models * .xyz (simple CSV) for point clouds * CSV for tabular data * GeoTIFF for raster data These formats are easily readable by Open Source Software and are easily transformable to any other format needed for specific applications. Also +1 for making data open!
64,909
What are the pros and cons of different data formats (performance, file size, etc.) when considering open data distribution? Our organisation wants to publish data as open data. However, there is no clear idea on which data formats to use. Ofcourse, the more 'open' a data format is, the easier it is to use. Which data formats are the most 'open' and therefore most usable for the distribution of Open Data when taking the following types in consideration?: * raster data (I'm thinking: GeoTIFF, Erdas Imagine IMG?) * vector data (I'm thinking: GML, CSV, ESRI Shapefile, DXF?) * tabular data (I'm thinking: CSV?) * 3D data (I'm thinking: CityGML?) * 3D point coulds / LIDAR (I'm thinking: LAS?) * am I forgetting something here? Also, if there is documentation about open data formats I'm very interested if you would like to share.
2013/07/01
[ "https://gis.stackexchange.com/questions/64909", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/10132/" ]
I quite like [NetCDF](http://en.wikipedia.org/wiki/NetCDF) for continuous/array data (i.e. rasters). Pros for NetCDF are: * NetCDF is self describing (i.e., data definitions are available through the file header) so you don't need to supply secondary metadata files * NetCDF4 allows for storage of n-dimensional data (using the HDF5 data format on disk, which is a bonus as this allows files as big as your OS can handle). This comes with reasonable compression and fast access to the data. Note that NetCDF3 doesn't support n-dimensional data, and has a file size limit of roughly 2GB on a 32-bit system. * NetCDF is an open format so accessing the data is generally not a problem as well through common libraries. For example, in python it's simple enough from scipy to read in a slice of data: ```py from scipy.io import netcdf f = netcdf.netcdf_file('source.nc') print(nc.dimensions) #take a look at the dimensions of the data print(nc.variables) #A dictionary containing all the variables nc.variables["some_data"].dimensions #The dimensions this variable is in, e.g. lat, lon out_array = nc.variables["some_data"].data f.close() #and we're done ``` The only downside to NetCDF4 that I can see is the not-great support in standard GIS packages like ArcGIS and QGIS (though I dearly would love to be corrected on this!). **EDIT Some other packages that support NetCDF** Some standard programming languages that support NetCDF (though to be fair, anything that can read HDF can read NetCDF4): * [Java](http://www.unidata.ucar.edu/software/netcdf-java) * [Perl](http://www.unidata.ucar.edu/software/netcdf-perl/) * [C++](http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-cxx/) For maths and stats users you have: * [matlab](http://www.mathworks.com.au/help/matlab/ref/netcdf.html) * [IDL](http://www.exelisvis.com/docs/NCDF_Overview.html) * [R](http://cran.r-project.org/web/packages/RNetCDF/index.html) Specifically in GIS: * [GDAL](http://gdal.org/frmt_netcdf.html) will convert the data for you * Likewise [FME](http://www.safe.com/fme/format-search/network-common-data-form-netcdf/index.php) * [ArcGIS](http://resources.arcgis.com/en/help/main/10.1/index.html#/A_quick_tour_of_netCDF_data/004600000015000000/) supports NetCDF (though it's not the best level of support in my experience) * There is a [QGIS Plugin](http://plugins.qgis.org/plugins/netcdfbrowser/) in development If you want to quickly look at a NetCDF file I'd use the cross-platform Panoply from NASA. And if you're interested in more, UCAR Unidata has a [list of software](http://www.unidata.ucar.edu/software/netcdf/software.html).
I would say: * Shapefiles or GML for vector data * .obj-Files for 3D models * .xyz (simple CSV) for point clouds * CSV for tabular data * GeoTIFF for raster data These formats are easily readable by Open Source Software and are easily transformable to any other format needed for specific applications. Also +1 for making data open!
64,909
What are the pros and cons of different data formats (performance, file size, etc.) when considering open data distribution? Our organisation wants to publish data as open data. However, there is no clear idea on which data formats to use. Ofcourse, the more 'open' a data format is, the easier it is to use. Which data formats are the most 'open' and therefore most usable for the distribution of Open Data when taking the following types in consideration?: * raster data (I'm thinking: GeoTIFF, Erdas Imagine IMG?) * vector data (I'm thinking: GML, CSV, ESRI Shapefile, DXF?) * tabular data (I'm thinking: CSV?) * 3D data (I'm thinking: CityGML?) * 3D point coulds / LIDAR (I'm thinking: LAS?) * am I forgetting something here? Also, if there is documentation about open data formats I'm very interested if you would like to share.
2013/07/01
[ "https://gis.stackexchange.com/questions/64909", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/10132/" ]
I would say: * Shapefiles or GML for vector data * .obj-Files for 3D models * .xyz (simple CSV) for point clouds * CSV for tabular data * GeoTIFF for raster data These formats are easily readable by Open Source Software and are easily transformable to any other format needed for specific applications. Also +1 for making data open!
Virtually this exact same question came up at opendata.SE: [What are the most useful formats in which to release geospatial data?](https://opendata.stackexchange.com/questions/313/what-are-the-most-useful-formats-in-which-to-release-geospatial-data/4932#4932) So, hopefully I'm not violating any policies in quoting my own answer there: My experience, making maps from quite a few government datasets: For point data, CSV is the best, with "lat" and "lon" columns. Very easy to work with in a wide range of tools, including text editors, spreadsheets, etc. There are two downsides: 1. GDAL requires a `.vrt` companion file. 2. The naming of the `lat` and `lon` columns is not totally standard. Many tools are pretty liberal in what they accept. For lines and polygons, in decreasing order of preference: 1. GeoJSON. Easy to work with, and the ability to edit in a text editor or with [geojson.io](http://geojson.io) is a real bonus, if you need to do search/replace, remove a couple of weird objects or copy and paste from one file to another. Another benefit is that non-GIS developers can make sense of it. Only issues I've run into is when someone provides data as say MultiPoint instead of Point. 2. Shapefile. Very widely supported, but with two inconvenient points. First, it's a collection of files, so you have to pass around a .zip and extract it. Second, field names are limited to 10 characters. They're hard to edit for your average non-GIS person. 3. KML/KMZ. These often have a lot of irrelevant cruft (styling, icons, etc), and attributes are sometimes encoded as mini HTML tables, which are really hard to work with. At least you can edit them easily with Google tools. Honestly, though, the best answer is probably "all of them". Do everyone a favour and release the data in CSV (if point), GeoJSON, zipped Shapefile and KMZ.
64,909
What are the pros and cons of different data formats (performance, file size, etc.) when considering open data distribution? Our organisation wants to publish data as open data. However, there is no clear idea on which data formats to use. Ofcourse, the more 'open' a data format is, the easier it is to use. Which data formats are the most 'open' and therefore most usable for the distribution of Open Data when taking the following types in consideration?: * raster data (I'm thinking: GeoTIFF, Erdas Imagine IMG?) * vector data (I'm thinking: GML, CSV, ESRI Shapefile, DXF?) * tabular data (I'm thinking: CSV?) * 3D data (I'm thinking: CityGML?) * 3D point coulds / LIDAR (I'm thinking: LAS?) * am I forgetting something here? Also, if there is documentation about open data formats I'm very interested if you would like to share.
2013/07/01
[ "https://gis.stackexchange.com/questions/64909", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/10132/" ]
The city of Vienna's open data initiative (<http://data.wien.gv.at>) uses Geoserver to provide access to raster and vector geodata via Geoserver **WMS and WFS** services. This has many advantages: Users can download data in different formats for offline use (e.g. geojson, KML, or zipped Shapefiles) or use the services live by embedding them in online maps or GIS projects.
Virtually this exact same question came up at opendata.SE: [What are the most useful formats in which to release geospatial data?](https://opendata.stackexchange.com/questions/313/what-are-the-most-useful-formats-in-which-to-release-geospatial-data/4932#4932) So, hopefully I'm not violating any policies in quoting my own answer there: My experience, making maps from quite a few government datasets: For point data, CSV is the best, with "lat" and "lon" columns. Very easy to work with in a wide range of tools, including text editors, spreadsheets, etc. There are two downsides: 1. GDAL requires a `.vrt` companion file. 2. The naming of the `lat` and `lon` columns is not totally standard. Many tools are pretty liberal in what they accept. For lines and polygons, in decreasing order of preference: 1. GeoJSON. Easy to work with, and the ability to edit in a text editor or with [geojson.io](http://geojson.io) is a real bonus, if you need to do search/replace, remove a couple of weird objects or copy and paste from one file to another. Another benefit is that non-GIS developers can make sense of it. Only issues I've run into is when someone provides data as say MultiPoint instead of Point. 2. Shapefile. Very widely supported, but with two inconvenient points. First, it's a collection of files, so you have to pass around a .zip and extract it. Second, field names are limited to 10 characters. They're hard to edit for your average non-GIS person. 3. KML/KMZ. These often have a lot of irrelevant cruft (styling, icons, etc), and attributes are sometimes encoded as mini HTML tables, which are really hard to work with. At least you can edit them easily with Google tools. Honestly, though, the best answer is probably "all of them". Do everyone a favour and release the data in CSV (if point), GeoJSON, zipped Shapefile and KMZ.
64,909
What are the pros and cons of different data formats (performance, file size, etc.) when considering open data distribution? Our organisation wants to publish data as open data. However, there is no clear idea on which data formats to use. Ofcourse, the more 'open' a data format is, the easier it is to use. Which data formats are the most 'open' and therefore most usable for the distribution of Open Data when taking the following types in consideration?: * raster data (I'm thinking: GeoTIFF, Erdas Imagine IMG?) * vector data (I'm thinking: GML, CSV, ESRI Shapefile, DXF?) * tabular data (I'm thinking: CSV?) * 3D data (I'm thinking: CityGML?) * 3D point coulds / LIDAR (I'm thinking: LAS?) * am I forgetting something here? Also, if there is documentation about open data formats I'm very interested if you would like to share.
2013/07/01
[ "https://gis.stackexchange.com/questions/64909", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/10132/" ]
For tabular csv. Excel is at best overly complicated and at worst totally inaccessible. Access is not accessible and PDF is a slap in the face. For geospatial use geojson, it's text it's well supported and doesn't have the technical restrictions that the only other viable format (shapefile) has. Also unless you have a very good reason it should be in WGS84, bearing in mind that most users will be in another state and will not want state plane.
Virtually this exact same question came up at opendata.SE: [What are the most useful formats in which to release geospatial data?](https://opendata.stackexchange.com/questions/313/what-are-the-most-useful-formats-in-which-to-release-geospatial-data/4932#4932) So, hopefully I'm not violating any policies in quoting my own answer there: My experience, making maps from quite a few government datasets: For point data, CSV is the best, with "lat" and "lon" columns. Very easy to work with in a wide range of tools, including text editors, spreadsheets, etc. There are two downsides: 1. GDAL requires a `.vrt` companion file. 2. The naming of the `lat` and `lon` columns is not totally standard. Many tools are pretty liberal in what they accept. For lines and polygons, in decreasing order of preference: 1. GeoJSON. Easy to work with, and the ability to edit in a text editor or with [geojson.io](http://geojson.io) is a real bonus, if you need to do search/replace, remove a couple of weird objects or copy and paste from one file to another. Another benefit is that non-GIS developers can make sense of it. Only issues I've run into is when someone provides data as say MultiPoint instead of Point. 2. Shapefile. Very widely supported, but with two inconvenient points. First, it's a collection of files, so you have to pass around a .zip and extract it. Second, field names are limited to 10 characters. They're hard to edit for your average non-GIS person. 3. KML/KMZ. These often have a lot of irrelevant cruft (styling, icons, etc), and attributes are sometimes encoded as mini HTML tables, which are really hard to work with. At least you can edit them easily with Google tools. Honestly, though, the best answer is probably "all of them". Do everyone a favour and release the data in CSV (if point), GeoJSON, zipped Shapefile and KMZ.
64,909
What are the pros and cons of different data formats (performance, file size, etc.) when considering open data distribution? Our organisation wants to publish data as open data. However, there is no clear idea on which data formats to use. Ofcourse, the more 'open' a data format is, the easier it is to use. Which data formats are the most 'open' and therefore most usable for the distribution of Open Data when taking the following types in consideration?: * raster data (I'm thinking: GeoTIFF, Erdas Imagine IMG?) * vector data (I'm thinking: GML, CSV, ESRI Shapefile, DXF?) * tabular data (I'm thinking: CSV?) * 3D data (I'm thinking: CityGML?) * 3D point coulds / LIDAR (I'm thinking: LAS?) * am I forgetting something here? Also, if there is documentation about open data formats I'm very interested if you would like to share.
2013/07/01
[ "https://gis.stackexchange.com/questions/64909", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/10132/" ]
I quite like [NetCDF](http://en.wikipedia.org/wiki/NetCDF) for continuous/array data (i.e. rasters). Pros for NetCDF are: * NetCDF is self describing (i.e., data definitions are available through the file header) so you don't need to supply secondary metadata files * NetCDF4 allows for storage of n-dimensional data (using the HDF5 data format on disk, which is a bonus as this allows files as big as your OS can handle). This comes with reasonable compression and fast access to the data. Note that NetCDF3 doesn't support n-dimensional data, and has a file size limit of roughly 2GB on a 32-bit system. * NetCDF is an open format so accessing the data is generally not a problem as well through common libraries. For example, in python it's simple enough from scipy to read in a slice of data: ```py from scipy.io import netcdf f = netcdf.netcdf_file('source.nc') print(nc.dimensions) #take a look at the dimensions of the data print(nc.variables) #A dictionary containing all the variables nc.variables["some_data"].dimensions #The dimensions this variable is in, e.g. lat, lon out_array = nc.variables["some_data"].data f.close() #and we're done ``` The only downside to NetCDF4 that I can see is the not-great support in standard GIS packages like ArcGIS and QGIS (though I dearly would love to be corrected on this!). **EDIT Some other packages that support NetCDF** Some standard programming languages that support NetCDF (though to be fair, anything that can read HDF can read NetCDF4): * [Java](http://www.unidata.ucar.edu/software/netcdf-java) * [Perl](http://www.unidata.ucar.edu/software/netcdf-perl/) * [C++](http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-cxx/) For maths and stats users you have: * [matlab](http://www.mathworks.com.au/help/matlab/ref/netcdf.html) * [IDL](http://www.exelisvis.com/docs/NCDF_Overview.html) * [R](http://cran.r-project.org/web/packages/RNetCDF/index.html) Specifically in GIS: * [GDAL](http://gdal.org/frmt_netcdf.html) will convert the data for you * Likewise [FME](http://www.safe.com/fme/format-search/network-common-data-form-netcdf/index.php) * [ArcGIS](http://resources.arcgis.com/en/help/main/10.1/index.html#/A_quick_tour_of_netCDF_data/004600000015000000/) supports NetCDF (though it's not the best level of support in my experience) * There is a [QGIS Plugin](http://plugins.qgis.org/plugins/netcdfbrowser/) in development If you want to quickly look at a NetCDF file I'd use the cross-platform Panoply from NASA. And if you're interested in more, UCAR Unidata has a [list of software](http://www.unidata.ucar.edu/software/netcdf/software.html).
Virtually this exact same question came up at opendata.SE: [What are the most useful formats in which to release geospatial data?](https://opendata.stackexchange.com/questions/313/what-are-the-most-useful-formats-in-which-to-release-geospatial-data/4932#4932) So, hopefully I'm not violating any policies in quoting my own answer there: My experience, making maps from quite a few government datasets: For point data, CSV is the best, with "lat" and "lon" columns. Very easy to work with in a wide range of tools, including text editors, spreadsheets, etc. There are two downsides: 1. GDAL requires a `.vrt` companion file. 2. The naming of the `lat` and `lon` columns is not totally standard. Many tools are pretty liberal in what they accept. For lines and polygons, in decreasing order of preference: 1. GeoJSON. Easy to work with, and the ability to edit in a text editor or with [geojson.io](http://geojson.io) is a real bonus, if you need to do search/replace, remove a couple of weird objects or copy and paste from one file to another. Another benefit is that non-GIS developers can make sense of it. Only issues I've run into is when someone provides data as say MultiPoint instead of Point. 2. Shapefile. Very widely supported, but with two inconvenient points. First, it's a collection of files, so you have to pass around a .zip and extract it. Second, field names are limited to 10 characters. They're hard to edit for your average non-GIS person. 3. KML/KMZ. These often have a lot of irrelevant cruft (styling, icons, etc), and attributes are sometimes encoded as mini HTML tables, which are really hard to work with. At least you can edit them easily with Google tools. Honestly, though, the best answer is probably "all of them". Do everyone a favour and release the data in CSV (if point), GeoJSON, zipped Shapefile and KMZ.
5,678,384
Is it possible to add: "First, Last, Next, Previous" options to the GridView paging? I can't seem to figure it out. All I can get are numbers and >> for last and << for first...
2011/04/15
[ "https://Stackoverflow.com/questions/5678384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/484703/" ]
Set the value of the PageText properties of the PagerSettings section: ---------------------------------------------------------------------- ``` <asp:GridView ID="gridView" runat="server" AllowPaging="True"> <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" PreviousPageText="Previous" NextPageText="Next" LastPageText="Last" /> </asp:GridView> ``` You can set these values from the Properties window in the designer too ..
The default Pager of GridView is not flexible. The alternatives are these 1. Using Pager Template of the GridView ([GridView PagerTemplate Property by MSDN](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.pagertemplate.aspx)) 2. Extending the GridView control to support DataPager ([example here](https://web.archive.org/web/20140702030959/http://mattberseth.com/blog/2008/04/using_a_datapager_with_the_gri.html))
5,678,384
Is it possible to add: "First, Last, Next, Previous" options to the GridView paging? I can't seem to figure it out. All I can get are numbers and >> for last and << for first...
2011/04/15
[ "https://Stackoverflow.com/questions/5678384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/484703/" ]
The default Pager of GridView is not flexible. The alternatives are these 1. Using Pager Template of the GridView ([GridView PagerTemplate Property by MSDN](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.pagertemplate.aspx)) 2. Extending the GridView control to support DataPager ([example here](https://web.archive.org/web/20140702030959/http://mattberseth.com/blog/2008/04/using_a_datapager_with_the_gri.html))
[enter image description here](https://i.stack.imgur.com/A2Jnv.png)We can also combined number and first and last custom button in gridview For this, we need to enable normal paging in gridview then set pagerstyle This will show normal paging with numbers. For the custom first and last button Write jquery code for that $(document).ready(function () { //For the first button at first position of pager use prepend method $('.gridviewPager').closest('tr').find('table tbody tr').prepend('First'); //For the Last button at last position of pager use append method $('.gridviewPager').closest("tr").find("table tbody tr").append('Last'); }) [pager with first and last button](https://i.stack.imgur.com/jliBh.png) ```js <script type="text/javascript"> $(document).ready(function () { $('.gridviewPager').closest('tr').find('table tbody tr').prepend('<td><a href="javascript:__doPostBack(' + "'ctl00$ContentPlaceHolder1$gvReport'" + ',' + "'Page$First'" + ')">First</a></td>'); $('.gridviewPager').closest("tr").find("table tbody tr").append('<td><a href="javascript:__doPostBack(' + "'ctl00$ContentPlaceHolder1$gvReport'" + ',' + "'Page$Last'" + ')">Last</a></td>'); }) </script> ``` ```css <style> .gridviewPager { background-color: #fff; padding: 2px; margin: 2% auto; } .gridviewPager a { margin: auto 1%; border-radius: 50%; background-color: #545454; padding: 5px 10px 5px 10px; color: #fff; text-decoration: none; -o-box-shadow: 1px 1px 1px #111; -moz-box-shadow: 1px 1px 1px #111; -webkit-box-shadow: 1px 1px 1px #111; box-shadow: 1px 1px 1px #111; } .gridviewPager a:hover { background-color: #337ab7; color: #fff; } .gridviewPager span { background-color: #066091; color: #fff; -o-box-shadow: 1px 1px 1px #111; -moz-box-shadow: 1px 1px 1px #111; -webkit-box-shadow: 1px 1px 1px #111; box-shadow: 1px 1px 1px #111; border-radius: 50%; padding: 5px 10px 5px 10px; } </style> ``` ```html <asp:GridView ID="gvReport" runat="server" DataKeyNames="ID" class="table table-striped table-bordered" AllowPaging="true" PageSize="10" Width="100%" AutoGenerateColumns="false"> <PagerStyle CssClass="gridviewPager" /> <Columns> <asp:TemplateField HeaderText="Sr No"> <ItemTemplate> <asp:Label ID="lblSrNo" runat="server" Text='<%#Container.DataItemIndex+1 %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="ID" HeaderText="Id" Visible="false"></asp:BoundField> <asp:BoundField DataField="NameE" HeaderText="Aadhar Name"></asp:BoundField> <asp:BoundField DataField="District" HeaderText="District Name"></asp:BoundField> <asp:BoundField DataField="Block" HeaderText="Block Name"></asp:BoundField> <asp:BoundField DataField="Mobile" HeaderText="Mobile"></asp:BoundField> <asp:BoundField DataField="AMobile" HeaderText="Alternate Mobile"></asp:BoundField> <asp:BoundField DataField="Adhar" HeaderText="Adhar"></asp:BoundField> <asp:BoundField DataField="Gender" HeaderText="Gender"></asp:BoundField> <asp:BoundField DataField="Sector" HeaderText="Sector's"></asp:BoundField> <asp:BoundField DataField="Age" HeaderText="Age"></asp:BoundField> <asp:BoundField DataField="Qualification" HeaderText="Highest Qualification"></asp:BoundField> <asp:BoundField DataField="GREDTYPE" HeaderText="Score Type"></asp:BoundField> <asp:BoundField DataField="PGC" HeaderText="Per./Grade/CGPA"></asp:BoundField> </Columns> </asp:GridView> ```
5,678,384
Is it possible to add: "First, Last, Next, Previous" options to the GridView paging? I can't seem to figure it out. All I can get are numbers and >> for last and << for first...
2011/04/15
[ "https://Stackoverflow.com/questions/5678384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/484703/" ]
Set the value of the PageText properties of the PagerSettings section: ---------------------------------------------------------------------- ``` <asp:GridView ID="gridView" runat="server" AllowPaging="True"> <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" PreviousPageText="Previous" NextPageText="Next" LastPageText="Last" /> </asp:GridView> ``` You can set these values from the Properties window in the designer too ..
Yes it is possible using PagerSettings property of gridview, all you need to do is- set Mode of PagerSetting to 'NextPreviousFirstLast' so that you can use "First, Last, Next, Previous" option for paging with gridview. ``` <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" PreviousPageText="Previous" NextPageText="Next" LastPageText="Last" /> ``` There are three more properties of Mode like "NextPrevious" , "Numeric" and "NumericFirstLast" to use them .. NextPrevious : ``` <PagerSettings Mode="NextPrevious" PreviousPageText="Previous" NextPageText="Next"/> ``` Numeric : ``` <PagerSettings Mode="Numeric" /> ``` NumericFistLast : ``` <PagerSettings Mode="NumericFistLast" /> ```
5,678,384
Is it possible to add: "First, Last, Next, Previous" options to the GridView paging? I can't seem to figure it out. All I can get are numbers and >> for last and << for first...
2011/04/15
[ "https://Stackoverflow.com/questions/5678384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/484703/" ]
Set the value of the PageText properties of the PagerSettings section: ---------------------------------------------------------------------- ``` <asp:GridView ID="gridView" runat="server" AllowPaging="True"> <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" PreviousPageText="Previous" NextPageText="Next" LastPageText="Last" /> </asp:GridView> ``` You can set these values from the Properties window in the designer too ..
[enter image description here](https://i.stack.imgur.com/A2Jnv.png)We can also combined number and first and last custom button in gridview For this, we need to enable normal paging in gridview then set pagerstyle This will show normal paging with numbers. For the custom first and last button Write jquery code for that $(document).ready(function () { //For the first button at first position of pager use prepend method $('.gridviewPager').closest('tr').find('table tbody tr').prepend('First'); //For the Last button at last position of pager use append method $('.gridviewPager').closest("tr").find("table tbody tr").append('Last'); }) [pager with first and last button](https://i.stack.imgur.com/jliBh.png) ```js <script type="text/javascript"> $(document).ready(function () { $('.gridviewPager').closest('tr').find('table tbody tr').prepend('<td><a href="javascript:__doPostBack(' + "'ctl00$ContentPlaceHolder1$gvReport'" + ',' + "'Page$First'" + ')">First</a></td>'); $('.gridviewPager').closest("tr").find("table tbody tr").append('<td><a href="javascript:__doPostBack(' + "'ctl00$ContentPlaceHolder1$gvReport'" + ',' + "'Page$Last'" + ')">Last</a></td>'); }) </script> ``` ```css <style> .gridviewPager { background-color: #fff; padding: 2px; margin: 2% auto; } .gridviewPager a { margin: auto 1%; border-radius: 50%; background-color: #545454; padding: 5px 10px 5px 10px; color: #fff; text-decoration: none; -o-box-shadow: 1px 1px 1px #111; -moz-box-shadow: 1px 1px 1px #111; -webkit-box-shadow: 1px 1px 1px #111; box-shadow: 1px 1px 1px #111; } .gridviewPager a:hover { background-color: #337ab7; color: #fff; } .gridviewPager span { background-color: #066091; color: #fff; -o-box-shadow: 1px 1px 1px #111; -moz-box-shadow: 1px 1px 1px #111; -webkit-box-shadow: 1px 1px 1px #111; box-shadow: 1px 1px 1px #111; border-radius: 50%; padding: 5px 10px 5px 10px; } </style> ``` ```html <asp:GridView ID="gvReport" runat="server" DataKeyNames="ID" class="table table-striped table-bordered" AllowPaging="true" PageSize="10" Width="100%" AutoGenerateColumns="false"> <PagerStyle CssClass="gridviewPager" /> <Columns> <asp:TemplateField HeaderText="Sr No"> <ItemTemplate> <asp:Label ID="lblSrNo" runat="server" Text='<%#Container.DataItemIndex+1 %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="ID" HeaderText="Id" Visible="false"></asp:BoundField> <asp:BoundField DataField="NameE" HeaderText="Aadhar Name"></asp:BoundField> <asp:BoundField DataField="District" HeaderText="District Name"></asp:BoundField> <asp:BoundField DataField="Block" HeaderText="Block Name"></asp:BoundField> <asp:BoundField DataField="Mobile" HeaderText="Mobile"></asp:BoundField> <asp:BoundField DataField="AMobile" HeaderText="Alternate Mobile"></asp:BoundField> <asp:BoundField DataField="Adhar" HeaderText="Adhar"></asp:BoundField> <asp:BoundField DataField="Gender" HeaderText="Gender"></asp:BoundField> <asp:BoundField DataField="Sector" HeaderText="Sector's"></asp:BoundField> <asp:BoundField DataField="Age" HeaderText="Age"></asp:BoundField> <asp:BoundField DataField="Qualification" HeaderText="Highest Qualification"></asp:BoundField> <asp:BoundField DataField="GREDTYPE" HeaderText="Score Type"></asp:BoundField> <asp:BoundField DataField="PGC" HeaderText="Per./Grade/CGPA"></asp:BoundField> </Columns> </asp:GridView> ```
5,678,384
Is it possible to add: "First, Last, Next, Previous" options to the GridView paging? I can't seem to figure it out. All I can get are numbers and >> for last and << for first...
2011/04/15
[ "https://Stackoverflow.com/questions/5678384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/484703/" ]
Yes it is possible using PagerSettings property of gridview, all you need to do is- set Mode of PagerSetting to 'NextPreviousFirstLast' so that you can use "First, Last, Next, Previous" option for paging with gridview. ``` <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" PreviousPageText="Previous" NextPageText="Next" LastPageText="Last" /> ``` There are three more properties of Mode like "NextPrevious" , "Numeric" and "NumericFirstLast" to use them .. NextPrevious : ``` <PagerSettings Mode="NextPrevious" PreviousPageText="Previous" NextPageText="Next"/> ``` Numeric : ``` <PagerSettings Mode="Numeric" /> ``` NumericFistLast : ``` <PagerSettings Mode="NumericFistLast" /> ```
[enter image description here](https://i.stack.imgur.com/A2Jnv.png)We can also combined number and first and last custom button in gridview For this, we need to enable normal paging in gridview then set pagerstyle This will show normal paging with numbers. For the custom first and last button Write jquery code for that $(document).ready(function () { //For the first button at first position of pager use prepend method $('.gridviewPager').closest('tr').find('table tbody tr').prepend('First'); //For the Last button at last position of pager use append method $('.gridviewPager').closest("tr").find("table tbody tr").append('Last'); }) [pager with first and last button](https://i.stack.imgur.com/jliBh.png) ```js <script type="text/javascript"> $(document).ready(function () { $('.gridviewPager').closest('tr').find('table tbody tr').prepend('<td><a href="javascript:__doPostBack(' + "'ctl00$ContentPlaceHolder1$gvReport'" + ',' + "'Page$First'" + ')">First</a></td>'); $('.gridviewPager').closest("tr").find("table tbody tr").append('<td><a href="javascript:__doPostBack(' + "'ctl00$ContentPlaceHolder1$gvReport'" + ',' + "'Page$Last'" + ')">Last</a></td>'); }) </script> ``` ```css <style> .gridviewPager { background-color: #fff; padding: 2px; margin: 2% auto; } .gridviewPager a { margin: auto 1%; border-radius: 50%; background-color: #545454; padding: 5px 10px 5px 10px; color: #fff; text-decoration: none; -o-box-shadow: 1px 1px 1px #111; -moz-box-shadow: 1px 1px 1px #111; -webkit-box-shadow: 1px 1px 1px #111; box-shadow: 1px 1px 1px #111; } .gridviewPager a:hover { background-color: #337ab7; color: #fff; } .gridviewPager span { background-color: #066091; color: #fff; -o-box-shadow: 1px 1px 1px #111; -moz-box-shadow: 1px 1px 1px #111; -webkit-box-shadow: 1px 1px 1px #111; box-shadow: 1px 1px 1px #111; border-radius: 50%; padding: 5px 10px 5px 10px; } </style> ``` ```html <asp:GridView ID="gvReport" runat="server" DataKeyNames="ID" class="table table-striped table-bordered" AllowPaging="true" PageSize="10" Width="100%" AutoGenerateColumns="false"> <PagerStyle CssClass="gridviewPager" /> <Columns> <asp:TemplateField HeaderText="Sr No"> <ItemTemplate> <asp:Label ID="lblSrNo" runat="server" Text='<%#Container.DataItemIndex+1 %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="ID" HeaderText="Id" Visible="false"></asp:BoundField> <asp:BoundField DataField="NameE" HeaderText="Aadhar Name"></asp:BoundField> <asp:BoundField DataField="District" HeaderText="District Name"></asp:BoundField> <asp:BoundField DataField="Block" HeaderText="Block Name"></asp:BoundField> <asp:BoundField DataField="Mobile" HeaderText="Mobile"></asp:BoundField> <asp:BoundField DataField="AMobile" HeaderText="Alternate Mobile"></asp:BoundField> <asp:BoundField DataField="Adhar" HeaderText="Adhar"></asp:BoundField> <asp:BoundField DataField="Gender" HeaderText="Gender"></asp:BoundField> <asp:BoundField DataField="Sector" HeaderText="Sector's"></asp:BoundField> <asp:BoundField DataField="Age" HeaderText="Age"></asp:BoundField> <asp:BoundField DataField="Qualification" HeaderText="Highest Qualification"></asp:BoundField> <asp:BoundField DataField="GREDTYPE" HeaderText="Score Type"></asp:BoundField> <asp:BoundField DataField="PGC" HeaderText="Per./Grade/CGPA"></asp:BoundField> </Columns> </asp:GridView> ```
31,476,248
I want to store the geolocation coordinates longitude and latitude such that I later can specify an area and query like this in GORM: ``` SELECT * FROM Place WHERE lat BETWEEN :x1 AND :x2 AND lng BETWEEN :y1 AND :y2 ``` How do I have to store the coordinates in my Domain? My underlying database is MySQL. What I propose is: ``` class Place { double lat double lng } ``` I also read that there is a spacial index. Would you recommend using this with Grails? If so how do I map my domain to fit this?
2015/07/17
[ "https://Stackoverflow.com/questions/31476248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5049150/" ]
The best thing you can do, using the Odoo framework, is to **create a button**. You can **open a wizard showing the tree view** with that button. Like this, you can use a search view in the wizard and you can group by the elements with a normal filter. If you still want to group the elements directly in the form I'm afraid you should create a widget in JavaScript. The widget should be easier and better, this widget should override or extend the widget that Odoo is using for that kind of fields. I didn't make a good research but it seems that [was possible to group the list view in the forms of the 6.1 version](http://www.zbeanztech.com/blog/filtering-one2many-fields-openerp). Maybe you can make a migration of that behaviour Anyway I recommend you to adapt you needs to the Odoo framework as much as possible to make your life easier. But, if you finally decide to create the widget and share it with the community, would be awesome :)
Something like this might work: ```xml <field name="line_ids" context="{'group_by': 'material'}"> <tree> ...</tree> <field> ```
23,835,316
Thanks for opening my question. What I'm doing, to me, should be **very** simple. I am a beginner for programming so I am not aware of what I need to get this done. I need help. The problem: I have to have 4 columns for times. (Travelto, Arrive, Depart, Travelfrom) I don't always use all of them so my script has to recognize that I want certain values based on which cells in a row are blank or which have content. I have tried using isblank() on the spreadsheet to determine a binary number which I then convert to a decimal. I'd like my script to do that so I don't have to add another column to my google sheets. I think I would use an array and then check if each element is blank in the array then multiply each element in that array by 1 so it's now a number instead of a boolean. Then I want to take the elements of the array and convert them into a single binary number and convert that to a decimal number to feed to my switch case, which will contain the correct way to calculate the hours and return the hours in decimal so it should be formated such as 1.75 for 1 hr 45 mins. The value it returns must be able to be summed so the function can't return a string. also I prefer 2 decimal places for the output. I have attempted to figure out how to calculate the time in google's apps Script. I have had limited success. The output of my script is unintelligible as to how it got the answer it did. This is probably because I can't figure out how to tell what the script sees the times as. does it see 13:00:00, 0.5416667, or something completely different? I can't seem to figure it out. I want to pass two values from a google sheets spreadsheet, which are visually formatted as time, then take those two times subtract one from the other and get the amount of time between them, the duration so that I know how many hours have been worked. ``` function worked(time1,time2) //pass 2 time values to function { //Start of the function var time1; //declare time1 variable var time2; //Declare time 2 variable var outnumber = time1-time2; //Declare outnumber and subtract time1 from time2 return outnumber //return the difference of time1 and time2 } ``` here's the link to my sheet and code included in the editor. anyone with the link can comment <https://docs.google.com/spreadsheet/ccc?key=0Ar4A89ZoxmJCdHBFR0VCblVtWUVvR3hFbTdlcjdKNUE&usp=sharing> Please tell me what I'm doing wrong or not doing at all to make this work. Thanks Goldenvocals369
2014/05/23
[ "https://Stackoverflow.com/questions/23835316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3668209/" ]
The number you are seeing outputted is the difference in ms. You need to convert ms to the format you want. I found a neat way to do that here: <https://coderwall.com/p/wkdefg> Your code would look like this. ``` function worked(time1,time2) { var time1; var time2; var outnumber = time1-time2; return msToTime(outnumber) } function msToTime(duration) { var milliseconds = parseInt((duration%1000)/100) , seconds = parseInt((duration/1000)%60) , minutes = parseInt((duration/(1000*60))%60) , hours = parseInt((duration/(1000*60*60))%24); hours = (hours < 10) ? "0" + hours : hours; minutes = (minutes < 10) ? "0" + minutes : minutes; seconds = (seconds < 10) ? "0" + seconds : seconds; return hours + ":" + minutes + ":" + seconds; } ```
You can use [this](https://developers.google.com/apps-script/reference/spreadsheet/range#getdisplayvalue) function. The function's documentation is: > > Returns the displayed value of the top-left cell in the range. The > value will be of type String. The displayed value takes into account > date, time and currency formatting formatting, including formats > applied automatically by the spreadsheet's locale setting. Empty cells > will return an empty string. > > >
10,264
When creating an Alias to a single article, the content editors keep making this mistake where they select an Alias which has the same/similar title to the 'Single Article' Menu item. When an alias is pointing to an Alias, this causes a broken link since as alias can't be pointing to another alias. Is there any way to not display aliases when the 'Menu Item Type' being created/updated itself is an alias? Or at the very least, is there a way to alter the CSS so that if there is two Menu Items being displayed with the same 'Title', the alias or the menu item gets highlighted so that it is obvious which is alias and which is a single article?
2015/06/02
[ "https://joomla.stackexchange.com/questions/10264", "https://joomla.stackexchange.com", "https://joomla.stackexchange.com/users/112/" ]
You can never save 2 menu items with alias. You will always get this message: **Save failed with the following error: Another menu item has the same alias in Root. Root is the top level parent.** Yes this can happen that your menu item alias and article item alias is same. Are you creating a New Menu with *Menu type* as **Menu Item Alias** ? Please if you can explain briefly your issue or add screenshots for this ?
Yes, it looks like there is a small bug in Joomla. You should not be offered any 'Menu Item Aliases' in `Menu Item` drop-down box when `Menu item type` is 'Menu Item Alias'. It is not exactly bug, but something which could cause inconvenience.
5,821,314
I want to parse an html page using org.w3c.dom package. Let it be <http://www.qypedeals.de/>. The page has a counter updated by JS So if I try to get a value of ``` <div class='counter_field' id='counter_day'> ``` I always get 0. Is there any possibility to get that value? Thanks in advance!
2011/04/28
[ "https://Stackoverflow.com/questions/5821314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/729655/" ]
``` SELECT a.* from table_a a LEFT JOIN table_b b ON (a.id = b.id) WHERE b.id IS NULL ``` You can also use `NOT EXISTS` (I believe it might have a bit worse performance in mysql though) : ``` SELECT a.* from table_a a WHERE NOT EXISTS (SELECT 1 FROM table_b b WHERE b.id = a.id) ```
Derived tables: ``` SELECT * FROM ( SELECT id FROM table_b ) b JOIN table_a a ON a.id = b.id ``` have nothing to do with `IN` predicates: ``` SELECT * FROM table_a WHERE id NOT IN ( SELECT id FROM table_b ) ``` The subquery in the `IN` predicate is never materialized. This way is actually the most efficient if you have an index on `table_b.id`. Here are two more: ``` SELECT * FROM table_a a WHERE NOT EXISTS ( SELECT NULL FROM table_b b WHERE b.id = a.id ) ``` and ``` SELECT * FROM table_a a LEFT JOIN table_b b ON b.id = a.id WHERE b.id IS NULL ``` This query may also be efficient if `table_b.id` cannot be indexed (say, it's a derived expression) and `table_a.id` is `UNIQUE`: ``` SELECT a.* FROM ( SELECT id, 1 AS s FROM table_a UNION SELECT id, -1 AS s FROM table_b ) q JOIN table_a a ON a.id = q.id GROUP BY a.id HAVING MAX(s) = 1 ``` You may want to read this article: * [**NOT IN vs. NOT EXISTS vs. LEFT JOIN / IS NULL: MySQL**](http://explainextended.com/2009/09/18/not-in-vs-not-exists-vs-left-join-is-null-mysql/)
27,558
In the current draft of my book, the evil dictator whose body is encased in a silver alloy talks basically by allowing magic to move to seep into the silver shell, dispelling it and causing vibrations. This voice sounds alien, imperial, and metallic. In order to represent this, I'm currently using a different font. (Specifically Kino MT.) I do something similar with a group that constantly wear helmets that filter out certain wavelengths of sound, and use the 'Cracked' font. They also sometimes speak in an imperial dialect which I represent with angle brackets. Is this just going to reek of tacky amateurishness and such?
2017/04/15
[ "https://writers.stackexchange.com/questions/27558", "https://writers.stackexchange.com", "https://writers.stackexchange.com/users/23486/" ]
This is generally inadvisable (which is not to say that it is not done sometimes). The reason it is inadvisable is that every artform has its palette, its set of devices and conventions by which it tells its story. Mastering any art form is about learning how to tell the story within the confines of that palette. One of the limits of the prose palette is that is does not support sound effects. You can describe sounds with words, but you cannot reproduce them. One of the limits of the movie palette is that you cannot describe sounds, you can only make them. This means that all sounds in a movie are presented literally, and that it is impractical to present sounds that are injurious or painful to humans. (Movies have to fake this by using non-painful sounds and having the actors writhe dramatically -- something every third Star Trek episode seemed to indulge in.) Prose, by contrast can describe sound by metaphor, suggesting a far richer experience than a mere speaker can produce. So, you treat sound differently in prose and on video. What you are proposing is to represent sound through a font change. This is not part of the common palette of prose, so reader will not know what to make of it. This will tend to pull them out of the story world to ponder the meaning of your typography. But more importantly, there are other, richer, and more conventional ways to handle this in prose. You can describe the nature of the sound the first time it is heard, but if you really want to make a voice distinctive in prose, your best tools are distinct diction and distinct message (what is said, and the words chosen). Don't try to extend the palette of prose; try to become a master of the whole of the existing palette. It is more than adequate for any story you might wish to tell.
As noted above, "generally inadvisable" is on the mark. However, if you consider your book to be more along the lines of entertainment, than along the lines of literature, you might do it. Really, the choice is yours. Think of it this way: If you show up for a job interview, you dress in accordance with expectations. Same with books. I write this not as a reviewer or publsher, but as someone who has browsed many books on the library shelves, always fiction, not necessarily in a genre that appeals to me. Although books with prominent decorative elements (including styled text) are uncommon, they are occasionally seen among recently-issued popular books, probably because those books are intended to appeal to the "soon to be a movie or TV show" market.
27,558
In the current draft of my book, the evil dictator whose body is encased in a silver alloy talks basically by allowing magic to move to seep into the silver shell, dispelling it and causing vibrations. This voice sounds alien, imperial, and metallic. In order to represent this, I'm currently using a different font. (Specifically Kino MT.) I do something similar with a group that constantly wear helmets that filter out certain wavelengths of sound, and use the 'Cracked' font. They also sometimes speak in an imperial dialect which I represent with angle brackets. Is this just going to reek of tacky amateurishness and such?
2017/04/15
[ "https://writers.stackexchange.com/questions/27558", "https://writers.stackexchange.com", "https://writers.stackexchange.com/users/23486/" ]
This is generally inadvisable (which is not to say that it is not done sometimes). The reason it is inadvisable is that every artform has its palette, its set of devices and conventions by which it tells its story. Mastering any art form is about learning how to tell the story within the confines of that palette. One of the limits of the prose palette is that is does not support sound effects. You can describe sounds with words, but you cannot reproduce them. One of the limits of the movie palette is that you cannot describe sounds, you can only make them. This means that all sounds in a movie are presented literally, and that it is impractical to present sounds that are injurious or painful to humans. (Movies have to fake this by using non-painful sounds and having the actors writhe dramatically -- something every third Star Trek episode seemed to indulge in.) Prose, by contrast can describe sound by metaphor, suggesting a far richer experience than a mere speaker can produce. So, you treat sound differently in prose and on video. What you are proposing is to represent sound through a font change. This is not part of the common palette of prose, so reader will not know what to make of it. This will tend to pull them out of the story world to ponder the meaning of your typography. But more importantly, there are other, richer, and more conventional ways to handle this in prose. You can describe the nature of the sound the first time it is heard, but if you really want to make a voice distinctive in prose, your best tools are distinct diction and distinct message (what is said, and the words chosen). Don't try to extend the palette of prose; try to become a master of the whole of the existing palette. It is more than adequate for any story you might wish to tell.
In my humble opinion, don't. You'd have to explain what the different fonts mean. You can't expect the reader to guess. Perhaps that could be done smoothly. If I was reading a story I'd find it rather jarring, tearing me out of immersion in the story, if there was a note in the middle of the story that said, "When I use this font it means ..." That's breaking the fourth wall. Okay, maybe you could slip it in more subtly. Like the first time you use it you say, "Then the dictator spoke by blah blah" and then give the text in this different font and the user should get it. How many different fonts are you thinking of using, and how distinctive are they? Readers will have to be able to instantly distinguish the different fonts and remember what they mean. You may say, "Well obviously this is Garamond and that's Times Roman", but that may not be so obvious to a reader who isn't much interested in fonts. I'd guess publishers would not appreciate the extra expense for typesetting and proof-reading. I've read a few stories where they used different fonts for different types of speech, or a different font for voice versus telepathy, or humans versus robots, or whatever. Generally I've just found it gimmicky and distracting.
27,558
In the current draft of my book, the evil dictator whose body is encased in a silver alloy talks basically by allowing magic to move to seep into the silver shell, dispelling it and causing vibrations. This voice sounds alien, imperial, and metallic. In order to represent this, I'm currently using a different font. (Specifically Kino MT.) I do something similar with a group that constantly wear helmets that filter out certain wavelengths of sound, and use the 'Cracked' font. They also sometimes speak in an imperial dialect which I represent with angle brackets. Is this just going to reek of tacky amateurishness and such?
2017/04/15
[ "https://writers.stackexchange.com/questions/27558", "https://writers.stackexchange.com", "https://writers.stackexchange.com/users/23486/" ]
This is generally inadvisable (which is not to say that it is not done sometimes). The reason it is inadvisable is that every artform has its palette, its set of devices and conventions by which it tells its story. Mastering any art form is about learning how to tell the story within the confines of that palette. One of the limits of the prose palette is that is does not support sound effects. You can describe sounds with words, but you cannot reproduce them. One of the limits of the movie palette is that you cannot describe sounds, you can only make them. This means that all sounds in a movie are presented literally, and that it is impractical to present sounds that are injurious or painful to humans. (Movies have to fake this by using non-painful sounds and having the actors writhe dramatically -- something every third Star Trek episode seemed to indulge in.) Prose, by contrast can describe sound by metaphor, suggesting a far richer experience than a mere speaker can produce. So, you treat sound differently in prose and on video. What you are proposing is to represent sound through a font change. This is not part of the common palette of prose, so reader will not know what to make of it. This will tend to pull them out of the story world to ponder the meaning of your typography. But more importantly, there are other, richer, and more conventional ways to handle this in prose. You can describe the nature of the sound the first time it is heard, but if you really want to make a voice distinctive in prose, your best tools are distinct diction and distinct message (what is said, and the words chosen). Don't try to extend the palette of prose; try to become a master of the whole of the existing palette. It is more than adequate for any story you might wish to tell.
I'm neither a full-blow writer (yet) nor professional reviewer, but as an avid reader and a lover of all good stories, I do have a couple of thoughts on this... First off, many people do hold that, as another answer-er has already noted, certain elements of art should be reserved to their prospective fields. And to an extent, I do agree with this. C. S. Lewis of *Chronicles of Narnia* fame thought this way, as he explains in the preface to his work, *Mere Christianity*. This book first came to being as a series of radio talks he did for the BBC during the time of WWII, then eventually collected together and published as separate mini-books on the topic of Christian Apologetics. However, he later came back and re-published the whole set together as one book, making a handful of changes here and there where he thought they were needed. One of the main things he had changed was the way in which he emphasized certain words. In the first publication, he had *italicized* words where he had added extra emphasis in the radio talk, yet in the second publication he removed this trend. He felt that it mixed the two art forms together, and that there were move appropriate ways to achieve the same effect, yet still retain the proper identities of the individual art forms. A speaker must use volume and enunciation to put emphasis on his words, whereas a writer may play around with the construction of the sentence and surrounding words to get that result. On the other hand, one of my favorite fantasy authors, Wayne Thomas Batson, employs a technique similar to what you are describing in several of his works. In his *The Berinfell Prophecies* series, whenever characters are reading from an ancient and somewhat "magical" set of histories that come alive by touching the text, the font and color of the pages changes slightly to signify it. However, it should be noted that he does not rely on this effect alone; the style and tone of the writing, as well as the style of the characters' dialog, changes slightly as well to help signify the change in narrators, as the visual effect is only in the print version of the series, and does not appear in the ebook format. Batson also employs this effect in his series, *The Door Within*, where the text in certain places has a colored sheen to it to match the overall color theme of that particular book. Once again, this only occurs in certain versions of the book, and is not relied on to convey much meaning or significance. Instead, it's used more as a extra special effect to make the books have that extra "cool factor", as they are mainly intended for and read by younger audiences (middle school to mid-teen ages). When I first read through this series, I thought it was amazing they had used ink like that, where if you turn it towards the light you can see the color, but if you're in a darker area it simply appears as regular, run-of-the-mill, black ink. To me, it caused the experience to be much more unique, and also meant a lot to me that someone went through the effort of adding that detail. But when I got to the third book, I ended up reading a different edition than I had the first two, and though I did miss the cool ink, the lack of it didn't harm the story or its impact on me in any way, as I soon was fully immersed in the world again and had all-but forgotten the absence of the color. This response has gotten pretty long and rambly, but hopefully it's been helpful to someone. In the end, I would probably say that if you wanted to add an effect such as this to your story, it might add a neat twist and make book stand out a bit in readers' minds. On the other hand, make sure that if you do use it, don't rely on it too heavily, but instead compose your work first, make sure it stands solidly on its own with no extra "special effects", then add those neat touches in later as an added bonus.
27,558
In the current draft of my book, the evil dictator whose body is encased in a silver alloy talks basically by allowing magic to move to seep into the silver shell, dispelling it and causing vibrations. This voice sounds alien, imperial, and metallic. In order to represent this, I'm currently using a different font. (Specifically Kino MT.) I do something similar with a group that constantly wear helmets that filter out certain wavelengths of sound, and use the 'Cracked' font. They also sometimes speak in an imperial dialect which I represent with angle brackets. Is this just going to reek of tacky amateurishness and such?
2017/04/15
[ "https://writers.stackexchange.com/questions/27558", "https://writers.stackexchange.com", "https://writers.stackexchange.com/users/23486/" ]
**Think about it: Are you reading this answer on paper, or on a (color) screen? The convention may change quickly, if readers accept changes** Conventional wisdom says not to play 'games' with typography (until/unless one is a big-name author), but that convention is based back in the history/technology/economics of movable type and printing presses. However, if we write and read primarily on screens, (thus freed from the constraints of paper and printing processes), we can do it differently -- if (and *only* if) the changes tell the story to the intended audience sufficiently better. So much so that the readers' approval is evident to the current gatekeepers. That said, conventions change with the technology and reader expectations/enjoyment. If using different fonts, italics, bold or punctuation unconventionally tells stories more effectively, I think that will *eventually* win out. At present, the expectations of agents, editors and publishers are the gatekeepers, but those gates aren't locked -- and effective storytelling is the key. Two examples of interest: In *Startide Rising*, author David Brin used a variety of typographic signs (uppercase, paired punctuation marks such as '::') to indicate alien/telepathic 'speech.' It was his second novel published, and won the Hugo award. In *The Stars My Destination*, Alfred Bester uses some interesting language-on-paper techniques to convey synesthesia (a scrambling between senses.) Most serious fans consider it one of his best books. Your mileage may vary; I'm hoping the conventions evolve.
As noted above, "generally inadvisable" is on the mark. However, if you consider your book to be more along the lines of entertainment, than along the lines of literature, you might do it. Really, the choice is yours. Think of it this way: If you show up for a job interview, you dress in accordance with expectations. Same with books. I write this not as a reviewer or publsher, but as someone who has browsed many books on the library shelves, always fiction, not necessarily in a genre that appeals to me. Although books with prominent decorative elements (including styled text) are uncommon, they are occasionally seen among recently-issued popular books, probably because those books are intended to appeal to the "soon to be a movie or TV show" market.
27,558
In the current draft of my book, the evil dictator whose body is encased in a silver alloy talks basically by allowing magic to move to seep into the silver shell, dispelling it and causing vibrations. This voice sounds alien, imperial, and metallic. In order to represent this, I'm currently using a different font. (Specifically Kino MT.) I do something similar with a group that constantly wear helmets that filter out certain wavelengths of sound, and use the 'Cracked' font. They also sometimes speak in an imperial dialect which I represent with angle brackets. Is this just going to reek of tacky amateurishness and such?
2017/04/15
[ "https://writers.stackexchange.com/questions/27558", "https://writers.stackexchange.com", "https://writers.stackexchange.com/users/23486/" ]
**Think about it: Are you reading this answer on paper, or on a (color) screen? The convention may change quickly, if readers accept changes** Conventional wisdom says not to play 'games' with typography (until/unless one is a big-name author), but that convention is based back in the history/technology/economics of movable type and printing presses. However, if we write and read primarily on screens, (thus freed from the constraints of paper and printing processes), we can do it differently -- if (and *only* if) the changes tell the story to the intended audience sufficiently better. So much so that the readers' approval is evident to the current gatekeepers. That said, conventions change with the technology and reader expectations/enjoyment. If using different fonts, italics, bold or punctuation unconventionally tells stories more effectively, I think that will *eventually* win out. At present, the expectations of agents, editors and publishers are the gatekeepers, but those gates aren't locked -- and effective storytelling is the key. Two examples of interest: In *Startide Rising*, author David Brin used a variety of typographic signs (uppercase, paired punctuation marks such as '::') to indicate alien/telepathic 'speech.' It was his second novel published, and won the Hugo award. In *The Stars My Destination*, Alfred Bester uses some interesting language-on-paper techniques to convey synesthesia (a scrambling between senses.) Most serious fans consider it one of his best books. Your mileage may vary; I'm hoping the conventions evolve.
In my humble opinion, don't. You'd have to explain what the different fonts mean. You can't expect the reader to guess. Perhaps that could be done smoothly. If I was reading a story I'd find it rather jarring, tearing me out of immersion in the story, if there was a note in the middle of the story that said, "When I use this font it means ..." That's breaking the fourth wall. Okay, maybe you could slip it in more subtly. Like the first time you use it you say, "Then the dictator spoke by blah blah" and then give the text in this different font and the user should get it. How many different fonts are you thinking of using, and how distinctive are they? Readers will have to be able to instantly distinguish the different fonts and remember what they mean. You may say, "Well obviously this is Garamond and that's Times Roman", but that may not be so obvious to a reader who isn't much interested in fonts. I'd guess publishers would not appreciate the extra expense for typesetting and proof-reading. I've read a few stories where they used different fonts for different types of speech, or a different font for voice versus telepathy, or humans versus robots, or whatever. Generally I've just found it gimmicky and distracting.
27,558
In the current draft of my book, the evil dictator whose body is encased in a silver alloy talks basically by allowing magic to move to seep into the silver shell, dispelling it and causing vibrations. This voice sounds alien, imperial, and metallic. In order to represent this, I'm currently using a different font. (Specifically Kino MT.) I do something similar with a group that constantly wear helmets that filter out certain wavelengths of sound, and use the 'Cracked' font. They also sometimes speak in an imperial dialect which I represent with angle brackets. Is this just going to reek of tacky amateurishness and such?
2017/04/15
[ "https://writers.stackexchange.com/questions/27558", "https://writers.stackexchange.com", "https://writers.stackexchange.com/users/23486/" ]
**Think about it: Are you reading this answer on paper, or on a (color) screen? The convention may change quickly, if readers accept changes** Conventional wisdom says not to play 'games' with typography (until/unless one is a big-name author), but that convention is based back in the history/technology/economics of movable type and printing presses. However, if we write and read primarily on screens, (thus freed from the constraints of paper and printing processes), we can do it differently -- if (and *only* if) the changes tell the story to the intended audience sufficiently better. So much so that the readers' approval is evident to the current gatekeepers. That said, conventions change with the technology and reader expectations/enjoyment. If using different fonts, italics, bold or punctuation unconventionally tells stories more effectively, I think that will *eventually* win out. At present, the expectations of agents, editors and publishers are the gatekeepers, but those gates aren't locked -- and effective storytelling is the key. Two examples of interest: In *Startide Rising*, author David Brin used a variety of typographic signs (uppercase, paired punctuation marks such as '::') to indicate alien/telepathic 'speech.' It was his second novel published, and won the Hugo award. In *The Stars My Destination*, Alfred Bester uses some interesting language-on-paper techniques to convey synesthesia (a scrambling between senses.) Most serious fans consider it one of his best books. Your mileage may vary; I'm hoping the conventions evolve.
I'm neither a full-blow writer (yet) nor professional reviewer, but as an avid reader and a lover of all good stories, I do have a couple of thoughts on this... First off, many people do hold that, as another answer-er has already noted, certain elements of art should be reserved to their prospective fields. And to an extent, I do agree with this. C. S. Lewis of *Chronicles of Narnia* fame thought this way, as he explains in the preface to his work, *Mere Christianity*. This book first came to being as a series of radio talks he did for the BBC during the time of WWII, then eventually collected together and published as separate mini-books on the topic of Christian Apologetics. However, he later came back and re-published the whole set together as one book, making a handful of changes here and there where he thought they were needed. One of the main things he had changed was the way in which he emphasized certain words. In the first publication, he had *italicized* words where he had added extra emphasis in the radio talk, yet in the second publication he removed this trend. He felt that it mixed the two art forms together, and that there were move appropriate ways to achieve the same effect, yet still retain the proper identities of the individual art forms. A speaker must use volume and enunciation to put emphasis on his words, whereas a writer may play around with the construction of the sentence and surrounding words to get that result. On the other hand, one of my favorite fantasy authors, Wayne Thomas Batson, employs a technique similar to what you are describing in several of his works. In his *The Berinfell Prophecies* series, whenever characters are reading from an ancient and somewhat "magical" set of histories that come alive by touching the text, the font and color of the pages changes slightly to signify it. However, it should be noted that he does not rely on this effect alone; the style and tone of the writing, as well as the style of the characters' dialog, changes slightly as well to help signify the change in narrators, as the visual effect is only in the print version of the series, and does not appear in the ebook format. Batson also employs this effect in his series, *The Door Within*, where the text in certain places has a colored sheen to it to match the overall color theme of that particular book. Once again, this only occurs in certain versions of the book, and is not relied on to convey much meaning or significance. Instead, it's used more as a extra special effect to make the books have that extra "cool factor", as they are mainly intended for and read by younger audiences (middle school to mid-teen ages). When I first read through this series, I thought it was amazing they had used ink like that, where if you turn it towards the light you can see the color, but if you're in a darker area it simply appears as regular, run-of-the-mill, black ink. To me, it caused the experience to be much more unique, and also meant a lot to me that someone went through the effort of adding that detail. But when I got to the third book, I ended up reading a different edition than I had the first two, and though I did miss the cool ink, the lack of it didn't harm the story or its impact on me in any way, as I soon was fully immersed in the world again and had all-but forgotten the absence of the color. This response has gotten pretty long and rambly, but hopefully it's been helpful to someone. In the end, I would probably say that if you wanted to add an effect such as this to your story, it might add a neat twist and make book stand out a bit in readers' minds. On the other hand, make sure that if you do use it, don't rely on it too heavily, but instead compose your work first, make sure it stands solidly on its own with no extra "special effects", then add those neat touches in later as an added bonus.
752,003
I am trying to migrate both the only vCSA and the VMKernel interface in my ESXi host from a standard vSwitch to a vDS, and that gave me all kinds of mess. How to do that properly? Bear in mind that the host in question also have the virtual machine that performs as the router. My intended setup: The host: ``` [ ]- vmnic0 -+- LACP --- Switch 1 (managed) Internet --- vmnic3 -[ Host ]- vmnic1 -+ [ ]- vmnic2 --- Switch 2 (unmanaged) ``` vSwitch0: ``` vmnic3 --[ vSwitch0 ]-- vRouter ``` vDS: ``` vmnic0 -+- LAG1 --[ ]-- vRouter vmnic1 -+ [ vDS ]-- vCSA vmnic2 --[ ]-- vmk0 (management network) ``` vRouter (OS: Ubuntu Linux): ``` vSwitch0 --[ vRouter ]-- vDS ``` vCSA (and other VMs): ``` vDS --[ vCSA ] ``` Other physical computers are attached on `Switch1` or `Switch2`. There is also another ESXi host.
2016/01/27
[ "https://serverfault.com/questions/752003", "https://serverfault.com", "https://serverfault.com/users/291626/" ]
Caveat: *I don't think a distributed switch or LACP belong here. And this definitely doesn't sound like an environment with VMware Enterprise licensing...* But use the network migration tool in VMware. This is [fully-documented](https://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.vsphere.networking.doc%2FGUID-0E5B9FC3-5176-4223-8F08-3C3F08C12ECD.html) and a supported means of migrating virtual and physical adapters from Standard vSwitches to vDS.
I think you should migrate in two steps, first to a vDS without LACP and then enable LACP. The first step should be straight-forward: Create the vDS and port groups you need and set vmnic0 as the first uplink and migrate your vmknics and vCenter to the vDS. Then set vmnic1 as the second uplink for your vDS. Then [migrate to LACP](http://pubs.vmware.com/vsphere-55/topic/com.vmware.vsphere.networking.doc/GUID-45DF45A6-DBDB-4386-85BF-400797683D05.html). I've stumbled on an interesting blog posting recently: [Disabling vSphere vDS Network Rollback](http://vwud.net/2016/02/16/disabling-vsphere-vds-network-rollback/). Maybe this can help you, too.
752,003
I am trying to migrate both the only vCSA and the VMKernel interface in my ESXi host from a standard vSwitch to a vDS, and that gave me all kinds of mess. How to do that properly? Bear in mind that the host in question also have the virtual machine that performs as the router. My intended setup: The host: ``` [ ]- vmnic0 -+- LACP --- Switch 1 (managed) Internet --- vmnic3 -[ Host ]- vmnic1 -+ [ ]- vmnic2 --- Switch 2 (unmanaged) ``` vSwitch0: ``` vmnic3 --[ vSwitch0 ]-- vRouter ``` vDS: ``` vmnic0 -+- LAG1 --[ ]-- vRouter vmnic1 -+ [ vDS ]-- vCSA vmnic2 --[ ]-- vmk0 (management network) ``` vRouter (OS: Ubuntu Linux): ``` vSwitch0 --[ vRouter ]-- vDS ``` vCSA (and other VMs): ``` vDS --[ vCSA ] ``` Other physical computers are attached on `Switch1` or `Switch2`. There is also another ESXi host.
2016/01/27
[ "https://serverfault.com/questions/752003", "https://serverfault.com", "https://serverfault.com/users/291626/" ]
I don't follow your question very well, but I will make a suggestion all the same. If VC looses network connection during a network reconfig, the change is automatically reverted (sometimes), even if it is only for a moment. I would suggest putting your VCSA onto a temporary second network (so you have two routes), this way you can stop using the primary net while you do the moving around.
I think you should migrate in two steps, first to a vDS without LACP and then enable LACP. The first step should be straight-forward: Create the vDS and port groups you need and set vmnic0 as the first uplink and migrate your vmknics and vCenter to the vDS. Then set vmnic1 as the second uplink for your vDS. Then [migrate to LACP](http://pubs.vmware.com/vsphere-55/topic/com.vmware.vsphere.networking.doc/GUID-45DF45A6-DBDB-4386-85BF-400797683D05.html). I've stumbled on an interesting blog posting recently: [Disabling vSphere vDS Network Rollback](http://vwud.net/2016/02/16/disabling-vsphere-vds-network-rollback/). Maybe this can help you, too.
52,128,296
After update I found that `getLoaderManager` is deprecated but I can't find that should I use instead of. How to get `LoaderManager`? Or what should I use instead of `Loader`s?
2018/09/01
[ "https://Stackoverflow.com/questions/52128296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3253896/" ]
Loaders have been deprecated as of Android P (API 28). The recommended option for dealing with loading data while handling the Activity and Fragment lifecycles is to use a combination of ViewModels and LiveData.ViewModels survive configuration changes like Loaders but with less boilerplate. LiveData provides a lifecycle-aware way of loading data that you can reuse in multiple ViewModels.
The deprecated `getLoaderManager` has been replaced with `getSupportLoaderManager`. Try: ``` getSupportLoaderManager().initLoader(LOADER_NOTES, null, this); ``` Works for me in API 28.
52,128,296
After update I found that `getLoaderManager` is deprecated but I can't find that should I use instead of. How to get `LoaderManager`? Or what should I use instead of `Loader`s?
2018/09/01
[ "https://Stackoverflow.com/questions/52128296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3253896/" ]
Loaders have been deprecated as of Android P (API 28). The recommended option for dealing with loading data while handling the Activity and Fragment lifecycles is to use a combination of ViewModels and LiveData.ViewModels survive configuration changes like Loaders but with less boilerplate. LiveData provides a lifecycle-aware way of loading data that you can reuse in multiple ViewModels.
getLoaderManager has been deprecated, use LoaderManager getInstance instead: ``` LoaderManager.getInstance(this).initLoader(0, null, this); ```
52,128,296
After update I found that `getLoaderManager` is deprecated but I can't find that should I use instead of. How to get `LoaderManager`? Or what should I use instead of `Loader`s?
2018/09/01
[ "https://Stackoverflow.com/questions/52128296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3253896/" ]
getLoaderManager has been deprecated, use LoaderManager getInstance instead: ``` LoaderManager.getInstance(this).initLoader(0, null, this); ```
The deprecated `getLoaderManager` has been replaced with `getSupportLoaderManager`. Try: ``` getSupportLoaderManager().initLoader(LOADER_NOTES, null, this); ``` Works for me in API 28.
53,031,446
I am creating an SSIS package which has an execute SQL task and it passes result set variable to a for each loop container. My Sql Query is: ``` Select distinct code from house where active=1 and campus='W' ``` I want the execute sql task to run this query and assign its results to a variable which is passed to a for each loop container which should loop through all the values in the result set. But my execute sql task fails with error: > > The type of the value (DBNull) being assigned to variable > "User::house" differs from the current variable type (String) > > > Now i have done my research and i have tried assigning the variable datatype Object but did not work. I tried using cast in my sql query and that also did not work. Since my query returns multiple rows and one column, i am not sure how i can assign a datatype to the whole query? Sample: * Code * AR * BN * CN
2018/10/28
[ "https://Stackoverflow.com/questions/53031446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9287744/" ]
It sounds like you have a variety of issues in here. Result Set ========== The first is in your Execute SQL Task and the need for agreement between the `Result Set` specification and the data type of the Variable(s) specified in the Result Set tab. If you specify Full Resultset, then the receiving object *must* be of type System::Object and you will only have 1 result set. The type of Connection Manager (ODBC/OLE/ADO) used will determine how you specify it but it's infinitely searchable on these fine forums. The other two options are Single Row and XML. In 13 years of working with SSIS, I've never had cause to specify XML. That leaves us with Single Row. For a Single Row Result Set, you need to provide a variable for each column returned **and** it needs to be correctly typed. To correct your issue, you need to declare a second variable. I usually call my rsObject (record set object) and then specify the data type as System.Object. For Each Loop Container ======================= Your For Each Loop Container will then be set with an Enumerator of "Foreach ADO Enumerator" and then the ADO object source variable will become "User::rsObject" In the Variable Mappings, you'll specify your variable User::house to index 0. Testing ------- Given a sample set of source source data, you can verify that you have your Execute SQL Task correctly assigning a result set to our object and the Foreach Loop Container is properly populating our variable. ``` SELECT DISTINCT code FROM ( VALUES ('ABC', 1, 'w') , ('BCD', 1, 'w') , ('CDE', 0, 'w') , ('DEF', 1, 'w') , ('EFG', 1, 'x') ) house(code, active, campus) WHERE active = 1 AND campus = 'w'; ``` If you change the value of campus from `w` to something that doesn't exist, like `f` then things will continue to work. However, the error you're receiving can only be generated if the code is a NULL Add one more entry to the VALUES collection like ``` , (NULL, 1, 'w') ``` and when the For Each Loop Container hits that value, you will encounter the error you indicate > > The type of the value (DBNull) being assigned to variable "User::house" differs from the current variable type (String) > > > Now what? --------- SSIS variables cannot change their data type, unless they're of type Object (but that's not the solution here). The "problem" is that you cannot store a NULL value in an SSIS variable (unless it's of type object). Therefore you need to either exclude the rows that return a NULL (`AND code IS NOT NULL`) or you need to cast the NULL into sentinel/placeholder value as a substitute (`SELECT DISTINCT ISNULL(code, '') AS code`). If an empty string is a valid value, then you need to find something that isn't - "billinkcisthegreatestever10123432" is unlikely to exist in your set of codes but that might be a bit excessive. Finally, think about renaming your SSIS variable from `house` to `code`. You might be able to keep things straight but some day you'll hand this code over to someone else for maintenance and you don't want to confuse them. A picturesque answer <https://stackoverflow.com/a/13976990/181965>
the variable "User::house" is string , so , did you use it in result set?
53,031,446
I am creating an SSIS package which has an execute SQL task and it passes result set variable to a for each loop container. My Sql Query is: ``` Select distinct code from house where active=1 and campus='W' ``` I want the execute sql task to run this query and assign its results to a variable which is passed to a for each loop container which should loop through all the values in the result set. But my execute sql task fails with error: > > The type of the value (DBNull) being assigned to variable > "User::house" differs from the current variable type (String) > > > Now i have done my research and i have tried assigning the variable datatype Object but did not work. I tried using cast in my sql query and that also did not work. Since my query returns multiple rows and one column, i am not sure how i can assign a datatype to the whole query? Sample: * Code * AR * BN * CN
2018/10/28
[ "https://Stackoverflow.com/questions/53031446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9287744/" ]
It sounds like you have a variety of issues in here. Result Set ========== The first is in your Execute SQL Task and the need for agreement between the `Result Set` specification and the data type of the Variable(s) specified in the Result Set tab. If you specify Full Resultset, then the receiving object *must* be of type System::Object and you will only have 1 result set. The type of Connection Manager (ODBC/OLE/ADO) used will determine how you specify it but it's infinitely searchable on these fine forums. The other two options are Single Row and XML. In 13 years of working with SSIS, I've never had cause to specify XML. That leaves us with Single Row. For a Single Row Result Set, you need to provide a variable for each column returned **and** it needs to be correctly typed. To correct your issue, you need to declare a second variable. I usually call my rsObject (record set object) and then specify the data type as System.Object. For Each Loop Container ======================= Your For Each Loop Container will then be set with an Enumerator of "Foreach ADO Enumerator" and then the ADO object source variable will become "User::rsObject" In the Variable Mappings, you'll specify your variable User::house to index 0. Testing ------- Given a sample set of source source data, you can verify that you have your Execute SQL Task correctly assigning a result set to our object and the Foreach Loop Container is properly populating our variable. ``` SELECT DISTINCT code FROM ( VALUES ('ABC', 1, 'w') , ('BCD', 1, 'w') , ('CDE', 0, 'w') , ('DEF', 1, 'w') , ('EFG', 1, 'x') ) house(code, active, campus) WHERE active = 1 AND campus = 'w'; ``` If you change the value of campus from `w` to something that doesn't exist, like `f` then things will continue to work. However, the error you're receiving can only be generated if the code is a NULL Add one more entry to the VALUES collection like ``` , (NULL, 1, 'w') ``` and when the For Each Loop Container hits that value, you will encounter the error you indicate > > The type of the value (DBNull) being assigned to variable "User::house" differs from the current variable type (String) > > > Now what? --------- SSIS variables cannot change their data type, unless they're of type Object (but that's not the solution here). The "problem" is that you cannot store a NULL value in an SSIS variable (unless it's of type object). Therefore you need to either exclude the rows that return a NULL (`AND code IS NOT NULL`) or you need to cast the NULL into sentinel/placeholder value as a substitute (`SELECT DISTINCT ISNULL(code, '') AS code`). If an empty string is a valid value, then you need to find something that isn't - "billinkcisthegreatestever10123432" is unlikely to exist in your set of codes but that might be a bit excessive. Finally, think about renaming your SSIS variable from `house` to `code`. You might be able to keep things straight but some day you'll hand this code over to someone else for maintenance and you don't want to confuse them. A picturesque answer <https://stackoverflow.com/a/13976990/181965>
you need declare son "object" var for result set [result set](https://i.stack.imgur.com/PzzeA.jpg) then declare a string variable for every single Code from your result [For Each Loop Container](https://i.stack.imgur.com/MqU7T.jpg) good luck
41,453
I am using SP2010 with infopath 2010. i've designed a custom approval which contains one approval process. this workflow prompts users to fill in reviewer, CC and comments on the workflow initialization form. this form has 2 people picker field one for reviewer and one for CC and both are enabled to accept multiple values. The problem i am having is when i add user to reviewer and CC people picker control and click on start to start the workflow it's showing me "The form cannot be submitted beacuse of an error" error. If i leave the CC field blank the workflow runs fine. As far as i know i haven't changed anything on the server (production). Production server is SP Server 2010 without any SP1 installation. IIS long error on production server: > > Event: 5374 > Source: inforpath forms services > Task category: Runtime - Business Logic > Error: There was a form postback error. (User: 0#.w|username, Form Name: Template, IP: , Request:SiteURL/\_layouts/IniWrkflIP.aspx?List={aac38048-177c-48b5-9bd1-87f888bf9541}&ID=172&TemplateID={383e9f7c-b111-4daa-979d-7b06c1459efb}&Source=http://Site URL /Forms/Main%2520Overview.aspx, Form ID: urn:schemas-microsoft-com:office:infopath:workflowInitAssoc:-AutoGen-2012-07-19T10:25:12:594Z, Type: SchemaValidationException, Exception Message: Schema validation found non-datatype errors.) > > > Any help would be appreciated.
2012/07/20
[ "https://sharepoint.stackexchange.com/questions/41453", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/9588/" ]
I've encountered the same issue and I had the SP1 for SharePoint Designer2010 already installed. SP D2010 Version : 14.0.6123.5001 (32-bit) with SP1 The issue : --- I am using SP2010 with infopath 2010. i've designed a custom approval which contains one approval process. this workflow prompts users to fill in reviewer, CC and comments on the workflow initialization form. this form has 2 people picker field one for reviewer and one for CC and both are enabled to accept multiple values. The problem i am having is when i add user to reviewer and CC people picker control and click on start to start the workflow it's showing me "The form cannot be submitted beacuse of an error" error. If i leave the CC field blank the workflow runs fine. --- So, as I said, the SP1 is installed and that didn't solve the issue. As suggested, I've tried to delete the InfoPath document (.xsn) and republish the workflow in order to get the .xsn regenerated but it did not solve my issue. Finaly, I solved the issue doing the following steps : 1) In SharePoint Designer, go to All File and get to the concerned workflow 2) Open and edit its .xoml.wconfig.xml file (the config file) 3) Scrool down in order to get to the Approvers section : 4) Delete **xsi:nil="true"** in the *Approvers* and *CC* feilds (see code below): ``` <d:Approvers > <d:Assignment > <d:Assignee/> <d:Stage xsi:nil="true"/> <d:AssignmentType>Serial</d:AssignmentType> </d:Assignment > </d:Approvers xsi:nil="true"> <!-- instead it must be </d:Approvers> --> <d:ExpandGroups>true</d:ExpandGroups> <d:NotificationMessage/> <d:DueDateforAllTasks xsi:nil="true"/> <d:DurationforSerialTasks xsi:nil="true"/> <d:DurationUnits>Day</d:DurationUnits> <d:CC xsi:nil="true"/> <!-- instead it must be <d:CC/> --> <d:CancelonRejection>false</d:CancelonRejection> <d:CancelonChange>false</d:CancelonChange> <d:EnableContentApproval>false</d:EnableContentApproval> ``` 5) Save (ctrl+s), close SharePoint Designer, reopen it and publish the workflow. 6) You can now retest the workflow startup from SharePoint and wish not to get the error! ;) It worked for me. I hope this has been helpfull to you as well.
The author of this question answered it in comment to the original question by: > > This is now fixed. Came through below article on internet which seems > to have fixed my problem > <http://social.technet.microsoft.com/Forums/en-US/sharepoint2010customization/thread/a3c27dd4-baca-4ca6-a27c-82f2706bc9dc> > > > I couldn't find any answer in the mentioned reference but after reading a dozen of enclosed references and subreferences (links and sublinks) made me to believe that the only given answer was in a sub-sub-link (sub-sub-reference), 2 hops away from the mentioned discussion: * [I had this exact problem, checked it on several different environments and in the end it turned out that if I did my customizations from the 64bit version of SharePoint Designer it all worked well](http://social.technet.microsoft.com/Forums/en-US/sharepoint2010customization/thread/a3c27dd4-baca-4ca6-a27c-82f2706bc9dc/#c8732ad4-fccb-44c2-8d35-819304a6f8d5).
1,257,867
I have the following code ``` <?php $doc = new DOMDocument; $doc->loadhtml('<html> <head> <title>bar , this is an example</title> </head> <body> <h1>latest news</h1> foo <strong>bar</strong> <i>foobar</i> </body> </html>'); $xpath = new DOMXPath($doc); foreach($xpath->query('//*[contains(child::text(),"bar")]') as $e) { echo $e->tagName, "\n"; } ``` Prints ``` title strong i ``` this code finds any HTML element that contains the word "bar" and it matches words that has "bar" like "foobar" I want to change the query to match only the word "bar" without any prefix or postfix I think it can be solved by changing the query to search for every "bar" that has not got a letter after or before or has a space after or before this code from a past question [here](https://stackoverflow.com/questions/1231606/how-to-figure-out-the-location-of-a-keyword-in-an-html-document) by [VolkerK](https://stackoverflow.com/users/4833/volkerk) Thanks
2009/08/11
[ "https://Stackoverflow.com/questions/1257867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459737/" ]
I might be wrong, but in Win32 land you don't get mouse move messages when the mouse is at the edge of the screen because, well, the mouse isn't moving. The usual way to get an infinite mouse area is to do the following: 1. Hide the mouse, get exclusive access and record position 2. Centre mouse to window 3. When mouse moves, get delta from centre of screen to current position 4. Centre mouse to window again 5. The next mouse move should have a delta of (0,0), so ignore it 6. Go to 3 until end of mouse move operation 7. Reset position, show the mouse and release exclusive access If you didn't hide the mouse, then you'd see the mouse moving a small distance and then snapping back to the centre position, which looks nasty. This method does require a message pump for the mouse move messages so the console application idea probably won't work with this. Can you create a full screen invisible window for grabbing the mouse?
Just get the position, and move it to the center and return the delta yourself This is how FPS games do it
1,257,867
I have the following code ``` <?php $doc = new DOMDocument; $doc->loadhtml('<html> <head> <title>bar , this is an example</title> </head> <body> <h1>latest news</h1> foo <strong>bar</strong> <i>foobar</i> </body> </html>'); $xpath = new DOMXPath($doc); foreach($xpath->query('//*[contains(child::text(),"bar")]') as $e) { echo $e->tagName, "\n"; } ``` Prints ``` title strong i ``` this code finds any HTML element that contains the word "bar" and it matches words that has "bar" like "foobar" I want to change the query to match only the word "bar" without any prefix or postfix I think it can be solved by changing the query to search for every "bar" that has not got a letter after or before or has a space after or before this code from a past question [here](https://stackoverflow.com/questions/1231606/how-to-figure-out-the-location-of-a-keyword-in-an-html-document) by [VolkerK](https://stackoverflow.com/users/4833/volkerk) Thanks
2009/08/11
[ "https://Stackoverflow.com/questions/1257867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459737/" ]
I might be wrong, but in Win32 land you don't get mouse move messages when the mouse is at the edge of the screen because, well, the mouse isn't moving. The usual way to get an infinite mouse area is to do the following: 1. Hide the mouse, get exclusive access and record position 2. Centre mouse to window 3. When mouse moves, get delta from centre of screen to current position 4. Centre mouse to window again 5. The next mouse move should have a delta of (0,0), so ignore it 6. Go to 3 until end of mouse move operation 7. Reset position, show the mouse and release exclusive access If you didn't hide the mouse, then you'd see the mouse moving a small distance and then snapping back to the centre position, which looks nasty. This method does require a message pump for the mouse move messages so the console application idea probably won't work with this. Can you create a full screen invisible window for grabbing the mouse?
I don't have any direct experience with raw input, which is probably what you need to tap into. [According to MSDN](http://msdn.microsoft.com/en-us/library/bb206183%28VS.85%29.aspx), you have to register the device, then setup your winproc to accept the WM\_INPUT messages and then do your calculations based on the raw data. Here's [another relevant link](http://msdn.microsoft.com/en-us/library/ms645543%28VS.85%29.aspx).
779,153
I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: `backup log dbmcms with truncate_only` DBCC SHRINKFILE ('Wxlog0', TRUNCATEONLY) The name of the db is db\_mcms and the name of the transaction log file is Wxlog0. Neither has helped. I'm not sure what to do next.
2009/04/22
[ "https://Stackoverflow.com/questions/779153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81681/" ]
You may run into this problem if your database is set to autogrow the log & you end up with lots of virtual log files. Run `DBCC LOGINFO('databasename')` & look at the last entry, if this is a 2 then your log file wont shrink. Unlike data files virtual log files cannot be moved around inside the log file. You will need to run BACKUP LOG and DBCC SHRINKFILE several times to get the log file to shrink. For extra bonus points run DBBC LOGINFO in between log & shirks
If you set the recovery mode on the database in 2005 (don't know for pre-2005) it will drop the log file all together and then you can put it back in full recovery mode to restart/recreate the logfile. We ran into this with SQL 2005 express in that we couldn't get near the 4GB limit with data until we changed the recovery mode.
779,153
I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: `backup log dbmcms with truncate_only` DBCC SHRINKFILE ('Wxlog0', TRUNCATEONLY) The name of the db is db\_mcms and the name of the transaction log file is Wxlog0. Neither has helped. I'm not sure what to do next.
2009/04/22
[ "https://Stackoverflow.com/questions/779153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81681/" ]
'sp\_removedbreplication' didn't solve the issue for me as SQL just returned saying that the Database wasn't part of a replication... I found my answer here: * <http://www.sql-server-performance.com/forum/threads/log-file-fails-to-truncate.25410/> * <http://blogs.msdn.com/b/sqlserverfaq/archive/2009/06/01/size-of-the-transaction-log-increasing-and-cannot-be-truncated-or-shrinked-due-to-snapshot-replication.aspx> Basically I had to create a replication, reset all of the replication pointers to Zero; then delete the replication I had just made. i.e. ``` Execute SP_ReplicationDbOption {DBName},Publish,true,1 GO Execute sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1 GO DBCC ShrinkFile({LogFileName},0) GO Execute SP_ReplicationDbOption {DBName},Publish,false,1 GO ```
You cannot shrink a transaction log smaller than its initially created size.
779,153
I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: `backup log dbmcms with truncate_only` DBCC SHRINKFILE ('Wxlog0', TRUNCATEONLY) The name of the db is db\_mcms and the name of the transaction log file is Wxlog0. Neither has helped. I'm not sure what to do next.
2009/04/22
[ "https://Stackoverflow.com/questions/779153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81681/" ]
'sp\_removedbreplication' didn't solve the issue for me as SQL just returned saying that the Database wasn't part of a replication... I found my answer here: * <http://www.sql-server-performance.com/forum/threads/log-file-fails-to-truncate.25410/> * <http://blogs.msdn.com/b/sqlserverfaq/archive/2009/06/01/size-of-the-transaction-log-increasing-and-cannot-be-truncated-or-shrinked-due-to-snapshot-replication.aspx> Basically I had to create a replication, reset all of the replication pointers to Zero; then delete the replication I had just made. i.e. ``` Execute SP_ReplicationDbOption {DBName},Publish,true,1 GO Execute sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1 GO DBCC ShrinkFile({LogFileName},0) GO Execute SP_ReplicationDbOption {DBName},Publish,false,1 GO ```
I know this is a few years old, but wanted to add some info. I found on very large logs, specifically when the DB was not set to backup transaction logs (logs were very big), the first backup of the logs would not set log\_reuse\_wait\_desc to nothing but leave the status as still backing up. This would block the shrink. Running the backup a second time properly reset the log\_reuse\_wait\_desc to NOTHING, allowing the shrink to process.
779,153
I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: `backup log dbmcms with truncate_only` DBCC SHRINKFILE ('Wxlog0', TRUNCATEONLY) The name of the db is db\_mcms and the name of the transaction log file is Wxlog0. Neither has helped. I'm not sure what to do next.
2009/04/22
[ "https://Stackoverflow.com/questions/779153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81681/" ]
Don't you need this ``` DBCC SHRINKFILE ('Wxlog0', 0) ``` Just be sure that you are aware of the dangers: see here: [Do not truncate your ldf files!](http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/do-not-truncate-your-ldf-files) And here [Backup Log with Truncate\_Only: Like a Bear Trap](http://sqlserverpedia.com/blog/sql-server-backup-and-restore/backup-log-with-truncate_only-like-a-bear-trap/)
I know this is a few years old, but wanted to add some info. I found on very large logs, specifically when the DB was not set to backup transaction logs (logs were very big), the first backup of the logs would not set log\_reuse\_wait\_desc to nothing but leave the status as still backing up. This would block the shrink. Running the backup a second time properly reset the log\_reuse\_wait\_desc to NOTHING, allowing the shrink to process.
779,153
I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: `backup log dbmcms with truncate_only` DBCC SHRINKFILE ('Wxlog0', TRUNCATEONLY) The name of the db is db\_mcms and the name of the transaction log file is Wxlog0. Neither has helped. I'm not sure what to do next.
2009/04/22
[ "https://Stackoverflow.com/questions/779153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81681/" ]
This answer has been lifted from [here](http://social.msdn.microsoft.com/Forums/en-US/sqlreplication/thread/34ab68ad-706d-43c4-8def-38c09e3bfc3b/) and is posted here in case the other thread gets deleted: > > The fact that you have non-distributed LSN in the log is the problem. > I have seen this once before not sure why we dont unmark the > transaction as replicated. We will investigate this internally. You > can execute the following command to unmark the transaction as > replicated > > > ``` EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1 ``` > > At this point you should be able to truncate the log. > > >
Put the DB back into Full mode, run the transaction log backup (not just a full backup) and then the shrink. After it's shrunk, you can put the DB back into simple mode and it txn log will stay the same size.
779,153
I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: `backup log dbmcms with truncate_only` DBCC SHRINKFILE ('Wxlog0', TRUNCATEONLY) The name of the db is db\_mcms and the name of the transaction log file is Wxlog0. Neither has helped. I'm not sure what to do next.
2009/04/22
[ "https://Stackoverflow.com/questions/779153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81681/" ]
'sp\_removedbreplication' didn't solve the issue for me as SQL just returned saying that the Database wasn't part of a replication... I found my answer here: * <http://www.sql-server-performance.com/forum/threads/log-file-fails-to-truncate.25410/> * <http://blogs.msdn.com/b/sqlserverfaq/archive/2009/06/01/size-of-the-transaction-log-increasing-and-cannot-be-truncated-or-shrinked-due-to-snapshot-replication.aspx> Basically I had to create a replication, reset all of the replication pointers to Zero; then delete the replication I had just made. i.e. ``` Execute SP_ReplicationDbOption {DBName},Publish,true,1 GO Execute sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1 GO DBCC ShrinkFile({LogFileName},0) GO Execute SP_ReplicationDbOption {DBName},Publish,false,1 GO ```
I had the same problem. I ran an index defrag process but the transaction log became full and the defrag process errored out. The transaction log remained large. I backed up the transaction log then proceeded to shrink the transaction log .ldf file. However the transaction log did not shrink at all. I then issued a "CHECKPOINT" followed by "DBCC DROPCLEANBUFFER" and was able to shrink the transaction log .ldf file thereafter
779,153
I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: `backup log dbmcms with truncate_only` DBCC SHRINKFILE ('Wxlog0', TRUNCATEONLY) The name of the db is db\_mcms and the name of the transaction log file is Wxlog0. Neither has helped. I'm not sure what to do next.
2009/04/22
[ "https://Stackoverflow.com/questions/779153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81681/" ]
I've had the same issue in the past. Normally a shrink and a trn backup need to occur multiple times. In extreme cases I set the DB to "Simple" recovery and then run a shrink operation on the log file. That always works for me. However recently I had a situation where that would not work. The issue was caused by a long running query that did not complete, so any attempts to shrink were useless until I could kill that process then run my shrink operations. We are talking a log file that grew to 60 GB and is now shrunk to 500 MB. Remember, as soon as you change from FULL to Simple recovery mode and do the shrink, dont forget to set it back to FULL. Then immediately afterward you must do a FULL DB backup.
Put the DB back into Full mode, run the transaction log backup (not just a full backup) and then the shrink. After it's shrunk, you can put the DB back into simple mode and it txn log will stay the same size.
779,153
I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: `backup log dbmcms with truncate_only` DBCC SHRINKFILE ('Wxlog0', TRUNCATEONLY) The name of the db is db\_mcms and the name of the transaction log file is Wxlog0. Neither has helped. I'm not sure what to do next.
2009/04/22
[ "https://Stackoverflow.com/questions/779153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81681/" ]
Thank you to everyone for answering. We finally found the issue. In sys.databases, log\_reuse\_wait\_desc was equal to 'replication'. Apparently this means something to the effect of SQL Server waiting for a replication task to finish before it can reuse the log space. Replication has never been used on this DB or this server was toyed with once upon a time on this db. We cleared the incorrect state by running sp\_removedbreplication. After we ran this, backup log and dbcc shrinkfile worked just fine. Definitely one for the bag-of-tricks. Sources: <http://social.technet.microsoft.com/Forums/pt-BR/sqlreplication/thread/34ab68ad-706d-43c4-8def-38c09e3bfc3b> <http://www.eggheadcafe.com/conversation.aspx?messageid=34020486&threadid=33890705>
This answer has been lifted from [here](http://social.msdn.microsoft.com/Forums/en-US/sqlreplication/thread/34ab68ad-706d-43c4-8def-38c09e3bfc3b/) and is posted here in case the other thread gets deleted: > > The fact that you have non-distributed LSN in the log is the problem. > I have seen this once before not sure why we dont unmark the > transaction as replicated. We will investigate this internally. You > can execute the following command to unmark the transaction as > replicated > > > ``` EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1 ``` > > At this point you should be able to truncate the log. > > >
779,153
I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: `backup log dbmcms with truncate_only` DBCC SHRINKFILE ('Wxlog0', TRUNCATEONLY) The name of the db is db\_mcms and the name of the transaction log file is Wxlog0. Neither has helped. I'm not sure what to do next.
2009/04/22
[ "https://Stackoverflow.com/questions/779153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81681/" ]
This answer has been lifted from [here](http://social.msdn.microsoft.com/Forums/en-US/sqlreplication/thread/34ab68ad-706d-43c4-8def-38c09e3bfc3b/) and is posted here in case the other thread gets deleted: > > The fact that you have non-distributed LSN in the log is the problem. > I have seen this once before not sure why we dont unmark the > transaction as replicated. We will investigate this internally. You > can execute the following command to unmark the transaction as > replicated > > > ``` EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1 ``` > > At this point you should be able to truncate the log. > > >
I know this is a few years old, but wanted to add some info. I found on very large logs, specifically when the DB was not set to backup transaction logs (logs were very big), the first backup of the logs would not set log\_reuse\_wait\_desc to nothing but leave the status as still backing up. This would block the shrink. Running the backup a second time properly reset the log\_reuse\_wait\_desc to NOTHING, allowing the shrink to process.
779,153
I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: `backup log dbmcms with truncate_only` DBCC SHRINKFILE ('Wxlog0', TRUNCATEONLY) The name of the db is db\_mcms and the name of the transaction log file is Wxlog0. Neither has helped. I'm not sure what to do next.
2009/04/22
[ "https://Stackoverflow.com/questions/779153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81681/" ]
I've had the same issue in the past. Normally a shrink and a trn backup need to occur multiple times. In extreme cases I set the DB to "Simple" recovery and then run a shrink operation on the log file. That always works for me. However recently I had a situation where that would not work. The issue was caused by a long running query that did not complete, so any attempts to shrink were useless until I could kill that process then run my shrink operations. We are talking a log file that grew to 60 GB and is now shrunk to 500 MB. Remember, as soon as you change from FULL to Simple recovery mode and do the shrink, dont forget to set it back to FULL. Then immediately afterward you must do a FULL DB backup.
You cannot shrink a transaction log smaller than its initially created size.
19,114,532
I'm try to host several domain on the same VPS, using HHVM to serve the pages. I'm wondering how can I write the VirtualHost in order to point the right folder in my /var/www directory ? For example xxx.domain.com >> /var/www/domain.com/
2013/10/01
[ "https://Stackoverflow.com/questions/19114532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/100782/" ]
Good news. Since the release of HHVM 2.3 (Dec 13, 2013), you can run HHVM in FCGI mode. Use either Nginx or Apache and it works wonderfully. Reference: <http://www.hhvm.com/blog/1817/fastercgi-with-hhvm> With an older version of HHVM you can run multiple server instances on internal ports, i.e. 8001, 8002, etc. Then configure Nginx as a reverse proxy. (Apache can do that too). ``` upstream node1{ server 127.0.0.1:8001; } upstream node2{ server 127.0.0.1:8002; } server { ... server_name server1.com; location ~ \.php$ { proxy_pass http://node1; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_redirect off; proxy_buffering off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Ssl on; #only for https } } server { ... server_name server2.com; location ~ \.php$ { proxy_pass http://node2; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_redirect off; proxy_buffering off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Ssl on; #only for https } } ``` Of course this setup takes up a lot of memory. Go with 2.3 if you can upgrade.
Apparently is not yet possible. Accordling to the official [github repository](https://github.com/facebook/hiphop-php) where the code is hosted exists an [open issue](https://github.com/facebook/hiphop-php/issues/885) about the same issue you are asking and it's tag for **wishlist** / **feature request**. Probably the best way to solve this is to run a HHVM server for each domain (mean each domain you need a different root folder) and use Apache or Nginx as proxy.
19,114,532
I'm try to host several domain on the same VPS, using HHVM to serve the pages. I'm wondering how can I write the VirtualHost in order to point the right folder in my /var/www directory ? For example xxx.domain.com >> /var/www/domain.com/
2013/10/01
[ "https://Stackoverflow.com/questions/19114532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/100782/" ]
Apparently is not yet possible. Accordling to the official [github repository](https://github.com/facebook/hiphop-php) where the code is hosted exists an [open issue](https://github.com/facebook/hiphop-php/issues/885) about the same issue you are asking and it's tag for **wishlist** / **feature request**. Probably the best way to solve this is to run a HHVM server for each domain (mean each domain you need a different root folder) and use Apache or Nginx as proxy.
On Nginx, the only way I was able to get this to work was to use `/` as `SourceRoot` for HHVM, and to add a `/` in `fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name;` in my `/etc/nginx/hhvm.conf` file. With that combination, I'm running ~7 sites without a problem so far. I'm running Ubuntu 13.10 64-bit. In `/etc/hhvm/server.hdf`, change `SourceRoot = /var/www` to `SourceRoot = /`: ``` Server { Port = 9000 SourceRoot = / DefaultDocument = index.php } ``` In `/etc/nginx/hhvm.conf`, add a / in front of `$document_root$fastcgi_script_name;`: ``` location ~ \.php$ { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_keep_conn on; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_read_timeout 300; include fastcgi_params; } ``` You may also need to change `fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;` to `fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name;`, at least I had to with mine. There may be security implications by using `/` as your SourceRoot - I mitigate this as much as I can by firewalling port 9000 so only localhost can reach it. Or you can use a socket instead. Not fool-proof, but from what I've seen so far it's OK.
19,114,532
I'm try to host several domain on the same VPS, using HHVM to serve the pages. I'm wondering how can I write the VirtualHost in order to point the right folder in my /var/www directory ? For example xxx.domain.com >> /var/www/domain.com/
2013/10/01
[ "https://Stackoverflow.com/questions/19114532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/100782/" ]
Good news. Since the release of HHVM 2.3 (Dec 13, 2013), you can run HHVM in FCGI mode. Use either Nginx or Apache and it works wonderfully. Reference: <http://www.hhvm.com/blog/1817/fastercgi-with-hhvm> With an older version of HHVM you can run multiple server instances on internal ports, i.e. 8001, 8002, etc. Then configure Nginx as a reverse proxy. (Apache can do that too). ``` upstream node1{ server 127.0.0.1:8001; } upstream node2{ server 127.0.0.1:8002; } server { ... server_name server1.com; location ~ \.php$ { proxy_pass http://node1; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_redirect off; proxy_buffering off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Ssl on; #only for https } } server { ... server_name server2.com; location ~ \.php$ { proxy_pass http://node2; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_redirect off; proxy_buffering off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Ssl on; #only for https } } ``` Of course this setup takes up a lot of memory. Go with 2.3 if you can upgrade.
On Nginx, the only way I was able to get this to work was to use `/` as `SourceRoot` for HHVM, and to add a `/` in `fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name;` in my `/etc/nginx/hhvm.conf` file. With that combination, I'm running ~7 sites without a problem so far. I'm running Ubuntu 13.10 64-bit. In `/etc/hhvm/server.hdf`, change `SourceRoot = /var/www` to `SourceRoot = /`: ``` Server { Port = 9000 SourceRoot = / DefaultDocument = index.php } ``` In `/etc/nginx/hhvm.conf`, add a / in front of `$document_root$fastcgi_script_name;`: ``` location ~ \.php$ { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_keep_conn on; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_read_timeout 300; include fastcgi_params; } ``` You may also need to change `fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;` to `fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name;`, at least I had to with mine. There may be security implications by using `/` as your SourceRoot - I mitigate this as much as I can by firewalling port 9000 so only localhost can reach it. Or you can use a socket instead. Not fool-proof, but from what I've seen so far it's OK.
69,899,077
I am not really familiar with HTML and CSS and I am having some problems with fixing my problem. I am trying to fit the picture excatly on the grid and the grid to be visible in the center of the page which actually it is. I saw that there are a lot of questions about this and I tried to look at the answers the questions got and try to fix my problem but it was actually not working. So I hope anyone can help me with this. ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="index.css"> </head> <body> <div class="grid-container"> <div class="grid-item"><img src="6.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="3.png" class="img"> </div> <div class="grid-item"></div> <div class="grid-item"><img src="3.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="7.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"><img src="2.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="2.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="3.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="4.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"><img src="2.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="5.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="4.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="4.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"><img src="8.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="5.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="5.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="9.png" class="img"></div> </div> </body> </html> ``` CSS ``` .grid-container { display: grid; grid-template-columns: repeat(7, 1fr); background-color: #8B38BE; padding: 70px; margin: auto; width: 700px; } .grid-item { background-color: #E0E7FF; border: 1px solid black; padding: 40px; text-align: center; } .grid-item > img { max-width: 100%; height: auto; object-fit: cover; display: block; } ```
2021/11/09
[ "https://Stackoverflow.com/questions/69899077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15788008/" ]
Okay you can do it like this: ``` .grid-container { display: grid; grid-template-columns: repeat(7, 1fr); background-color: #8B38BE; padding: 70px; margin: auto; width: 700px; } .grid-item { background-color: #E0E7FF; border: 1px solid black; padding: 40px; text-align: center; position:relative; } .grid-item > img { width: 100%; object-fit: cover; display: block; position:absolute; left: 0; top: 0; height: 100%; } ``` So in this case, you are placing img to be absolute and to have height and width same as grid-item. But then you will add `object-fit` which will make image fit nicely inside grid-item.
From what i understand you are trying to center the grid, there are multiple ways you can do this though, im not sure what your looks like. Im not sure if its loading any CSS or not at all doing anything. If you wanted to you could make a div with everything in it and do something like: ```css .grid { position: absolute; left: 50%; top: 50%; transform: translateX(-50%); } ```
69,899,077
I am not really familiar with HTML and CSS and I am having some problems with fixing my problem. I am trying to fit the picture excatly on the grid and the grid to be visible in the center of the page which actually it is. I saw that there are a lot of questions about this and I tried to look at the answers the questions got and try to fix my problem but it was actually not working. So I hope anyone can help me with this. ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="index.css"> </head> <body> <div class="grid-container"> <div class="grid-item"><img src="6.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="3.png" class="img"> </div> <div class="grid-item"></div> <div class="grid-item"><img src="3.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="7.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"><img src="2.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="2.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="3.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="4.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"><img src="2.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="5.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="4.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="4.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"><img src="8.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="5.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="5.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="9.png" class="img"></div> </div> </body> </html> ``` CSS ``` .grid-container { display: grid; grid-template-columns: repeat(7, 1fr); background-color: #8B38BE; padding: 70px; margin: auto; width: 700px; } .grid-item { background-color: #E0E7FF; border: 1px solid black; padding: 40px; text-align: center; } .grid-item > img { max-width: 100%; height: auto; object-fit: cover; display: block; } ```
2021/11/09
[ "https://Stackoverflow.com/questions/69899077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15788008/" ]
Okay you can do it like this: ``` .grid-container { display: grid; grid-template-columns: repeat(7, 1fr); background-color: #8B38BE; padding: 70px; margin: auto; width: 700px; } .grid-item { background-color: #E0E7FF; border: 1px solid black; padding: 40px; text-align: center; position:relative; } .grid-item > img { width: 100%; object-fit: cover; display: block; position:absolute; left: 0; top: 0; height: 100%; } ``` So in this case, you are placing img to be absolute and to have height and width same as grid-item. But then you will add `object-fit` which will make image fit nicely inside grid-item.
Here I have used aspect ratio. Please update below css in your code. ``` .grid-item { background-color: #E0E7FF; border: 1px solid black; padding-bottom: 100%; text-align: center; position: relative; } .grid-item > img { max-width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; left: 0; right: 0; top: 0; bottom: 0; } ```
69,899,077
I am not really familiar with HTML and CSS and I am having some problems with fixing my problem. I am trying to fit the picture excatly on the grid and the grid to be visible in the center of the page which actually it is. I saw that there are a lot of questions about this and I tried to look at the answers the questions got and try to fix my problem but it was actually not working. So I hope anyone can help me with this. ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="index.css"> </head> <body> <div class="grid-container"> <div class="grid-item"><img src="6.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="3.png" class="img"> </div> <div class="grid-item"></div> <div class="grid-item"><img src="3.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="7.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"><img src="2.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="2.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="3.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="4.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"><img src="2.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="5.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="4.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="4.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"></div> <div class="grid-item"><img src="8.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="5.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="5.png" class="img"></div> <div class="grid-item"></div> <div class="grid-item"><img src="9.png" class="img"></div> </div> </body> </html> ``` CSS ``` .grid-container { display: grid; grid-template-columns: repeat(7, 1fr); background-color: #8B38BE; padding: 70px; margin: auto; width: 700px; } .grid-item { background-color: #E0E7FF; border: 1px solid black; padding: 40px; text-align: center; } .grid-item > img { max-width: 100%; height: auto; object-fit: cover; display: block; } ```
2021/11/09
[ "https://Stackoverflow.com/questions/69899077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15788008/" ]
Okay you can do it like this: ``` .grid-container { display: grid; grid-template-columns: repeat(7, 1fr); background-color: #8B38BE; padding: 70px; margin: auto; width: 700px; } .grid-item { background-color: #E0E7FF; border: 1px solid black; padding: 40px; text-align: center; position:relative; } .grid-item > img { width: 100%; object-fit: cover; display: block; position:absolute; left: 0; top: 0; height: 100%; } ``` So in this case, you are placing img to be absolute and to have height and width same as grid-item. But then you will add `object-fit` which will make image fit nicely inside grid-item.
Instead of using `.grid-item > img {}` I would just define it as a class (since you're telling it, it has a .img class. Further, remove padding and use height:100% ``` .img { max-width: 100%; height: 100%; padding: 0; object-fit: cover; display: block; } ```
29,754,913
i am facing problem in android studio. In eclipse when i want to use class like Intent, then i write intent starting with lower case it give me suggestion box indicating class name Intent, but in android studio if i type intent starting with lower case it does not Provide Suggestion class name Intent.Thanks in advance.
2015/04/20
[ "https://Stackoverflow.com/questions/29754913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4022497/" ]
In my case Ctrl + Space was overloaded by mac shortcuts. And even in the case, I disabled them, they conflict with Android Studio. So, I gave them another keys and it solved the problem. Go to the `System Preferences -> Keyboard -> Shortcuts -> Input Sources` and use new keys for them. [![enter image description here](https://i.stack.imgur.com/cVfF1.png)](https://i.stack.imgur.com/cVfF1.png)
The problem is that Android Studio has different key binding than Eclipse, but you can set the key binding to be the same as in eclipse in android studio settings. Also by default ctrl + space is case sensitive in Android studio, you need to turn that off too. Move to File -> Settings -> Keymap and change keymaps settings to eclipse so that you can use the short cut keys like in eclipse. You can set 'Case sensitive completion' to 'None' in IDE Settings > Editor > Code Completion. That should do it :)
29,754,913
i am facing problem in android studio. In eclipse when i want to use class like Intent, then i write intent starting with lower case it give me suggestion box indicating class name Intent, but in android studio if i type intent starting with lower case it does not Provide Suggestion class name Intent.Thanks in advance.
2015/04/20
[ "https://Stackoverflow.com/questions/29754913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4022497/" ]
In my case Ctrl + Space was overloaded by mac shortcuts. And even in the case, I disabled them, they conflict with Android Studio. So, I gave them another keys and it solved the problem. Go to the `System Preferences -> Keyboard -> Shortcuts -> Input Sources` and use new keys for them. [![enter image description here](https://i.stack.imgur.com/cVfF1.png)](https://i.stack.imgur.com/cVfF1.png)
`File --> Settings --> Editor --> General --> Code Completion --> Case sensitive completion --> None`
24,964,232
Trying to fire a function at the end of an embedded YouTube iFrame's end. Just need to know how to find the end - after that I am good.
2014/07/25
[ "https://Stackoverflow.com/questions/24964232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1385272/" ]
Your CAML query is malformed. An OR tag cannot contain more than two fields, so any further fields have to be nested. ```xml <OR > FEILD 4 < OR > FEILD 3 < OR > FELD 1 FELD 2 < /OR > < /OR > </ OR > ``` Try CAML query helper <http://spcamlqueryhelper.codeplex.com/>
You need to mix AND's with your OR's. For Example: ``` <Where> <And> <Or> <IsNull> <FieldRef Name='Field1' /> </IsNull> <IsNull> <FieldRef Name='Field2' /> </IsNull> </Or> <And> <Or> <IsNull> <FieldRef Name='Field3' /> </IsNull> <IsNull> <FieldRef Name='Field4' /> </IsNull> </Or> </And> </And> </Where> ``` [CAML query with nested AND's and OR's for multiple fields](https://stackoverflow.com/questions/6203821/caml-query-with-nested-ands-and-ors-for-multiple-fields)
14,414,832
What is the actual benefit and purpose of `initializer_list`, for unknown number of parameters? Why not just use `vector` and be done with it? In fact, it sounds like just a `vector` with another name. Why bother? The only "benefit" I see of `initializer_list` is that it has `const` elements, but that doesn't seem to be a reason enough to invent this whole new type. (You can just use a `const vector` after all.) So, what am I mising?
2013/01/19
[ "https://Stackoverflow.com/questions/14414832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1859852/" ]
It is a sort of contract between the programmer and the compiler. The programmer says `{1,2,3,4}`, and the compiler creates an object of type `initializer_list<int>` out of it, containing the same sequence of elements in it. This contract is a requirement imposed by the language specification on the compiler implementation. That means, it is not the programmer who creates manually such an object but it is the compiler which creates the object, and pass that object to function which takes `initializer_list<int>` as argument. The `std::vector` implementation takes advantage of this contract, and therefore it defines a constructor which takes `initializer_list<T>` as argument, so that it could initialize itself with the elements in the initializer-list. Now **suppose for a while** that the `std::vector` doesn't have any constructor that takes `std::initializer_list<T>` as argument, then you would get this: ``` void f(std::initializer_list<int> const &items); void g(std::vector<int> const &items); f({1,2,3,4}); //okay g({1,2,3,4}); //error (as per the assumption) ``` As per the assumption, since `std::vector` doesn't have constructor that takes `std::initializer_list<T>` as argument, which *implies* you cannot pass `{1,2,3,4}` as argument to `g()` as shown above, because the compiler *cannot* create an instance of `std::vector` out of the expression `{1,2,3,4}` **directly**. It is because no such contract is ever made between programmer and the compiler, and imposed by the language. It is *through* `std::initializer_list`, the `std::vector` is able to create itself out of expression `{1,2,3,4}`. Now you will understand that `std::initializer_list` can be used wherever you need an expression of the form of `{value1, value2, ...., valueN}`. It is why other containers from the Standard library also define constructor that takes `std::initializer_list` as argument. In this way, no container depends on any other container for construction from expressions of the form of `{value1, value2, ...., valueN}`. Hope that helps.
Well, `std::vector` *has* to use `initializer_list` to get that syntax as it obviously can't use itself. Anyway, `initializer_list` is intended to be extremely lightweight. It can use an optimal storage location and prevent unnecessary copies. With `vector`, you're always going to get a heap allocation and have a good chance of getting more copies/moves than you want. Also, the syntax has obvious differences. One such thing is template type deduction: ``` struct foo { template<typename T> foo(std::initializer_list<T>) {} }; foo x{1,2,3}; // works ``` `vector` wouldn't work here.
14,414,832
What is the actual benefit and purpose of `initializer_list`, for unknown number of parameters? Why not just use `vector` and be done with it? In fact, it sounds like just a `vector` with another name. Why bother? The only "benefit" I see of `initializer_list` is that it has `const` elements, but that doesn't seem to be a reason enough to invent this whole new type. (You can just use a `const vector` after all.) So, what am I mising?
2013/01/19
[ "https://Stackoverflow.com/questions/14414832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1859852/" ]
Well, `std::vector` *has* to use `initializer_list` to get that syntax as it obviously can't use itself. Anyway, `initializer_list` is intended to be extremely lightweight. It can use an optimal storage location and prevent unnecessary copies. With `vector`, you're always going to get a heap allocation and have a good chance of getting more copies/moves than you want. Also, the syntax has obvious differences. One such thing is template type deduction: ``` struct foo { template<typename T> foo(std::initializer_list<T>) {} }; foo x{1,2,3}; // works ``` `vector` wouldn't work here.
The biggest advantage of `initializer_list` over `vector` is that it allows you to specify *in-place* a certain sequence of elements without requiring delicate processing to create that list. This saves you from setting up several calls to `push_back` (or a `for` cycle) for initializing a `vector` even though you know exactly which elements are going to be pushed into the vector. In fact, `vector` itself has a constructor accepting an `initializer_list` for more convenient initialization. I would say the two containers are complementary. ``` // v is constructed by passing an initializer_list in input std::vector<std::string> v = {"hello", "cruel", "world"}; ``` Of course it is important to be aware of the fact that `initializer_list` does have some limitations (narrowing conversions are not allowed) which may make it inappropriate or impossible to use in some cases.
14,414,832
What is the actual benefit and purpose of `initializer_list`, for unknown number of parameters? Why not just use `vector` and be done with it? In fact, it sounds like just a `vector` with another name. Why bother? The only "benefit" I see of `initializer_list` is that it has `const` elements, but that doesn't seem to be a reason enough to invent this whole new type. (You can just use a `const vector` after all.) So, what am I mising?
2013/01/19
[ "https://Stackoverflow.com/questions/14414832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1859852/" ]
It is a sort of contract between the programmer and the compiler. The programmer says `{1,2,3,4}`, and the compiler creates an object of type `initializer_list<int>` out of it, containing the same sequence of elements in it. This contract is a requirement imposed by the language specification on the compiler implementation. That means, it is not the programmer who creates manually such an object but it is the compiler which creates the object, and pass that object to function which takes `initializer_list<int>` as argument. The `std::vector` implementation takes advantage of this contract, and therefore it defines a constructor which takes `initializer_list<T>` as argument, so that it could initialize itself with the elements in the initializer-list. Now **suppose for a while** that the `std::vector` doesn't have any constructor that takes `std::initializer_list<T>` as argument, then you would get this: ``` void f(std::initializer_list<int> const &items); void g(std::vector<int> const &items); f({1,2,3,4}); //okay g({1,2,3,4}); //error (as per the assumption) ``` As per the assumption, since `std::vector` doesn't have constructor that takes `std::initializer_list<T>` as argument, which *implies* you cannot pass `{1,2,3,4}` as argument to `g()` as shown above, because the compiler *cannot* create an instance of `std::vector` out of the expression `{1,2,3,4}` **directly**. It is because no such contract is ever made between programmer and the compiler, and imposed by the language. It is *through* `std::initializer_list`, the `std::vector` is able to create itself out of expression `{1,2,3,4}`. Now you will understand that `std::initializer_list` can be used wherever you need an expression of the form of `{value1, value2, ...., valueN}`. It is why other containers from the Standard library also define constructor that takes `std::initializer_list` as argument. In this way, no container depends on any other container for construction from expressions of the form of `{value1, value2, ...., valueN}`. Hope that helps.
The biggest advantage of `initializer_list` over `vector` is that it allows you to specify *in-place* a certain sequence of elements without requiring delicate processing to create that list. This saves you from setting up several calls to `push_back` (or a `for` cycle) for initializing a `vector` even though you know exactly which elements are going to be pushed into the vector. In fact, `vector` itself has a constructor accepting an `initializer_list` for more convenient initialization. I would say the two containers are complementary. ``` // v is constructed by passing an initializer_list in input std::vector<std::string> v = {"hello", "cruel", "world"}; ``` Of course it is important to be aware of the fact that `initializer_list` does have some limitations (narrowing conversions are not allowed) which may make it inappropriate or impossible to use in some cases.
74,294,746
I am trying to create plug-in that will catch any send item and show warning before sent out. Currently I am using the below code ``` private void ThisAddIn_Startup(object sender, System.EventArgs e) { Outlook.Application application = Globals.ThisAddIn.Application; application.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend); } ``` However, I noticed it catches almost all the send event but when send button is pressed from main screen of Outlook, I mean when the mail is not popped out to separate window, it does not catch the event and my plugin function is not executed. My environment is Visual Studio 2019 and Outlook 2019. Any advise is appreciated. Thank you, Catch all the send event from Outlook. Update 11/7/2022: it turned out that the event is caught but I am tryning to catch the item type by the below method and inline item does not detected as an item. ``` itemtype = Application.ActiveWindow().CurrentItem.Class; ```
2022/11/02
[ "https://Stackoverflow.com/questions/74294746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20401086/" ]
I can confirm that the `ItemSend` event is fired for all outgoing emails in Outlook, including inline responses. To make sure I've just created a sample VSTO add-in and placed your code there. Everything works correctly when I reply to items in-place. Try to declare the Application object at the class level. But I think everything should work as is now. ``` Outlook.Application application = null; private void ThisAddIn_Startup(object sender, System.EventArgs e) { application = Globals.ThisAddIn.Application; application.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend); } ``` You may consider subscribing to the [Explorer.InlineResponse](https://learn.microsoft.com/en-us/office/vba/api/outlook.explorer.inlineresponse) event which is fired when the user performs an action that causes an inline response to appear in the Reading Pane. So, you may get the item composed and do whatever you need (subscribe to the `Send` event). Be aware, a low level API such as Extended or Simple MAPI doesn't trigger the `ItemSend` event in Outlook - only actions made in the Outlook object model or made manually can trigger the event.
It should work in all cases, but Outlook disables most OOM events for the items created using Simple MAPI or from the "`mailto:"` links. Is that the case?
175,433
Is there any way to have a [Decanter of Endless Water](https://www.dndbeyond.com/magic-items/decanter-of-endless-water) pour out other drinkable liquids? If so, how could I get one? It seems reasonable to me as a possibility. If not how might you go about modifying a decanter of endless water to do so?
2020/09/15
[ "https://rpg.stackexchange.com/questions/175433", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/30985/" ]
### Not quite, the closest item would be the Alchemy Jug. There is nothing in the way of detailed lore behind the Decanter of Endless Water, so it is entirely up to the DM what this looks like in their world - they may choose to create a Decanter of Endless Whisky if they wish. But, there does exist a canonical alternative. The [Alchemy Jug](https://www.dndbeyond.com/magic-items/alchemy-jug) lacks the volume capabilities of the Decanter of endless water, but makes up for it in diversity. The Alchemy Jug can produce acid, poison, beer, honey, mayonnaise, oil, vinegar, salt water, fresh water, and wine, at a rate of 2 gallons per minute in varying quantities, with a limit of 1 type of liquid per day. Yes, [it can make mayonnaise](https://rpg.stackexchange.com/questions/94262/why-is-mayo-in-the-alchemy-jug?r=SearchResults).
The Alchemy Jug (as mentioned above) would be closest, but also note that Hoard of the Dragon Queen p.74 contains a Tankard of Plenty. > > The Golden Tankard takes its name from a magic item that Raggnar found years ago: a golden stein decorated with dancing dwarves and grain patterns. This is a tankard of plenty. Speaking the command word (“Illefarn”) while grasping the handle fills the tankard with three pints of rich dwarven ale. This power can be used up to three times per day. > > > For lore/historical reference, this is similar to the Everfull Mug from 3.5e's Magic Item Compendium, p.160, which was possibly related to AD&D's Mug of Plenty (Encyclopedia Magica).
175,433
Is there any way to have a [Decanter of Endless Water](https://www.dndbeyond.com/magic-items/decanter-of-endless-water) pour out other drinkable liquids? If so, how could I get one? It seems reasonable to me as a possibility. If not how might you go about modifying a decanter of endless water to do so?
2020/09/15
[ "https://rpg.stackexchange.com/questions/175433", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/30985/" ]
It's Up To Your DM ------------------ Technically, the rulebooks have no Decanter of Endless (Insert any liquid here) among the plethora of items Wizards presents us with, however that doesn't mean that is impossible. In the DMG, in Chapter 9: Dungeon Master's Workshop on page 284, we are presented with the "Modifying An Item" section, which, since I am not going to quote the whole section, suggests three types of changes: Cosmetic, Property, and Fusing Items. I'd say your thing would fit under the property section, where it gives examples like changing an object's damage type or effect. As a player, this is off-limits. Speak to your DM, and they might allow it.**The Rules are guidelines, rather than rules. It's up to the individual DM to decide how much they want to stick to them. ;)** Otherwise I'd agree with Thomas and say Alchemy Jug is your best bet.
The Alchemy Jug (as mentioned above) would be closest, but also note that Hoard of the Dragon Queen p.74 contains a Tankard of Plenty. > > The Golden Tankard takes its name from a magic item that Raggnar found years ago: a golden stein decorated with dancing dwarves and grain patterns. This is a tankard of plenty. Speaking the command word (“Illefarn”) while grasping the handle fills the tankard with three pints of rich dwarven ale. This power can be used up to three times per day. > > > For lore/historical reference, this is similar to the Everfull Mug from 3.5e's Magic Item Compendium, p.160, which was possibly related to AD&D's Mug of Plenty (Encyclopedia Magica).
175,433
Is there any way to have a [Decanter of Endless Water](https://www.dndbeyond.com/magic-items/decanter-of-endless-water) pour out other drinkable liquids? If so, how could I get one? It seems reasonable to me as a possibility. If not how might you go about modifying a decanter of endless water to do so?
2020/09/15
[ "https://rpg.stackexchange.com/questions/175433", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/30985/" ]
The less-than-serious scenario pack for AD&D 1e *Castle Greyhawk* contains a Decanter of Endless Lemonade. And many other silly things.
The Alchemy Jug (as mentioned above) would be closest, but also note that Hoard of the Dragon Queen p.74 contains a Tankard of Plenty. > > The Golden Tankard takes its name from a magic item that Raggnar found years ago: a golden stein decorated with dancing dwarves and grain patterns. This is a tankard of plenty. Speaking the command word (“Illefarn”) while grasping the handle fills the tankard with three pints of rich dwarven ale. This power can be used up to three times per day. > > > For lore/historical reference, this is similar to the Everfull Mug from 3.5e's Magic Item Compendium, p.160, which was possibly related to AD&D's Mug of Plenty (Encyclopedia Magica).
57,302,214
I'm not an expert in SQL but I recently started using `sqlite3` module in `Python` with databases and together with `pandas` and its `read_sql_query()` they make a pretty nice tool. Now, say, I have a database looking something like this (I just really made this up for the demo purposes). ``` age iq married =============== 91 77 0 54 124 1 31 124 0 32 95 0 74 34 0 18 56 0 43 42 0 78 56 0 91 77 1 ``` The task is, and this is where it might get slightly confusing. I want to select all the rows (people) with the same IQ as the rows with `married=1` (including married people themselves). So I would like the result to look like this: ``` age iq married =============== 91 77 0 54 124 1 31 124 0 91 77 1 ``` And even in general, let's say I'm even more restrictive and want to select all the people who have the same `iq` AND the same `age` as the married ones. In this case the result would look like this: ``` age iq married =============== 54 124 1 91 77 0 91 77 1 ``` There might be tons of other columns that could or could not be ignored. Now of course I can do that iteratively, by first selecting the married ones, then comparing the tuples of `(age,iq)`, but that's kinda boring. The question is, is there a neat way of doing this in one shot with the `pandas.read_sql_query()`? So in short, I'm trying to do something like this (I know this just selects married ones, but it's just an example): ```py import sqlite3 import pandas as pd connection = sqlite3.connect('people.db') mydata = pd.read_sql_query( """ SELECT * from People WHERE married=1 ... *some magic here* GROUP BY *foo* HAVING *bar* """, connection) ``` where I can't really come up with any "magic" to make it do what I want (probably because of poor knowledge of all SQL commands and conditions). Maybe there is a way to do this with nested `SELECT` commands and some things like `IN`, but I'm not really sure. I feel like there has to be a simple way (or maybe I'm wrong and it's easier to do it iteratively), so I'm asking the community!
2019/08/01
[ "https://Stackoverflow.com/questions/57302214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4888158/" ]
One approach would be to use an `EXISTS` condition in the `WHERE` clause which asserts that a given IQ value matches at least one other married record: ``` SELECT age, iq, married FROM People p1 WHERE EXISTS (SELECT 1 FROM People p2 WHERE p1.iq = p2.iq AND p2.married = 1); ``` [![enter image description here](https://i.stack.imgur.com/yT2jw.png)](https://i.stack.imgur.com/yT2jw.png) [Demo ----](https://dbfiddle.uk/?rdbms=sqlite_3.27&fiddle=3107f17a0da9f422e03cffa2a925d4d7) The `EXISTS` subquery might have much better performance with the following index in place: ``` CREATE INDEX idx ON People (iq, married); ``` This would allow rapid lookup of a given `iq` value in the table, along with checking the `married` status.m
Try this query: ``` select * from People where iq in ( select iq from People group by iq having sum(married) > 0 ) ```
228,255
Say I have one old and one new bike. Should I write: > > Both the old and the new bike should be there. > > > or > > Both the old and the new bike**s** should be there. > > >
2019/10/22
[ "https://ell.stackexchange.com/questions/228255", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/32536/" ]
The first is more specific: you have one of each. The second is less specific: you have a mixture of old and new bikes.
> > **Both the old bike and the new bike should be there**. > > > **The old bike** is singular **The new book is singular** So the old bike and the new bike are plural and mean one old book and one new book. So the above sentence is correct. If you say : > > **Both the old and the new bikes**, it means some old bikes and some new bikes. > > > It is not what you intended to say
282,376
Let $\sigma$ be an element of $SL\_{24}(\mathbb{Z})$ with its Jordan normal form is diagonal and the eigen values are $\epsilon\_j$ for $1 \le j \le 24$ are n th root of unity where $n|N$ and $N$ is the finite order of $\sigma$. Equivalently we are describing $\sigma$ through its cycle shape $(a\_1)^{b\_1}\cdots(a\_s)^{b\_s}$. We associate $\sigma$ to the following modular form: $$\eta\_{\sigma}(q) := \eta(\epsilon\_1q)\cdots\eta (\epsilon\_{24} q)=\eta(q^{a\_1})^{b\_1}\cdots \eta(q^{a\_s})^{b\_s}$$ Here $\eta$ stands for the Dedekind eta-function. Using the above defined $\eta\_{\sigma}$ we define: $$\sum\_{j>0}p\_{\sigma}(1+j)q^{1+j} = \frac{q}{\eta\_{\sigma}(q)}$$ This is a generalized partition function. We assume the cycle type of $\sigma$ is $1^{1}23^{1}$ and hence $N = 23$. In this case I have the following questions : 1. What is this generalized partition function $p\_{\sigma}$ and how to find $p\_{\sigma}(n)$ for some natural number $n$? 2. There are many generalisations of partitions functions and hence what is the reference for this particular type of generalized partition function? Thanks for your time. Have a good day.
2017/09/30
[ "https://mathoverflow.net/questions/282376", "https://mathoverflow.net", "https://mathoverflow.net/users/33047/" ]
What you have is positive integers such that $\;a\_1b\_1+\dots+a\_sb\_s=24.$ Your $q/\eta\_\sigma(q)$ is an example of an eta-quotient and is a modular function of negative weight. As just one example, if $\;a\_1=1,b\_1=24\;$ then $\eta\_\sigma(q)=\Delta(q)$ is the generating function of the [Ramanujan tau function](https://en.wikipedia.org/wiki/Ramanujan_tau_function). You may find some similar kinds of partitions in the [OEIS](http://oeis.org). For example, sequence [A005758](http://oeis.org/A005758) is partitions into parts of 12 kinds. For your first question, just expand $\;\eta(q^a)=\prod\_{n>0}1-q^{an}\;$ and multiply the $q$-series together. For example, in your case where $b\_1=b\_2=a\_1=1, a\_2=23,$ $$f(q):=\frac1{\prod\_{k>0}(1-q^k)(1-q^{23k})}=1+q+2q^2+3q^3+5q^4+\dots$$ which is the generating function of partitions of $n$ into positive integers where the integers come in two kinds and the second kind has weight $23$ times the weight of the first kind.
It is not an answer, but just some comments where such $\eta$ products appear: * A version of Moonshine for the [Mathieu group M24](https://en.wikipedia.org/wiki/Mathieu_group) proposed by G. Mason around 1985, the coefficients $a\_i, b\_i$ are related with the cycle structre of M24 elements ([see here](https://en.wikipedia.org/wiki/Mathieu_group_M24#Conjugacy_classes)), in particular (1,23) appears there. The result is that such products are Hecke eigen-forms * Related theorem by D. Dummit, H. Kisilevsky, and J. McKay, **Multiplicative products of η functions**, Finite Groups - Coming of Age, American Mathematical Society, 1985 which describes all such multiplicative products - (most come form M24). Nice introduction to that and previous results can be found in Jeremy Booher [The Spirit of Moonshine: Connections between the Mathieu Groups and Modular Forms](https://www.google.ru/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwi5xKD1683WAhULGZoKHWK4DgQQFggnMAA&url=http%3A%2F%2Fwww.math.harvard.edu%2Ftheses%2Fsenior%2Fbooher%2Fbooher.pdf&usg=AOvVaw0MBDdlgZQ9ZptZxf8zU13X) * McKay conjecture proved by Koike 1984 ([ON McKAY'S CONJECTURE](https://doi.org/10.1017/S0027763000020985)) gives conditions on $a\_i, b\_i$ when such $\eta$-product is primitive cusp form, again is quite related to the above mentioned results * S. Galkin found ([see here](http://research.ipmu.jp/ipmu/sysimg/ipmu/467.pdf)) that Mason's $\eta$-products are related with Gromov-Witten invariants of certain Fano manifolds * K.Saito considered $\eta$-products in his papers e.g. [Extended Affine Root System V (Elliptic Eta-product and their Dirichlet series)](http://www.kurims.kyoto-u.ac.jp/~saito/). Some of his conjectures has been proved in [arXiv:math/0702027](https://arxiv.org/abs/math/0702027). See also MO270241 [Are the Fourier coefficients of η(qm)m/η(q)η(qm)m/η(q) non-negative?](https://mathoverflow.net/q/270241/10446) * MO33058: [Eta-products and modular elliptic curves](https://mathoverflow.net/q/33058/10446) where elliptic curves whose modular are such $\eta$-products are described. See also MO238646 [On η(6z)η(18z)η(6z)η(18z) and the splitting / modularity of x3−2](https://mathoverflow.net/q/238646/10446) * MO91672 [Linear eta product identities - how many are there?](https://mathoverflow.net/q/91672/10446), MO92119 [Duality of eta product identities: a new idea?](https://mathoverflow.net/q/92119/10446)
6,602,151
First off, sorry for the cryptic question. My team is currently using Selenium 2.0rc3 (with python) for testing our web app with chrome. When we used the 2.02b version of Selenium, our test passed (it was a little slow and we had small hacks that we added to webdriver). After we upgraded, the test became extremely fast and started failing. After debugging we found out most test failed because webdrivers click() function was not blocking() successive calls. Currently we added a sleep()/timeout of .5 secs after each click and while this solves the immediate problem, it doesn't quite achieve our main goal (which is to speed up our test)
2011/07/06
[ "https://Stackoverflow.com/questions/6602151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/698913/" ]
Your problem is not really that it's clicking too fast. Just that it's clicking before that element is present. There are two ways to get round this: 1. Wait until the element is present before clicking 2. Increase the implicit wait time I'm afraid I haven't used the WebDriver Python bindings. However, I can tell you how it is done in Java and hopefully you can find the Python equivalent yourself. To wait for an element, we have in Java a class called `WebDriverWait`. You would write a `Function` which you pass to the `until()` method which passes only when the element exists. One way you could do that is with `driver.findElements( By... )` or wrap `driver.findElement( By... )` in an exception handler. The `Function` is polled till it returns true or the timeout specified is hit. The second method is the preferred method for your case and in Java you can do `driver.manage().timeouts().implicitlyWait( ... )`.
If the click() executes ajax calls I would suggest you to use NicelyResynchronizingAjaxController
6,602,151
First off, sorry for the cryptic question. My team is currently using Selenium 2.0rc3 (with python) for testing our web app with chrome. When we used the 2.02b version of Selenium, our test passed (it was a little slow and we had small hacks that we added to webdriver). After we upgraded, the test became extremely fast and started failing. After debugging we found out most test failed because webdrivers click() function was not blocking() successive calls. Currently we added a sleep()/timeout of .5 secs after each click and while this solves the immediate problem, it doesn't quite achieve our main goal (which is to speed up our test)
2011/07/06
[ "https://Stackoverflow.com/questions/6602151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/698913/" ]
I've tried the selenium-2 rc3 python bindings for chrome. My experience was the opposite of what you're describing - after clicking, the driver didn't know that the page was ready for it to continue. So instead of speeding up the tests, they turned out very slow (because the driver was waiting for ages). However, the firefox driver seems pretty stable - maybe you should stick with it until the chrome driver gets baked a bit more.
If the click() executes ajax calls I would suggest you to use NicelyResynchronizingAjaxController
6,602,151
First off, sorry for the cryptic question. My team is currently using Selenium 2.0rc3 (with python) for testing our web app with chrome. When we used the 2.02b version of Selenium, our test passed (it was a little slow and we had small hacks that we added to webdriver). After we upgraded, the test became extremely fast and started failing. After debugging we found out most test failed because webdrivers click() function was not blocking() successive calls. Currently we added a sleep()/timeout of .5 secs after each click and while this solves the immediate problem, it doesn't quite achieve our main goal (which is to speed up our test)
2011/07/06
[ "https://Stackoverflow.com/questions/6602151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/698913/" ]
Your problem is not really that it's clicking too fast. Just that it's clicking before that element is present. There are two ways to get round this: 1. Wait until the element is present before clicking 2. Increase the implicit wait time I'm afraid I haven't used the WebDriver Python bindings. However, I can tell you how it is done in Java and hopefully you can find the Python equivalent yourself. To wait for an element, we have in Java a class called `WebDriverWait`. You would write a `Function` which you pass to the `until()` method which passes only when the element exists. One way you could do that is with `driver.findElements( By... )` or wrap `driver.findElement( By... )` in an exception handler. The `Function` is polled till it returns true or the timeout specified is hit. The second method is the preferred method for your case and in Java you can do `driver.manage().timeouts().implicitlyWait( ... )`.
I've tried the selenium-2 rc3 python bindings for chrome. My experience was the opposite of what you're describing - after clicking, the driver didn't know that the page was ready for it to continue. So instead of speeding up the tests, they turned out very slow (because the driver was waiting for ages). However, the firefox driver seems pretty stable - maybe you should stick with it until the chrome driver gets baked a bit more.
418,715
I have a 16" 2019 MacBook Pro. A few days ago, I didn't have my MacBook charger on hand. After a quick internet research of whether or not it works, I borrowed my wife's DELL XPS charger (USB-C, 130W I believe). My MacBook charged fine with it. A few days later, I noticed that my MacBook is charging very slowly (with my Apple 96W charger). I reset the SMC, rebooted, tried a different wall outlet, installed all system upgrades. No luck. Charge speed is around 1% point every 20 minutes with all apps closed. When I run a computing intense task (having a lot of Google Chrome tabs open, or compiling code), the battery discharges. I checked the battery status with coconutBattery, but things seem to look normal. The only thing that seems off is that charging wattage. I'd expect that to be somewhat close to my 96 watt maximum. See the attached screen shot. Note that this is with all apps closed. Are my issues due to my charger experiment a few days ago? Is this just coincidence and my Apple charger went bad? [![coconutBattery](https://i.stack.imgur.com/n2sB3.png)](https://i.stack.imgur.com/n2sB3.png)
2021/04/13
[ "https://apple.stackexchange.com/questions/418715", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/209332/" ]
The issue eventually resolved itself through a MacOS update. Also no more issues with 3rd party USB-C chargers. If I remember correctly, it was fixed by version `11.2.2`, see [Apple releases macOS update to prevent damage from third-party docks and dongles](https://www.theverge.com/2021/2/25/22301846/apple-macos-update-prevent-third-party-dongle-dock-damage).
I doubt it's just a coincidence. There's more to the Apple chargers than just "give juice to the battery", but I couldn't tell you what another charger may have done to your system. It could be as simple as an SMC reset (The SMC manages low-level settings such as battery management). From [howtogeek.com](https://www.howtogeek.com/312086/how-and-when-to-reset-the-smc-on-your-mac/): 1. Unplug the power, then shut down your Mac. 2. Hold the left `Shift`+`Control`+`Option` keys down, then press and hold the power button down. Keep all four buttons pressed down for ten seconds, then let go. 3. Plug the power cable back in, then turn on your Mac. Here's the official SMC reset page from apple: [T2](https://support.apple.com/en-us/HT201295), [Intel chip](https://support.apple.com/kb/HT211814)
11,249,869
My aim is to create a navigation menu using jquery. when the user rollover over left1, right 1 should appear and so forth. I am trying to code this in jquery but i am a little tied up. please assist css ``` .left { background: #fff; padding: 10px; width: 200px; border: 1px solid #ccc; position:relative } .right{ background:aqua; height:270px; width:200px; float:right; visibility:hidden } ``` html ``` <div class="left" id="left1">left 1</div> <div class="left" id="left2">left 2</div> <div class="left" id="left3">left 3</div> <div class="left" id="left4">left 4</div> <div class="right" id="r1">right 1</div> <div class="right" id="r2">right 2</div> <div class="right" id="r3">right 3</div> <div class="right" id="r4">right 4</div> ``` jquery ``` $(document).ready(function(){ function rightFrame(){ $('#r1').css({ 'position':'absolute', 'top':'40px', 'left':'300px', 'visibility':'visible' }); $('#r1').show(); } $('#left1').mouseover(function(e){ $("#left"+ID).css('background','red'); }); $('.left').mouseout(function(e){ $('.right').hide(); }); }); ``` my question may seem a little off but i hope you can understand my aim. thanks
2012/06/28
[ "https://Stackoverflow.com/questions/11249869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836910/" ]
Something like this? ``` $(".left").hover(function() { var id = $(this).attr('id').match(/\d+$/); $("#r" + id).css({'visibility':'visible'}); }, function() { $(".right").css({'visibility':'hidden'}); });​ ``` [**DEMO**](http://jsfiddle.net/ASUuL/1/)
Here is a method of doing this with jquery: <http://jsfiddle.net/surendraVsingh/h4wsS/6/> **Jquery:** ``` $('.left').hover(function(){ var x = ($(".left").index(this))+1; var rx = '#r'+x; $(rx).toggle(); });​ ``` **CSS:** *Removed visibility:hidden & added display:none*. ``` .right{ background:aqua; height:270px; width:200px; float:right; display:none; }​ ```
11,249,869
My aim is to create a navigation menu using jquery. when the user rollover over left1, right 1 should appear and so forth. I am trying to code this in jquery but i am a little tied up. please assist css ``` .left { background: #fff; padding: 10px; width: 200px; border: 1px solid #ccc; position:relative } .right{ background:aqua; height:270px; width:200px; float:right; visibility:hidden } ``` html ``` <div class="left" id="left1">left 1</div> <div class="left" id="left2">left 2</div> <div class="left" id="left3">left 3</div> <div class="left" id="left4">left 4</div> <div class="right" id="r1">right 1</div> <div class="right" id="r2">right 2</div> <div class="right" id="r3">right 3</div> <div class="right" id="r4">right 4</div> ``` jquery ``` $(document).ready(function(){ function rightFrame(){ $('#r1').css({ 'position':'absolute', 'top':'40px', 'left':'300px', 'visibility':'visible' }); $('#r1').show(); } $('#left1').mouseover(function(e){ $("#left"+ID).css('background','red'); }); $('.left').mouseout(function(e){ $('.right').hide(); }); }); ``` my question may seem a little off but i hope you can understand my aim. thanks
2012/06/28
[ "https://Stackoverflow.com/questions/11249869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836910/" ]
You have a few fundamental problems here. 1. ID is undefined. 2. You have a function named `rightFrame()` but you are not calling it anywhere in the script. 3. You should use classes and `$(this)` to open and close menu items instead of IDs. Here is a Fiddle to show you an easy fix: <http://jsfiddle.net/PFnDe/1/> **EDIT:** I guess I should post my JS here too. ``` function rightFrame(e) { // Moved this outside of DOM ready function. $('#' + e).css({ 'position': 'absolute', 'top': '40px', 'left': '300px', 'visibility': 'visible' }); $('#' + e).show(); } $(document).ready(function() { $('.left ').mouseover(function(e) { rightFrame($(this).data('item')); // Added this $(this).css('background-color', 'red'); }); $('.left ').mouseout(function(e) { $('.right ').hide(); $(this).css('background-color', '#fff'); // Added this }); }); ```
Here is a method of doing this with jquery: <http://jsfiddle.net/surendraVsingh/h4wsS/6/> **Jquery:** ``` $('.left').hover(function(){ var x = ($(".left").index(this))+1; var rx = '#r'+x; $(rx).toggle(); });​ ``` **CSS:** *Removed visibility:hidden & added display:none*. ``` .right{ background:aqua; height:270px; width:200px; float:right; display:none; }​ ```
18,651,673
I have two lists I would like to compare them for updated/modified columns. Compare 2 Lists of the same class and show the different values in a new list I would like to do this using linq. The only problem is I am dealing with a lot of columns, over excess of 30 columns in each. Any suggestions would be of great help... ``` //In Dal List<PartnerAndPartnerPositionEntity> GetAllPartnerAndPartnerPositionOldDB(int modelId); List<PartnerAndPartnerPositionEntity> GetAllPartnerAndPartnerPosition(int modelId); //BL //get from new db var list1= _partnerDAL.GetAllPartnerAndPartnerPosition(modelId); //get from old db var list2= _partnerDAL.GetAllPartnerAndPartnerPositionOldDB(modelId); ```
2013/09/06
[ "https://Stackoverflow.com/questions/18651673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1068964/" ]
Let's assume that: 1. `PartnerAndPartnerPositionEntity` class contains a property named `Id` that represents the unique key of an item Given the above you can: Get all properties of your type ``` var properties = typeof(PartnerAndPartnerPositionEntity).GetProperties(); ``` Join the two lists on the `Id` property and iterate through the properties to see which one has changed: ``` var list = list1.Join(list2, x => x.Id, y => y.Id, (x, y) => Tuple.Create(x, y)) .ToList(); list.Foreach(tuple => { foreach(var propertyInfo in properties) { var value1 = propertyInfo.GetValue(tuple.Item1, null); var value2 = propertyInfo.GetValue(tuple.Item2, null); if(value1 != value2) Console.WriteLine("Item with id {0} has different values for property {1}.", tuple.Item1,Id, propertyInfo.Name); } }); ```
Well, if you want to avoid doing it the boring and tedious way, you need to use reflection to dynamically get the class members then get their values for each instance. See [C# Reflection - Get field values from a simple class](https://stackoverflow.com/questions/7649324/c-sharp-reflection-get-field-values-from-a-simple-class) for the code.
18,651,673
I have two lists I would like to compare them for updated/modified columns. Compare 2 Lists of the same class and show the different values in a new list I would like to do this using linq. The only problem is I am dealing with a lot of columns, over excess of 30 columns in each. Any suggestions would be of great help... ``` //In Dal List<PartnerAndPartnerPositionEntity> GetAllPartnerAndPartnerPositionOldDB(int modelId); List<PartnerAndPartnerPositionEntity> GetAllPartnerAndPartnerPosition(int modelId); //BL //get from new db var list1= _partnerDAL.GetAllPartnerAndPartnerPosition(modelId); //get from old db var list2= _partnerDAL.GetAllPartnerAndPartnerPositionOldDB(modelId); ```
2013/09/06
[ "https://Stackoverflow.com/questions/18651673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1068964/" ]
Let's assume that: 1. `PartnerAndPartnerPositionEntity` class contains a property named `Id` that represents the unique key of an item Given the above you can: Get all properties of your type ``` var properties = typeof(PartnerAndPartnerPositionEntity).GetProperties(); ``` Join the two lists on the `Id` property and iterate through the properties to see which one has changed: ``` var list = list1.Join(list2, x => x.Id, y => y.Id, (x, y) => Tuple.Create(x, y)) .ToList(); list.Foreach(tuple => { foreach(var propertyInfo in properties) { var value1 = propertyInfo.GetValue(tuple.Item1, null); var value2 = propertyInfo.GetValue(tuple.Item2, null); if(value1 != value2) Console.WriteLine("Item with id {0} has different values for property {1}.", tuple.Item1,Id, propertyInfo.Name); } }); ```
There...this will generate new IL! ``` public static class EqualityHelper { private ConcurrentDictionary<Type, object> _cache = new ConcurrentDictionary<Type, object>(); public bool AreEqual<T>(T left, T right) { var equality = (Func<T,T,bool>)_cache.GetOrAdd(typeof(T), CreateEquality<T>()); return equality(left, right); } private Func<T, T, bool> CreateEquality<T>() { var left = Expression.Parameter(typeof(T)); var right = Expression.Parameter(typeof(T)); var properties = from x in typeof(T).GetProperties() where x.GetIndexParameters().Any() == false select x; var expressions = from p in properties select Expression.Equal( Expression.Property(left, p), Expression.Property(right, p)); var body = expressions.Aggregate(Expression.AndAlso); var lambda = Expression.Lambda<Func<T,T,bool>>(body, new [] {left, right}); return lambda.Compile(); } } ```
871,153
Instructions on the [airwave github](https://github.com/phantom-code/airwave) requires me to download and install the Audio Plugins SDK. This step confuses me as new Ubuntu user: > > Unpack the VST SDK archive. Further I'll assume that you have unpacked it in your home directory: `${HOME}/VST3\ SDK.` > > > I have two options: 1. Create a folder in home directory. I am unable to do that and my guess it has to do with root privileges. I believe it is recommended to use `sudo` for temporary access root privileges? I don’t know what command to use or how to create a folder in home directory otherwise 2. Use another folder in my user directory, but can someone explain the following `${HOME}/VST3\ SDK.`. What is with the slash and backslash etc. Can someone explain? I wouldn’t know how to direct the command to my user directory in here: ``` cmake -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=/opt/airwave -DVSTSDK_PATH=${HOME}/VST3\ SDK .. ``` Since I am a new user to Ubuntu some basic explanation would do me well. Thank you for your time and answers
2017/01/12
[ "https://askubuntu.com/questions/871153", "https://askubuntu.com", "https://askubuntu.com/users/641579/" ]
${HOME} means your home directory which is /home/username by default. Simply create a new Folder there named "VST3 SDK" and unpack the archive there. The "\ " is used to indicate a whitespace, because if you would use a terminal command a whitespace also seperates arguments.
To create a folder in home, do the following: 1. Open up the terminal 2. You should already be in home (if not, do: `cd ~`) 3. `mkdir <folder_name>` or `sudo mkdir <folder_name>`
6,019,138
We have a legacy database (SQLServer 2008) with thousands of rows in it. Each record has a logdate field which is a date but stored as a varchar in the format `21/04/2010 16:40:12`. We only need to return the rows where the logdate is in the future, and order them by date. We could pull back all the rows and filter on the server but this seems wrong and won't scale. **Is there a way of doing the filtering and ordering in Entity Framework 4.** This is what we thought might work but it's failed. ``` from c in db.changes where [DateTime]c.logdate > DateTime.Today() orderby [DateTime]c.logdate select c; ``` Any help is appreciated.
2011/05/16
[ "https://Stackoverflow.com/questions/6019138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/448446/" ]
You can't parse a string into a date on the DB server with any built-in L2E function. You can: 1. map a DB function yourself, 2. write SQL and execute it with `ObjectContext.ExecuteStoreQuery`, or 3. fix the metadata. I'd pick the latter, if it were me.
I'm not sure you can do it through pure LINQ unless you create your own LINQ functions. If you can execute an ad-hoc query and have EF4 translate it back into objects, like you can on the DataContext.Translate LINQ2SQL method, you can convert it like this: ``` CONVERT(datetime, logdate, 103) ``` And thus your query would be: ``` SELECT * FROM changes WHERE CONVERT(datetime, logdate, 103) > GETDATE() ORDER BY CONVERT(datetime, logdate, 103) ``` Alternatively, if you can add to the schema (I assume you can't modify the varchar column to store it as a datetime natively), you could add a computed column like so: ``` ALTER TABLE changes ADD logdateDatetime AS CONVERT(datetime, logdate, 103) PERSISTED ``` And then query the logdateDatetime column instead of logdate.
6,019,138
We have a legacy database (SQLServer 2008) with thousands of rows in it. Each record has a logdate field which is a date but stored as a varchar in the format `21/04/2010 16:40:12`. We only need to return the rows where the logdate is in the future, and order them by date. We could pull back all the rows and filter on the server but this seems wrong and won't scale. **Is there a way of doing the filtering and ordering in Entity Framework 4.** This is what we thought might work but it's failed. ``` from c in db.changes where [DateTime]c.logdate > DateTime.Today() orderby [DateTime]c.logdate select c; ``` Any help is appreciated.
2011/05/16
[ "https://Stackoverflow.com/questions/6019138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/448446/" ]
I'm not sure you can do it through pure LINQ unless you create your own LINQ functions. If you can execute an ad-hoc query and have EF4 translate it back into objects, like you can on the DataContext.Translate LINQ2SQL method, you can convert it like this: ``` CONVERT(datetime, logdate, 103) ``` And thus your query would be: ``` SELECT * FROM changes WHERE CONVERT(datetime, logdate, 103) > GETDATE() ORDER BY CONVERT(datetime, logdate, 103) ``` Alternatively, if you can add to the schema (I assume you can't modify the varchar column to store it as a datetime natively), you could add a computed column like so: ``` ALTER TABLE changes ADD logdateDatetime AS CONVERT(datetime, logdate, 103) PERSISTED ``` And then query the logdateDatetime column instead of logdate.
The order in a varchar field will be considerably different than the order in date field. Fix your structure to correctly store dates or add an additional date field that is populated through a trigger. Likely you have bad dates in there as well since there are no controls on a varchar field to diallow dates from being put in. You will need to fix these as well.
6,019,138
We have a legacy database (SQLServer 2008) with thousands of rows in it. Each record has a logdate field which is a date but stored as a varchar in the format `21/04/2010 16:40:12`. We only need to return the rows where the logdate is in the future, and order them by date. We could pull back all the rows and filter on the server but this seems wrong and won't scale. **Is there a way of doing the filtering and ordering in Entity Framework 4.** This is what we thought might work but it's failed. ``` from c in db.changes where [DateTime]c.logdate > DateTime.Today() orderby [DateTime]c.logdate select c; ``` Any help is appreciated.
2011/05/16
[ "https://Stackoverflow.com/questions/6019138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/448446/" ]
You can't parse a string into a date on the DB server with any built-in L2E function. You can: 1. map a DB function yourself, 2. write SQL and execute it with `ObjectContext.ExecuteStoreQuery`, or 3. fix the metadata. I'd pick the latter, if it were me.
The order in a varchar field will be considerably different than the order in date field. Fix your structure to correctly store dates or add an additional date field that is populated through a trigger. Likely you have bad dates in there as well since there are no controls on a varchar field to diallow dates from being put in. You will need to fix these as well.
19,456,034
So, when I send at example "AT" via Serial, GSM always returns me ÿ char. "AT" returns ÿÿ - any one char returns one ÿ. Where is the problem? Maybe connection is wrong? Should I use any resistors and connect GSM TX also to the GND? UPDATE: GSM responds only on CR and NL giving ÿ of each. Any ideas? Code: ``` #include <SoftwareSerial.h> #define rx 10 #define tx 11 SoftwareSerial gsm(rx, tx); void setup() { Serial.begin(9600); gsm.begin(9600); } void loop() { if(gsm.available()) Serial.write(gsm.read()); if(Serial.available()) gsm.write(Serial.read()); } ``` Interfacing: ![Interfacing](https://i.stack.imgur.com/L0h1q.jpg)
2013/10/18
[ "https://Stackoverflow.com/questions/19456034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2088947/" ]
Problem was in the power supply. There must be at least 2 ampers.
Sounds like your baud rate is incorrect. Have you tried 19200? Documentation from other SIM900 based boards show the default at 19200.
51,731,027
I want to select the entire column that contain the names to copy it knowing that the Name column number can change between a spreadsheet and another and there is some blank cells in the middle (missing value) Suppose that the Names column is the column B, so if I want to select the entire column even with the some blank cells in the middle I can use the following code: ``` Range("B2", Range("B" & Rows.Count).End(xlup)).Select ``` But the Name column number is variable. so i tried to make it like this : ``` Sub ColSelection () Dim NameHeader As range 'To select the header of Name column Set NameHeader = ActiveSheet.UsedRange.Find("Name") ActiveSheet.Range(NameHeader.Offset(1,0), Range(NameHeader & Rows.Count).End(xlUp)).select ' run tim error 1004 " Methode 'Range' of object '_Global' Failed End sub ``` I guess that I have to replace the second NameHeader with his column address. how to do that? Should I set a Var to store the address of the range NameHeader, and use it. If it's the case how should I set this var, I mean as long or as Variant..ect? Thanks :)
2018/08/07
[ "https://Stackoverflow.com/questions/51731027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9613229/" ]
Is this what you are trying? I have commented the code so you should not have a problem understanding it. But if you still do then post your query. Is this what you are trying? ``` Sub ColSelection() Dim NameHeader As Range Dim ws As Worksheet Dim ColName As String Dim LRow As Long Dim rng As Range Set ws = Sheet1 '<~~ Change as applicable With ws Set NameHeader = .UsedRange.Find("Name") '~~> Check if we found the text If Not NameHeader Is Nothing Then '~~> Get the Column Name ColName = Split(Cells(, NameHeader.Column).Address, "$")(1) '~~> Get the last row in that range LRow = .Range(ColName & .Rows.Count).End(xlUp).Row '~~> Construct your range Set rng = .Range(ColName & NameHeader.Row & ":" & ColName & LRow) With rng MsgBox .Address '~~> Do whatever you want with the range End With End If End With End Sub ``` **Screenshot** Unable to upload an image, Imgur is rejecting images for the time being. Will update it directly later. <http://prntscr.com/kftsad>
Sub test1a() ``` Dim NameHeader As Range Set NameHeader = ActiveSheet.UsedRange.Find(InputBox("HEADER")) If Not NameHeader Is Nothing Then ActiveSheet.Range(NameHeader.Offset(1), Cells(Rows.Count, NameHeader.Column).End(xlUp)).Select End If ``` End Sub
51,731,027
I want to select the entire column that contain the names to copy it knowing that the Name column number can change between a spreadsheet and another and there is some blank cells in the middle (missing value) Suppose that the Names column is the column B, so if I want to select the entire column even with the some blank cells in the middle I can use the following code: ``` Range("B2", Range("B" & Rows.Count).End(xlup)).Select ``` But the Name column number is variable. so i tried to make it like this : ``` Sub ColSelection () Dim NameHeader As range 'To select the header of Name column Set NameHeader = ActiveSheet.UsedRange.Find("Name") ActiveSheet.Range(NameHeader.Offset(1,0), Range(NameHeader & Rows.Count).End(xlUp)).select ' run tim error 1004 " Methode 'Range' of object '_Global' Failed End sub ``` I guess that I have to replace the second NameHeader with his column address. how to do that? Should I set a Var to store the address of the range NameHeader, and use it. If it's the case how should I set this var, I mean as long or as Variant..ect? Thanks :)
2018/08/07
[ "https://Stackoverflow.com/questions/51731027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9613229/" ]
No need to look at `NameHeader.Address` - just use its `.Column` - something like this (noting that you don't have to `Select` a `Range` before copying. ``` Sub GrabNameCol() Dim NameHeader As Range Set NameHeader = ActiveSheet.UsedRange.Find("Name") If Not NameHeader Is Nothing Then ActiveSheet.Range(NameHeader.Offset(1), Cells(Rows.Count, NameHeader.Column).End(xlUp)).Select ' or just .Copy End If End Sub ```
Sub test1a() ``` Dim NameHeader As Range Set NameHeader = ActiveSheet.UsedRange.Find(InputBox("HEADER")) If Not NameHeader Is Nothing Then ActiveSheet.Range(NameHeader.Offset(1), Cells(Rows.Count, NameHeader.Column).End(xlUp)).Select End If ``` End Sub
261,535
I have a bathroom faucet with wide set taps made by ‍ who knows? They are all messed up and I need to swap them out. But I simply have not been able to figure out how to remove the taps. The taps are metal with side levers like so: [![The tap with its cover on](https://i.stack.imgur.com/JXQFs.jpg)](https://i.stack.imgur.com/JXQFs.jpg) They have a vertical set screw and with some WD40 and a lot of swearing, I managed to get the set screw out and pull the main tap handle off. But now I have a wide piece that I don't know how to remove to pull through from the bottom: [![base of the tap](https://i.stack.imgur.com/tmi3s.jpg)](https://i.stack.imgur.com/tmi3s.jpg) Conversely, on the bottom, there was a plastic nut, which I loosened as far as it would go, but that didn't free it, because it's screwed onto a t-shaped piece (you'll see that the plastic nut has been loosened as far as it will go, but cannot be removed). So I can't pull the copper T up to remove the tap either: [![below the sink](https://i.stack.imgur.com/e1vnb.jpg)](https://i.stack.imgur.com/e1vnb.jpg) I'm at my wits end. Can anyone tell me how to get this thing off?
2022/11/30
[ "https://diy.stackexchange.com/questions/261535", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/159614/" ]
If you aren't keeping the faucet then half the time it is easier to pull out the grinder and just cut it till it will fall through. You have to be careful as you reach the porcelain but generally a grinder, a metal cutting disc and a screw driver to crack the pieces apart works wonders for old faucets. You can spend a lot of time trying to pull them apart and if they are going in the trash then grinding through them is quicker and more fun.
Remove the hoses from the "T-shaped piece" and unscrew it. Then smack the exposed end with a mallet, upwards, if it hasn't come loose by itself at that point.
261,535
I have a bathroom faucet with wide set taps made by ‍ who knows? They are all messed up and I need to swap them out. But I simply have not been able to figure out how to remove the taps. The taps are metal with side levers like so: [![The tap with its cover on](https://i.stack.imgur.com/JXQFs.jpg)](https://i.stack.imgur.com/JXQFs.jpg) They have a vertical set screw and with some WD40 and a lot of swearing, I managed to get the set screw out and pull the main tap handle off. But now I have a wide piece that I don't know how to remove to pull through from the bottom: [![base of the tap](https://i.stack.imgur.com/tmi3s.jpg)](https://i.stack.imgur.com/tmi3s.jpg) Conversely, on the bottom, there was a plastic nut, which I loosened as far as it would go, but that didn't free it, because it's screwed onto a t-shaped piece (you'll see that the plastic nut has been loosened as far as it will go, but cannot be removed). So I can't pull the copper T up to remove the tap either: [![below the sink](https://i.stack.imgur.com/e1vnb.jpg)](https://i.stack.imgur.com/e1vnb.jpg) I'm at my wits end. Can anyone tell me how to get this thing off?
2022/11/30
[ "https://diy.stackexchange.com/questions/261535", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/159614/" ]
Next step, Fist look it there is a pin here to pull out. Then use correct size toll and unscrew the nut (marked with yellow lines) that is holding the ring down. [![pin](https://i.stack.imgur.com/1nxRP.jpg)](https://i.stack.imgur.com/1nxRP.jpg)
Remove the hoses from the "T-shaped piece" and unscrew it. Then smack the exposed end with a mallet, upwards, if it hasn't come loose by itself at that point.
9,352,153
In the below example, I want the Element object to keep track of list of threads who have "marked" the elements. The field variable `name` cannot be changed unless no thread is in the `markedThreadList`. Thread can mark or unmark itself on this element, which adds or removes the thread from the list. ``` class Element { private String name; private LinkedList<?> markedThreadList; //list of threads who have marked public mark(){ //add the thread to the markedThreadList } public unmark(){ //caller thread removes itself from the markedThreadList } public void setName(String name){ if(markedThreadList.size()==0){ this.name = name; } } } ``` My question is, how can I store the thread lists? What type should I use to store them? Should I just give unique integers to each thread when it starts running, and use that information?
2012/02/19
[ "https://Stackoverflow.com/questions/9352153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/482594/" ]
A thread is an instance of `java.lang.Thread`. Use a `Set<Thread>` (rather than a List). You can access the current thread using `Thread.currentThread()`.
Perhaps you want to call [`Thread.currentThread()`](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html#currentThread%28%29), which returns a `Thread`?
9,352,153
In the below example, I want the Element object to keep track of list of threads who have "marked" the elements. The field variable `name` cannot be changed unless no thread is in the `markedThreadList`. Thread can mark or unmark itself on this element, which adds or removes the thread from the list. ``` class Element { private String name; private LinkedList<?> markedThreadList; //list of threads who have marked public mark(){ //add the thread to the markedThreadList } public unmark(){ //caller thread removes itself from the markedThreadList } public void setName(String name){ if(markedThreadList.size()==0){ this.name = name; } } } ``` My question is, how can I store the thread lists? What type should I use to store them? Should I just give unique integers to each thread when it starts running, and use that information?
2012/02/19
[ "https://Stackoverflow.com/questions/9352153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/482594/" ]
Because multiple threads are modifying a single `Element` instance, you need to consider concurrency issues carefully. Since you have two variables that interact (the element name can only be set if there are no marks), you'll need to synchronize on some lock. Otherwise, you could use a concurrent collection like `ConcurrentHashMap` to store the set of marks. ``` final class Element { private final Set<Thread> marks = new HashSet<Thread>(); private String name; public boolean mark() { synchronized(marks) { return marks.add(Thread.currentThread()); } } public boolean unmark(){ synchronized(marks) { return marks.remove(Thread.currentThread()); } } public boolean setName(String name){ synchronized(marks) { if (marks.isEmpty()) { this.name = name; return true; } else return false; } } } ```
Perhaps you want to call [`Thread.currentThread()`](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html#currentThread%28%29), which returns a `Thread`?
9,352,153
In the below example, I want the Element object to keep track of list of threads who have "marked" the elements. The field variable `name` cannot be changed unless no thread is in the `markedThreadList`. Thread can mark or unmark itself on this element, which adds or removes the thread from the list. ``` class Element { private String name; private LinkedList<?> markedThreadList; //list of threads who have marked public mark(){ //add the thread to the markedThreadList } public unmark(){ //caller thread removes itself from the markedThreadList } public void setName(String name){ if(markedThreadList.size()==0){ this.name = name; } } } ``` My question is, how can I store the thread lists? What type should I use to store them? Should I just give unique integers to each thread when it starts running, and use that information?
2012/02/19
[ "https://Stackoverflow.com/questions/9352153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/482594/" ]
A thread is an instance of `java.lang.Thread`. Use a `Set<Thread>` (rather than a List). You can access the current thread using `Thread.currentThread()`.
Here's an example: ``` import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collections; class Element implements Iterable<Thread> { private String name; private final Set<Thread> markedThreads = Collections.synchronizedSet(new HashSet<Thread>()); public void mark(){ markedThreads.add(Thread.currentThread()); } public void unmark(){ markedThreads.remove(Thread.currentThread()); } public synchronized void setName(String name){ if(markedThreads.isEmpty()){ this.name = name; } } public Iterator<Thread> iterator() { return markedThreads.iterator(); } } ``` The point I'd think you'd want to note are that because it implements `hashCode` and `equals` correctly, instances of the `Thread` class can be used directly in typical Java collections, such as `HashSet`, without needing to give them identifiers like integers. And the static method `Thread.currentThread` returns the current `Thread` object.
9,352,153
In the below example, I want the Element object to keep track of list of threads who have "marked" the elements. The field variable `name` cannot be changed unless no thread is in the `markedThreadList`. Thread can mark or unmark itself on this element, which adds or removes the thread from the list. ``` class Element { private String name; private LinkedList<?> markedThreadList; //list of threads who have marked public mark(){ //add the thread to the markedThreadList } public unmark(){ //caller thread removes itself from the markedThreadList } public void setName(String name){ if(markedThreadList.size()==0){ this.name = name; } } } ``` My question is, how can I store the thread lists? What type should I use to store them? Should I just give unique integers to each thread when it starts running, and use that information?
2012/02/19
[ "https://Stackoverflow.com/questions/9352153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/482594/" ]
Because multiple threads are modifying a single `Element` instance, you need to consider concurrency issues carefully. Since you have two variables that interact (the element name can only be set if there are no marks), you'll need to synchronize on some lock. Otherwise, you could use a concurrent collection like `ConcurrentHashMap` to store the set of marks. ``` final class Element { private final Set<Thread> marks = new HashSet<Thread>(); private String name; public boolean mark() { synchronized(marks) { return marks.add(Thread.currentThread()); } } public boolean unmark(){ synchronized(marks) { return marks.remove(Thread.currentThread()); } } public boolean setName(String name){ synchronized(marks) { if (marks.isEmpty()) { this.name = name; return true; } else return false; } } } ```
Here's an example: ``` import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collections; class Element implements Iterable<Thread> { private String name; private final Set<Thread> markedThreads = Collections.synchronizedSet(new HashSet<Thread>()); public void mark(){ markedThreads.add(Thread.currentThread()); } public void unmark(){ markedThreads.remove(Thread.currentThread()); } public synchronized void setName(String name){ if(markedThreads.isEmpty()){ this.name = name; } } public Iterator<Thread> iterator() { return markedThreads.iterator(); } } ``` The point I'd think you'd want to note are that because it implements `hashCode` and `equals` correctly, instances of the `Thread` class can be used directly in typical Java collections, such as `HashSet`, without needing to give them identifiers like integers. And the static method `Thread.currentThread` returns the current `Thread` object.
28,491,329
Currently creating a chrome extension which sits inside other applications. Currently, the application is an ember based app and therefore has it's url changes via javascript. At some point this was working but I cannot get it to work any longer. Why doesn't it work? ``` $rootScope.$watch(function(){ return window.location; }, function(value){ console.log(value) $rootScope.locationChanged(); }, true) ```
2015/02/13
[ "https://Stackoverflow.com/questions/28491329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2785428/" ]
You have to install the package "libspatialindex-dev" with the systems package manager. At least this is true with my system (Mint 17.1) which should be 100% compatible to a default Ubuntu installation.
You have to install `libspatialindex-dev` in your ubuntu system. Here i am using ubuntu 16.04 or 18.04 `sudo apt update` `sudo apt install libspatialindex-dev` install Rtree using your python pip version, i have pip 3.7 `pip3.7 install Rtree` `import rtree`
49,064,157
I am having difficulty running the below simple script from crontab: ``` #!/bin/bash notify-send "battery.sh working" ``` The permissions of the file are `rwxr-xr-x` and its running fine with either of the commands `bash battery.sh` and `sh battery.sh`. In my crontab, I have tried running it with both `bash` and `sh`, with absolute as well as local path. My current crontab looks as follows: ``` * * * * * /home/marpangal/battery.sh * * * * * sh battery.sh * * * * * bash battery.sh * * * * * sh /home/marpangal/battery.sh * * * * * bash /home/marpangal/battery.sh ``` However the cron does not execute the script and I get no message from notify-send.
2018/03/02
[ "https://Stackoverflow.com/questions/49064157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7116413/" ]
So, It will work just fine and should work in all major browsers, the downside is that it isn't valid. It's not necessarily hurting anything, but since we live in a testable, verifiable world, it's technically counter spec, so it's not to standard.
What makes is not compliant is that it goes against the reasoning of having particular html [symantics](https://www.thoughtco.com/why-use-semantic-html-3468271). The list helps screen readers and crawlers understand the content better. This can help with the users experience as well as assist with proper content indexing and archiving by search engines.
49,064,157
I am having difficulty running the below simple script from crontab: ``` #!/bin/bash notify-send "battery.sh working" ``` The permissions of the file are `rwxr-xr-x` and its running fine with either of the commands `bash battery.sh` and `sh battery.sh`. In my crontab, I have tried running it with both `bash` and `sh`, with absolute as well as local path. My current crontab looks as follows: ``` * * * * * /home/marpangal/battery.sh * * * * * sh battery.sh * * * * * bash battery.sh * * * * * sh /home/marpangal/battery.sh * * * * * bash /home/marpangal/battery.sh ``` However the cron does not execute the script and I get no message from notify-send.
2018/03/02
[ "https://Stackoverflow.com/questions/49064157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7116413/" ]
So, It will work just fine and should work in all major browsers, the downside is that it isn't valid. It's not necessarily hurting anything, but since we live in a testable, verifiable world, it's technically counter spec, so it's not to standard.
What I do if I'm ever unsure if something is valid or not; I go to [W3C validator](https://validator.w3.org/) and input the html. As long as you input a full html file it will tell you if it's valid or not. :) The website gives you three options for validating html: 1. Validate by URI (Just enter the webpage that you want to validate. 2. Validate by File Upload (upload the html file that you would like to validate. 3. Validate by Direct Input (Copy and paste or type the html code) I usually do option 3 because I use PHP a lot, so I load the webpage then get the html after the scripting (right click -> view page source) then copy and paste that into the input box.
49,064,157
I am having difficulty running the below simple script from crontab: ``` #!/bin/bash notify-send "battery.sh working" ``` The permissions of the file are `rwxr-xr-x` and its running fine with either of the commands `bash battery.sh` and `sh battery.sh`. In my crontab, I have tried running it with both `bash` and `sh`, with absolute as well as local path. My current crontab looks as follows: ``` * * * * * /home/marpangal/battery.sh * * * * * sh battery.sh * * * * * bash battery.sh * * * * * sh /home/marpangal/battery.sh * * * * * bash /home/marpangal/battery.sh ``` However the cron does not execute the script and I get no message from notify-send.
2018/03/02
[ "https://Stackoverflow.com/questions/49064157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7116413/" ]
So, It will work just fine and should work in all major browsers, the downside is that it isn't valid. It's not necessarily hurting anything, but since we live in a testable, verifiable world, it's technically counter spec, so it's not to standard.
**Is this legit?** No. Although browser show perfectly but W3C Validator will not permit you write this way. You will get error if you go with your code in validation engine. Validator will show you message like following. "**Error:** Element div not allowed as child of element ol in this context." Also see here: `https://html.spec.whatwg.org/#toc-dom` in "**Semantics, structure, and APIs of HTML documents**" section to get overall idea.
49,064,157
I am having difficulty running the below simple script from crontab: ``` #!/bin/bash notify-send "battery.sh working" ``` The permissions of the file are `rwxr-xr-x` and its running fine with either of the commands `bash battery.sh` and `sh battery.sh`. In my crontab, I have tried running it with both `bash` and `sh`, with absolute as well as local path. My current crontab looks as follows: ``` * * * * * /home/marpangal/battery.sh * * * * * sh battery.sh * * * * * bash battery.sh * * * * * sh /home/marpangal/battery.sh * * * * * bash /home/marpangal/battery.sh ``` However the cron does not execute the script and I get no message from notify-send.
2018/03/02
[ "https://Stackoverflow.com/questions/49064157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7116413/" ]
It's not legit, but browsers are extremely forgiving and will still try to render something as best as they can, even if the HTML you give it is technically wrong.
What makes is not compliant is that it goes against the reasoning of having particular html [symantics](https://www.thoughtco.com/why-use-semantic-html-3468271). The list helps screen readers and crawlers understand the content better. This can help with the users experience as well as assist with proper content indexing and archiving by search engines.
49,064,157
I am having difficulty running the below simple script from crontab: ``` #!/bin/bash notify-send "battery.sh working" ``` The permissions of the file are `rwxr-xr-x` and its running fine with either of the commands `bash battery.sh` and `sh battery.sh`. In my crontab, I have tried running it with both `bash` and `sh`, with absolute as well as local path. My current crontab looks as follows: ``` * * * * * /home/marpangal/battery.sh * * * * * sh battery.sh * * * * * bash battery.sh * * * * * sh /home/marpangal/battery.sh * * * * * bash /home/marpangal/battery.sh ``` However the cron does not execute the script and I get no message from notify-send.
2018/03/02
[ "https://Stackoverflow.com/questions/49064157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7116413/" ]
It's not legit, but browsers are extremely forgiving and will still try to render something as best as they can, even if the HTML you give it is technically wrong.
What I do if I'm ever unsure if something is valid or not; I go to [W3C validator](https://validator.w3.org/) and input the html. As long as you input a full html file it will tell you if it's valid or not. :) The website gives you three options for validating html: 1. Validate by URI (Just enter the webpage that you want to validate. 2. Validate by File Upload (upload the html file that you would like to validate. 3. Validate by Direct Input (Copy and paste or type the html code) I usually do option 3 because I use PHP a lot, so I load the webpage then get the html after the scripting (right click -> view page source) then copy and paste that into the input box.