_id
stringlengths 2
6
| partition
stringclasses 3
values | text
stringlengths 4
46k
| language
stringclasses 1
value | title
stringclasses 1
value |
---|---|---|---|---|
d801 | train | My team set it up so that a hub operation actually "returns" twice, and maybe this is what you're looking for.
When a hub operation is invoked, we have synchronous code do whatever it needs to do and return a result object, which is usually a model from a backend service we're calling. That is pushed to the client via client.SendAsync where client is IClientProxy. That's going to ultimately invoke a JS handler on your front end.
However, should something break, we may not get that callback to the JS handler. In that case, we also have our hub operations return a Task<IActionResult> that the front JS can handle. That acts more like a HTTP status code response.
In the end, each hub operation we invoke has at least 1 response, which is the IActionResult:
{"type":3,"invocationId":"0","result":{"statusCode":200}}
This approach allows us to setup a reusable client that behaves more like a normal REST client in that we can use the IActionResult response to trigger exception handling.
Example:
try
{
const result = await this.connection.invoke(callSettings.operation, callSettings.args);
if (responseHandler){
const apiResponse = new ApiResponse({ statusCode: result.statusCode });
responseHandler.handleStatusCode(apiResponse, callSettings.operation, callSettings.args);
}
hubResponse.success = result.statusCode < 300;
hubResponse.httpStatusCode = result.statusCode;
hubResponse.body = result;
}
catch (err)
{
hubResponse.success = false;
this.loggerService.logException(err, callSettings.operation);
throw(err);
} | unknown | |
d802 | train | What you call a controller should be turned into a service class, that retrieves data from the database, and pass it to the calling methods. You should add this service to the DI container in the Startup class. To use this service in your components you should inject it like this:
@inject DataService myDataService
I think that the Blazor templates come with sample how to define such a service and use it in your components.
Here's a link to a sample by the Blazor team how to create a service and how to use it in your components. The service doesn't use Entity Framework, but this is something really minor I'm sure you'll cope with. | unknown | |
d803 | train | You can use floor_date to get 1st date of current month, ceiling_date to get 1st date of next month subtract - 1 to get last day of current month and create sequence.
library(lubridate)
todays_date <- Sys.Date()
seq(floor_date(todays_date, 'month'),
ceiling_date(todays_date, 'month') - 1, by = 1)
Also other similar variations,
floor_date(todays_date, 'month') + 1:days_in_month(todays_date) - 1
seq(floor_date(todays_date, 'month'),
length.out = days_in_month(todays_date), by = 1)
This returns object of class 'Date', there are function in base R as well as lubridate to get whichever part of Date you want.
A: Package timeperiodsR has a handy function for that :
timeperiodsR::this_month(part = "sequence") | unknown | |
d804 | train | The solution was to add startup after creating the TabContainer.
Thanks to this post: http://www.dojotoolkit.org/forum/dijit-dijit-0-9/dijit-support/tabcontainer-labels-not-rendering-when-created-programatically
tabContainer = new dijit.layout.TabContainer({
}, div);
tabContainer.startup();
A: Another possibility is that adding TabContainer to a hidden element can have missing tabs, as described above, even after calling startup. The solution to this is to ensure that the TabContainer receives the resize event. You can try this yourself by finding the ID of the tab container, and then executing this in the console:
dijit.byId('dijit_layout_TabContainer_0').resize();
If your tabs appear, then you have a resize problem. Ensure that the parent container handles/passes the resize event to the tab container child. For example:
resize: function() {
this.tabContainer.resize();
} | unknown | |
d805 | train | This literal "TESTEEEE" is of type char const[9]. When used as an argument to a function, it can decay to char const* but not to char*. Hence to use your function, you have to make the parameter fit to your argument or the opposite as follows
#include <iostream>
using namespace std;
int PrintString(const char* s)
{
cout << s << endl;
}
int main(int argc, char* argv[])
{
PrintString("TESTEEEE");
return 0;
}
live
OR
#include <iostream>
using namespace std;
int PrintString( char* s)
{
cout << s << endl;
}
int main(int argc, char* argv[])
{
char myArr[] = "TESTEEEE";
PrintString(myArr);
return 0;
}
live
A: You have incorrect constness, it should be:
void PrintString(const char* s) | unknown | |
d806 | train | What version of Python are you using?
This seems to be happening for versions prior to 3 in which input has a different behavior: input() error - NameError: name '...' is not defined
You could try with name = raw_input("name: ") instead as pointed out in the answer.
A: I tested your script and it's working fine in my system as well as I checked the code that also seems OK . Here is the output
I have tested it in VS Code using Python 3.8.5 in the 64-bit system.
So maybe the problem is in the version of Python because before Python3 there was a notion of raw_input.
Let me know your Python version. | unknown | |
d807 | train | It seems to me that the whole template is an implementation detail of a different interface:
template<bool MyFlag, unsigned int Limit, unsigned int Current = 0> myFunctionImpl();
template<bool MyFlag, unsigned int Limit> myFunction() {
myFunctionImpl<MyFlag, Limit, 0>();
}
Now it becomes easier to document: myFunction() (and all it's arguments) are part of the interface, which does not include the iteration counter. myFunctionImpl() is the implementation of that interface and does not need to be documented at all (or only minimally with a comment stating that it is an implementation detail and user code should not depend on it or use it directly). If you want, you can enclose the implementation in an #ifdef block so that the doxygen preprocessor removes it and it does not appear in the generated documentation.
A: One option to convey that a parameter should not be specified would be to hide it in the documentation. For example you could conditionally compile out the internal parameters:
/// \brief Do something
/// \tparam MyFlag A flag...
/// \tparam Limit Recursion limit
template<bool MyFlag, unsigned int Limit
#if !defined(DOXYGEN)
, unsigned int Current = 0
#endif
> myFunction();
This would prevent them from appearing in the documentation, but they would still be available to the implementation. | unknown | |
d808 | train | Possibly your locator is not correct.
Also, the send element button appears with a short delay after the text is inserted into the message text area.
Try this:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 20)
wait.until(EC.visibility_of_element_located((By.XPATH, '//span[@data-testid="send"]'))).click() | unknown | |
d809 | train | Is that java.awt.Frame? I think you need to explicitly add the handler for so:
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
System.exit(0);
}
}
I used this source for so.
If it were swing it would be something like jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
A: add aFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
A: class Graph extends Canvas{
public Graph(){
setSize(200, 200);
setBackground(Color.white);
addWindowListener(
new java.awt.event.WindowAdapter() {
public void windowClosing( java.awt.event.WindowEvent e ) {
System.out.println( "Closing window!" );
dispose() ;
System.exit( 0 );
}
}
);
}
public static void main(String[] args){
Graph gr = new Graph();
Frame aFrame = new Frame();
aFrame.setSize(300, 300);
aFrame.add(gr);
aFrame.setVisible(true);
} | unknown | |
d810 | train | Just add to their position in the update loop rather than using the physics engine.
void Update()
{
transform.position += Vector3.down * Time.deltaTime;
}
This will move any object that it is attached to down at a constant rate. Put this in a script and add it to the prefab that you are instantiating.
A: I Think you should set to zero the "Gravity Scale" of the RigitBody2D atached to the smallFlame. This should stop the acceleration.
To add moviment to them. Use Rigitbody2D.velocity | unknown | |
d811 | train | I think your best solution would be to debug your client and server in separate instances of visual studio and setting startup projects accordingly.
As for the second question, I normally set a guid and output on create and release of a lock. to see if this is happening. If it is, I set breakpoints and debug and look at the stack to see where on the calls are coming from. You may be able to output System.Environment.StackTrace to a log to get this information, but I've ever attempted it.
A: You can use 2 Visual studios. One starting the console, one starting the server
I Would check if you really need a lock statement.
What do you want to lock ?
Do you always need a exclusive lock ?
Or are there some operations which can happen in parallel and only some which are exclusive ?
In this case you could use the ReaderWriterLockSlim
This can reduce the risk of deadlocks. | unknown | |
d812 | train | Authorities are loaded when access token its required.
Using jdbc store, authorities are saved to OAUTH_ACCESS_TOKEN table, AUTHENTICATION column.
When refresh token its required, authorities are loaded from database.
If authorities changed after access token was required, you will have to implement custom token store.
Take a look to org.springframework.security.oauth2.provider.token.store.JdbcTokenStore, and extend from it. | unknown | |
d813 | train | The Entity and View classes offer a baseUrl() method, so it's probably not very hard. Just follow the directions from the documentation:
*
*https://github.com/marmelab/ng-admin/blob/master/doc/Configuration-reference.md#entity-configuration
*https://github.com/marmelab/ng-admin/blob/master/doc/Configuration-reference.md#entity-configuration
*https://github.com/marmelab/ng-admin/blob/master/doc/API-mapping.md | unknown | |
d814 | train | Then first of all, try to get solr running. | unknown | |
d815 | train | I had the same problem and I could really only find one solution. I'm not sure why but yeah, something in android prevents task locking when booting up which boggles my mind since the task lock was designed to create these "kiosk" type of applications. The only solution I could find was to detect for a case when it didn't lock then restart the application. Its a little "hacky" but what else can you do?
To detect for the case where it didn't lock I created a state variable and assigning states (Locking, Locked, Unlocking, Unlocked). Then in the device admin receiver in onTaskModeExiting if the state isn't "Unlocking" then I know it unlocked on its own. So if this case happened where it failed, I then restart the application using this method (which schedules the application in the alarm manager then kills the application):
how to programmatically "restart" android app?
Here is some sample code:
DeviceAdminReceiver
@Override
public void onLockTaskModeEntering(Context context, Intent intent, String pkg) {
super.onLockTaskModeEntering(context, intent, pkg);
Lockdown.LockState = Lockdown.LOCK_STATE_LOCKED;
}
@Override
public void onLockTaskModeExiting(Context context, Intent intent) {
super.onLockTaskModeExiting(context, intent);
if (Lockdown.LockState != Lockdown.LOCK_STATE_UNLOCKING) {
MainActivity.restartActivity(context);
}
Lockdown.LockState = Lockdown.LOCK_STATE_UNLOCKED;
}
MainActivity
public static void restartActivity(Context context) {
if (context != null) {
PackageManager pm = context.getPackageManager();
if (pm != null) {
Intent intent = pm.getLaunchIntentForPackage(context.getPackageName());
if (intent != null) {
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
int pendingIntentId = 223344;
PendingIntent pendingIntent = PendingIntent.getActivity(context, pendingIntentId, intent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, pendingIntent);
System.exit(0);
}
}
}
}
private void lock() {
Lockdown.LockState = Lockdown.LOCK_STATE_LOCKING;
startLockTask();
}
private void unlock() {
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
if (am.getLockTaskModeState() == ActivityManager.LOCK_TASK_MODE_LOCKED) {
Lockdown.LockState = Lockdown.LOCK_STATE_UNLOCKING;
stopLockTask();
}
}
In truth this is a simplified version of what I implemented. But it should hopefully get you pointed towards a solution.
A: The only solution I found as for now : make another launcher app, without locktask, which will trigger main app every time when launcher appears. This prevent user for waiting few more seconds before LockTasked app is being called with on BOOT_COMPLETED receiver. So we can meet this problem only when lockTask app has launcher properties for some activity in manifest.
A: Sorry for late answering, but...
Anyone has this problem can do this tricky work in first (LAUNCHER/HOME) activity (e.g. MainActivity):
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (mSharedPreferences.getBoolean(KEY_PREF_RECREATED, false)) {
mSharedPreferences.edit().putBoolean(KEY_PREF_RECREATED, false).apply();
// start LOCK TASK here
} else {
mSharedPreferences.edit().putBoolean(KEY_PREF_RECREATED, true).apply();
finish(); // close the app
startActivity(new Intent(this, MainActivity.class)); // reopen the app
return;
}
setContentView(R.layout.activity_main);
// other codes
} | unknown | |
d816 | train | You should be able to do this without implementing a custom similarity class. The first requirement is (from your description) a straight forward sort on the count value, while the latter can be implemented by sorting on the value from the strdist() function. You can also multiply or weight these values against each other in a single sort statement by using several functions.
If you really, really need to build your own scorer (which I don't think you need to do from your description) - these are usually written to explore other ranking algorithms than tf/idf, bm25 etc. for larger corpuses, a search on Google gives you many resources with pre-made, easy to adopt solutions. I particularly want to point out "This is the Nuclear Option" in Build Your Own Custom Lucene Query and Scorer:
Unless you just want the educational experience, building a custom Lucene Query should be the “nuclear option” for search relevancy. It’s very fiddly and there are many ins-and-outs. If you’re actually considering this to solve a real problem, you’ve already gone down the following paths [...] | unknown | |
d817 | train | Yes, reserved entities in HTML are case sensitive.
Browsers will be nice to you and accept whatever you give them, but you should be using the proper casing.
See also: https://www.w3.org/TR/html52/syntax.html#named-character-references
A: From the below resource:
https://www.tutorialrepublic.com/html-tutorial/html-entities.php
Note: HTML entities names are case-sensitive! Please check out the
HTML character entities reference for a complete list of character
entities of special characters and symbols
And From https://www.youth4work.com/Talent/html/Forum/117977-is-html-case-sensitive
Generally, HTML is case-insensitive, but there are a few exceptions.
Entity names (the things that follow ampersands) are case-senstive,
but many browsers will accept many of them entirely in uppercase or
entirely in lowercase; a few must be cased in particular ways. For
example, Ç is Ç and ç is ç. Other combinations of upper
and lower case are no good. | unknown | |
d818 | train | The following writeup might help you:
http://geekgirllife.com/place-text-over-images-on-hover-without-javascript/
It is one of the simplest methods I came across. Place the div tag containing text right below the img tag. | unknown | |
d819 | train | In your IF statement you're assigning the value not comparing.
= vs == or ===
You need to switch them to == at the very least, but it would be better to use ===.
<?php
if ($row['ediShipDate'] === "Before Debit Exp"){
print("<img src=/img/check-yes.png>");
print("one") ;
}
else if ($row['ediShipDate'] === "AFTER DEBIT EXP!"){
print("<img src=/img/check-no.png>");
print("two") ;
}
else {
print $row['ediShipDate'] ;
print("three") ;
}
?>
<value="<?= $ediShipDate ?>"></td> | unknown | |
d820 | train | I am a novice programmer and I have no knowledge of gaming theory.
Ok, we can work with that.
So I decided the smartest way to avoid a lot of rendering and buffering is to have four JPanels.
You've just unnecessarily complicated your program.
Think of a JPanel as a canvas. You want to draw the entire Breakout game; bricks, paddle, and ball, on one JPanel canvas. Don't worry, you'll be able to redraw the entire canvas fast enough to get 60 frames per second if you want.
The way to do this is to create a Brick class, a Paddle class, and a Ball class. You create a Game Model class that contains one instance of the Paddle class, one instance pf the Ball class, and a List of instances of the Brick class.
The Brick class would have fields to determine its position in the wall, the number of points scored when the ball collides with the brick, the color of the brick, and a draw method that knows how to draw one brick.
The ball class would have fields to determine its x, y position, its direction, its velocity, and a draw method that knows how to draw the ball.
The Paddle class would have fields to determine its x, y position, its direction, its velocity, and a draw method that knows haw to draw the paddle.
The Game Model class would have methods to determine when the ball collides with a brick, determine when the ball collides with a brick, determine when the ball collides with a wall, and a draw method that calls the other model class draw methods to draw a ball, a paddle, and a wall of bricks.
This should be enough for now to get you started going in the right direction.
Edited to answer questions:
How would I implement a draw method in all these classes?
Here's an example Ball class. I haven't tested the moveBall method, so it might need some adjustment
import java.awt.Graphics;
import java.awt.geom.Point2D;
public class Ball {
private Point2D position;
/** velocity in pixels per second */
private double velocity;
/**
* direction in radians
* <ul>
* <li>0 - Heading east (+x)</li>
* <li>PI / 2 - Heading north (-y)</li>
* <li>PI - Heading west (-x)</li>
* <li>PI * 3 / 2 - Heading south (+y)</li>
* </ul>
* */
private double direction;
public Point2D getPosition() {
return position;
}
public void setPosition(Point2D position) {
this.position = position;
}
public double getVelocity() {
return velocity;
}
public void setVelocity(double velocity) {
this.velocity = velocity;
}
public double getDirection() {
return direction;
}
public void setDirection(double direction) {
this.direction = direction;
}
public void moveBall(long milliseconds) {
Point2D oldPosition = position;
// Calculate distance of ball motion
double distance = velocity / (1000.0D * milliseconds);
// Calculate new position
double newX = distance * Math.cos(direction);
double newY = distance * Math.sin(direction);
newX = oldPosition.getX() + newX;
newY = oldPosition.getY() - newY;
// Update position
position.setLocation(newX, newY);
}
public void draw(Graphics g) {
int radius = 3;
int x = (int) Math.round(position.getX());
int y = (int) Math.round(position.getY());
// Draw circle of radius and center point x, y
g.drawOval(x - radius, y - radius, radius + radius, radius + radius);
}
}
The draw method draws the ball wherever it actually is located. That's all the draw method does.
Actually moving the ball is the responsibility of the Game Model class. The method for moving the ball is included in this class because the information necessary to move the ball is stored in the Ball class.
I gave the ball a radius of 3, or a diameter of 6 pixels. You may want to make the ball bigger, and use the fillOval method instead of drawOval.
should I just call repaint() at a 30ms interval
Basically, yes.
In psudeocode, you create a game loop
while (running) {
update game model();
draw game();
wait;
}
First, you update the game model. I gave you a Ball class. You would have similar classes for the paddle and bricks. They all have draw methods.
Your Game model class calls all of these draw methods in the proper order. In Breakout, you would draw the boundaries first, then the bricks, then the paddle, and finally, the ball.
Your JPanel (canvas) calls the one draw method in the Game Model class.
I don't have an example game to show you, but if you read the article Sudoku Solver Swing GUI, you'll see how to put together a Swing GUI and you'll see how model classes implement draw methods.
I suggest that you stop working on Breakout for a while and go through the Oracle Swing Tutorial. Don't skip any sections in your haste to write a program. Go through the entire tutorial so you understand how Swing works before you try and use it. | unknown | |
d821 | train | you are doing some graphical changes in secondary thread .. you must do all the graphical changes in your main thread. check you thread code. | unknown | |
d822 | train | Github has a number of apis that you can use and I'm sure there are many user created ones as well:
GitHub API
I know they recently rolled out
Webhooks
Some developer guides | unknown | |
d823 | train | You can attempt to hide if from peering eyes using the code below. It would still be discoverable if you tried, but at least it's away from open text view. All it does is add characters to the text and then subtract them before it uses the password.
Run this script using your original password
<?php
$password = "test";
echo "Original Password In Plain Text = $password\n";
$len=strlen($password);
$NewPassword = "";
for( $i = 0; $i <= $len-1; $i++ ) {
$charcode = ord(substr( $password, $i, 1 ));
$NewChar = $charcode+5; $NewLetter = chr($NewChar);
$NewPassword = $NewPassword . $NewLetter;
} echo "Modified Password to Use in Script = $NewPassword\n";
$OrigPassword = "";
for( $i = 0; $i <= $len-1; $i++ ) {
$charcode = ord(substr( $NewPassword, $i, 1 ));
$OrigChar = $charcode-5; $OrigLetter = chr($OrigChar);
$OrigPassword = $OrigPassword . $OrigLetter;
} echo "Convert the Modified back to the Original = $OrigPassword\n";
?>
Add this part to your script with the new password from the above script
$password = "yjxy";
$OrigPassword = "";
for( $i = 0; $i <= $len-1; $i++ ) {
$charcode = ord(substr( $password, $i, 1 ));
$OrigChar = $charcode-5; $OrigLetter = chr($OrigChar);
$OrigPassword = $OrigPassword . $OrigLetter;
} $password = $OrigPassword;
echo "Script thinks this is the password = $password\n";
A: The best way to hide the password is to save it in external file and then include it in your php script. Your file with this password let's say 'config.php' should be above DOCUMENT_ROOT to make it unaccesible via browser. It's common aproach and for example you can see it in Zend Framework directory structure where only "public" directory is visible for user. The proper CHMOD should be set to this file as well.
Under this link you have ZF directory structure where you can check location of config files.
A: This question has been asked and answered lots of times here (but not specifically for Google docs). Short answer is that there is nothing you can do.
Longer answer is that you can mitigate the possibility of the credentials being compromised by:
*
*using credentials supplied the user rather than stored in code
*using tokens supplied by the user as a means of decrypting credentials stored in your code (but this gets very complicated with lots of users)
*storing the credentials in an include file held outside the document root | unknown | |
d824 | train | Just assign the string using +=.
$string = 'arbitrary string' # << is random
$string = ($string += 'randomstring').Substring(0, [math]::MIN(20, $string.Length)) # | unknown | |
d825 | train | Unfortunately, there is no option in Xcode to warn you about an API that does not exists on your deployment target. However, there is a workaround to use the API:
Class TheClass = NSClassFromString(@"NewerClassName");
if(TheClass != nil)
{
NewerClassName *newClass = [[NewerClassName alloc] init];
if(newClass != nil)
{
//Now, you can use NewerClassName safely
}
}
This probably won't provide warnings for that API, but it will allow you to pass Apple's validation process. | unknown | |
d826 | train | You are not calling ord properly, this should do:
InPut=input("Please enter the key you used to encrypt the above text: ")
ord_key="".join(map(str,[ord(d) for d in InPut]))
if you want to reverse the stringfied '&+hs,DY just map chr to it:
reversed = map(chr, "`&+hs,DY")
If you are using python 3.x transform it to a list:
reversed = list(map(chr, "`&+hs,DY")) | unknown | |
d827 | train | The solution using usort and explode functions:
$selectTableRows = array("1_6", "3_4", "10_1", "2_2", "5_7");
usort($selectTableRows, function ($a, $b){
return explode('_', $a)[1] - explode('_', $b)[1];
});
print_r($selectTableRows);
The output:
Array
(
[0] => 10_1
[1] => 2_2
[2] => 3_4
[3] => 1_6
[4] => 5_7
) | unknown | |
d828 | train | Like this :
set /a YEAR=%DATE:~-2% + 1
A: set /a YEAR=1%DATE:~-2%+1
set YEAR= %DATE:~-2%%YEAR:~-2%
This is assuming that you want 1415 for the 2014-2015 financial year.
Are you aware that your construct will yield a Space before the string? Spaces are significant in string-assignments - on both sides of the =.
It's safer to use
set "YEAR=%DATE:~-2%%YEAR:~-2%"
for instance - the rabbit's ears in this format ensure that trailing spaces are omitted (that can cause chaos) | unknown | |
d829 | train | I think my answer is the most complicated but at least it works:
var allRanks = new List<string>
{
"1st"
,"2nd"
,"3rd"
};
foreach (var entry in result)
{
dates.Add(entry.Dates);
}
var singleDates = dates.GroupBy(x => x).Select(grp => grp.First()).ToArray();
Labels = singleDates;
foreach (var ran in allRanks)
{
foreach (var day in singleDates)
{
if (ran == "1st")
{
if (result.Exists(x => x.Dates == day && x.Rank == ran) == true)
{
SeriesCollection[0].Values.Add(result.Where(w => w.Dates == day && w.Rank == ran).Select(x => x.Amount).First());
}
else SeriesCollection[0].Values.Add(0);
}
if (ran == "2nd")
{
if (result.Exists(x => x.Dates == day && x.Rank == ran) == true)
{
SeriesCollection[1].Values.Add(result.Where(w => w.Dates == day && w.Rank == ran).Select(x => x.Amount).First());
}
else SeriesCollection[1].Values.Add(0);
}
if (ran == "3rd")
{
if (result.Exists(x => x.Dates == day && x.Rank == ran) == true)
{
SeriesCollection[2].Values.Add(result.Where(w => w.Dates == day && w.Rank == ran).Select(x => x.Amount).First());
}
else SeriesCollection[2].Values.Add(0);
}
}
} | unknown | |
d830 | train | Just add a view with a background color and use It as your window's background.
Take a look at this sample app. | unknown | |
d831 | train | After many hours of searching, repairing system using SFC.EXE /SCANNOW command I found that the problem was McAfee antivirus program. My PC come with McAfee, but I uninstall it it - at least this is what I thought I did.
This page explains how to do it in details:
detail explanation
What I did was to run this program:
McAfee uninstall
Zalek | unknown | |
d832 | train | I hope this article will guide you in a proper way of installing subversion on WAMP server.
If it works don't forgot to promote it to correct answer.. So it may help others. | unknown | |
d833 | train | I checked the links that You provided here, but non of them solved the problem.
For example this one:
Request request = new Request()
.setDeleteDimension(new DeleteDimensionRequest()
.setRange(new DimensionRange()
.setSheetId(0)
.setDimension("ROWS")
.setStartIndex(30)
.setEndIndex(32)
)
);
The problem is that, there is no such a thing like .setDeleteDimension under Request. This shouldn't be such a problem, but it is....
Below You can find my code. What does it do, is to take data from one sheet (internal) and put it to another sheet (internal archive). When this is done (and this works well), I want to delete data from internal as it is already archived... and that part is not working. I just don't know how to delete the rows.. if anyone could have a look on this, it would be great. Thanks for your help...
public void RunArchiveInternal2(bool testRun)
{
//internal
string SheetIDInternal = "googlesheetid_internal";
string RangeInternal = testRun ? "test_task tracking" : "Task Tracking - INTERNAL";
SpreadsheetsResource.ValuesResource.GetRequest getRequestInternal = sheetsService.Spreadsheets.Values.Get(SheetIDInternal, RangeInternal);
ValueRange ValuesInternal = getRequestInternal.Execute();
//internal archive
string SheetIDInternalArchive = "googlesheetid_internal_archive";
string RangeInternalArchive = testRun ? "test_archive_internal" : "Sheet1";
SpreadsheetsResource.ValuesResource.GetRequest getRequestInternalArchive = sheetsService.Spreadsheets.Values.Get(SheetIDInternalArchive, RangeInternalArchive);
ValueRange ValuesInternalArchive = getRequestInternalArchive.Execute();
//Get data from internal and put to internal archive
List<IList<object>> listOfValuesToInsert = new List<IList<object>>();
for (int i = 1; i <= ValuesInternal.Values.Count() - 1; i++)
{
List<object> rowToUpdate = new List<object>();
if (ValuesInternal.Values[i][1] != null && ValuesInternal.Values[i][1].ToString().ToUpper() == "TASK COMPLETE")
{
rowToUpdate = (List<object>)ValuesInternal.Values[i];
listOfValuesToInsert.Add(rowToUpdate);
}
}
SpreadsheetsResource.ValuesResource.AppendRequest insertRequest = sheetsService.Spreadsheets.Values.Append(new ValueRange { Values = listOfValuesToInsert }, SheetIDInternalArchive, RangeInternalArchive + "!A1");
insertRequest.ValueInputOption = SpreadsheetsResource.ValuesResource.AppendRequest.ValueInputOptionEnum.USERENTERED;
insertRequest.Execute();
//delete things from internal
BatchUpdateSpreadsheetRequest batchUpdateSpreadsheetRequest = new BatchUpdateSpreadsheetRequest();
List<DeleteDimensionRequest> requests = new List<DeleteDimensionRequest>();
for (int i = ValuesInternal.Values.Count() - 1; i >= 1; i--)
{
DeleteDimensionRequest request = new DeleteDimensionRequest();
//Request request = new Request();
if (ValuesInternal.Values[i][1] != null && ValuesInternal.Values[i][1].ToString().ToUpper() == "TASK COMPLETE")
{
request.Range = new DimensionRange
{
Dimension = "ROWS",
StartIndex = i,
EndIndex = i
};
requests.Add(request);
}
}
batchUpdateSpreadsheetRequest.Requests = requests;//this is wrong
SpreadsheetsResource.BatchUpdateRequest Deletion = sheetsService.Spreadsheets.BatchUpdate(batchUpdateSpreadsheetRequest, SheetIDInternal);
Deletion.Execute();
} | unknown | |
d834 | train | It looks like StorageMax does not actually limit the size of the IPFS node, instead it's used to determine whether or not to run garbage collection. IPFS will write until the disk is full. | unknown | |
d835 | train | Your SQL is ending up like this:
WHERE dbo.InvMaster.InvCurrency = '@varCURRENCY'
So you are not looking for the value of the parameter, you are looking for @Currency, I am not sure why you are using Dynamic SQL, the following should work fine:
CREATE PROCEDURE [dbo].[SP_SLINVOICE] @varCURRENCY AS VARCHAR(3)
AS
BEGIN
SET NOCOUNT ON;
SELECT dbo.invmaster.InvNumber
FROM dbo.invmaster
INNER JOIN dbo.invdetail
ON dbo.invmaster.INVMasterID = dbo.invdetail.INVMasterID
INNER JOIN dbo.Company
ON dbo.invmaster.InvCompanyID = dbo.Company.CompanyID
WHERE dbo.InvMaster.InvCurrency = @varCURRENCY
AND dbo.invmaster.DocType <> 'MC'
ORDER BY dbo.invmaster.InvNumber ASC;
END
If you need Dynamic SQL for some other reason you can use the following to pass @varCURRENCY as a parameter to sp_executesql:
DECLARE @SQL NVARCHAR(MAX);
SELECT @SQL = N'SELECT dbo.invmaster.InvNumber
FROM dbo.invmaster INNER JOIN dbo.invdetail ON dbo.invmaster.INVMasterID = dbo.invdetail.INVMasterID
INNER JOIN dbo.Company ON dbo.invmaster.InvCompanyID = dbo.Company.CompanyID
WHERE dbo.InvMaster.InvCurrency = @varCURRENCY
AND dbo.invmaster.DocType <> ''MC''
ORDER BY dbo.invmaster.InvNumber ASC;';
EXEC sp_executesql @sql, N'@varCURRENCY VARCHAR(3)', @varCURRENCY;
A: If you want to pass a variable to an sp_executesql context, you need to pass it as a parameter.
EXECUTE sp_executesql
@sql,
N'@varCurrency varchar(3)',
@varcurrency= @varCurrency;
http://msdn.microsoft.com/en-gb/library/ms188001.aspx
Although why you don't just use
select ... where dbo.InvMaster.InvCurrency = @varCURRENCY
instead of the executesql is beyond me.
A: You need to pass @varCURRENCY as a parameter, Remove extra ' from your Sp.
WHERE dbo.InvMaster.InvCurrency = ' + @varCURRENCY + '
Or do not use dynamic query
CREATE PROCEDURE [dbo].[SP_SLINVOICE]
@varCURRENCY AS VARCHAR(3)
AS
BEGIN
SET NOCOUNT ON;
SELECT dbo.invmaster.InvNumber
FROM dbo.invmaster INNER JOIN dbo.invdetail ON dbo.invmaster.INVMasterID = dbo.invdetail.INVMasterID
INNER JOIN dbo.Company ON dbo.invmaster.InvCompanyID = dbo.Company.CompanyID
WHERE dbo.InvMaster.InvCurrency = @varCURRENCY
AND dbo.invmaster.DocType <> 'MC'
ORDER BY dbo.invmaster.InvNumber ASC; | unknown | |
d836 | train | I got the answer to my question:
File s= response.getEntity(File.class);
File ff = new File("C:\\somewhere\\some.txt");
s.renameTo(ff);
FileWriter fr = new FileWriter(s);
fr.flush();
A: Using Rest easy Client this is what I did.
String fileServiceUrl = "http://localhost:8081/RESTfulDemoApplication/files";
RestEasyFileServiceRestfulClient fileServiceClient = ProxyFactory.create(RestEasyFileServiceRestfulClient.class,fileServiceUrl);
BaseClientResponse response = (BaseClientResponse)fileServiceClient.getFile("SpringAnnontationsCheatSheet.pdf");
File s = (File)response.getEntity(File.class);
File ff = new File("C:\\RestFileUploadTest\\SpringAnnontationsCheatSheet_Downloaded.pdf");
s.renameTo(ff);
FileWriter fr = new FileWriter(s);
fr.flush();
System.out.println("FileDownload Response = "+ response.getStatus()); | unknown | |
d837 | train | You can avoid Error Handing and GoTo statements all together (which is definitely best practice) by testing within the code itself and using If blocks and Do loops (et. al.).
See this code which should accomplish the same thing:
Dim pf As PivotField, pi As PivotItem
Set pf = PivotTables(1).PivotField("myField") 'adjust to your needs
For i = 1 To repNumber
Do
Dim bFound As Boolean
bFound = False
repName = InputBox("Enter rep name you want to exclude.", "Name of Rep")
For Each pi In pf.PivotItems
If pi.Value = repName Then
pi.Visible = False
bFound = True
Exit For
End If
Next pi
Loop Until bFound = True
Next i
A: Try Resume TryAgain instead of GoTo TryAgain.
(You don't need : in these statements, it is by coincidence allowed because it is also used to seperate multiple statements within a line, so it is just meaningless here). | unknown | |
d838 | train | I think http://regexpal.com/ is a very good resource to learn regexp in general. Combine this with the mozilla docs: https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions
For 4, you are better of parsing the string as a number with parseInt or parseFloat and then comparing them with an if.
A: *
*I'm guessing you dont want the brackets (0[1-9]|1[0-2])/(0[1-9]|1[0-9]|2[0-9]|3[01])/[0-9]{4}
Note this doesn't validate that the number of days is valid in that month
*
*[a-zA-Z0-9]+?
*[a-zA-Z0-9\s]+?
*I wouldn't use regex for this but anyway (1[5-9]|[2-9][0-9]|100)
for these you may need to add the bol an eol chars depending on where your input is coming from (as in is there other content in the line).
Tested using regexpal | unknown | |
d839 | train | cmp %eax,0x80498d4(,%ebx,4)
cmp is the comparison assembly instruction. It performs a comparison between two arguments by signed subtracting the right argument from the left and sets a CPU EFLAGS register. This EFLAGS register can then be used to do conditional branching / moving, etc.
First argument: `%eax (the value in the %eax register)
Second argument: 0x80498d4(,%ebx,4). This is read as offset ( base, index, scale ) In your example, the value of the second argument is the memory location offset 0x80498d4 + base (which I believe defaults to zero if not included) + value in %ebx register * 4 (scaling factor).
Note: I believe base here is empty and defaults to the value 0.
You can take a look at http://docs.oracle.com/cd/E19120-01/open.solaris/817-5477/ennby/index.html for more information on the syntax for Intel x86 assembly instructions. | unknown | |
d840 | train | detect browser back
window.onhashchange = function() {
//blah blah blah
}
function goBack() {
window.location.hash = window.location.lasthash[window.location.lasthash.length-1];
//blah blah blah
window.location.lasthash.pop();
}
A: use popstate on window obj window.addEventListener('popstate', callBackFn);
whenever use will click on back button popstate event will get triggered | unknown | |
d841 | train | i think you have to change for loop like this
for (int i = 0; i < sessions.length(); i++) {
HashMap<String, String> map2 = new HashMap<String, String>();
HashMap<String, String> list_map = new HashMap<String, String>();
JSONObject e = sessions.getJSONObject(i);
list_map.put("category_name", e.getString("name"));
list_map.put("category_id", e.getString("id"));
list_category.add(list_map);
}
A: problem is in below line
list_map.put("category_name", e.getString("name"));
list_map.put("category_id", e.getString("id"));
list_category.add(list_map);
you are putting category_name and id into list_map and adding same into list_category. here you are adding list_map instance in list_category. and becuse of the key for map(which is category_name and id ) is same,
it can store only one value corresponding to one key, hence it is storing last inserting value of these keys.
when you are updating list_map with new data the instance itself getting change), That is why it is showing 6 times of last list_map data.
Solution : what you can do here, initialize list_map in loop only with new keyword, so it will insert new instance every-time you insert into list_category. or you can use two d array. instead of hashmap.
HashMap<String, String> list_map = new HashMap<String, String>();
P.S: I pointed out one problem in your code, which is causing duplicacy of data, there can be other problem also as suggested by other SO members.
Edit:
replace your below code
for(int i = 0 ; i < checkedList.size() ; i++) {
clubs = "," + String.valueOf(checkedList.get(i));
}
clubs = clubs.substring(1);
with something like below
StringBuilder sb = new StringBuilder();
for(int i = 0 ; i < checkedList.size() ; i++) {
sb.add(String.valueOf(checkedList.get(i))+",");
}
sb.deleteCharAt(sb.lastIndexOf(","));
A: change getView methode like this
if (convertView == null)
{
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.dialoglist,null);
}
TextView item = (TextView) convertView.findViewById(R.id.dialogitem);
item.setText(list_category.get(position).get("category_name")); | unknown | |
d842 | train | You'd have to change the speed mechanism of the fish, By lowering the number you multiply with
changing
this.speedX= (tx/dist) * 1
into
this.speedX=(tx/dist) * 0.1
should reduce the speed by 10 times | unknown | |
d843 | train | You can do the following to get what you are looking for :
WITH CTE AS(SELECT Employee.EmployeeId,
EmployeeName,
ProjectName
FROM Employee
JOIN ProjEmp
ON Employee.EmployeeId=ProjEmp.EmployeeId
JOIN Project
ON Project.ProjectId=ProjEmp.ProjectId)
SELECT EmployeeId,EmployeeName,
ProjectName = STUFF((
SELECT ',' + convert(varchar(10),T2.ProjectName)
FROM CTE T2
WHERE T1.EmployeeName = T2.EmployeeName
FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '')
FROM CTE T1
GROUP BY EmployeeId,EmployeeName
ORDER BY EmployeeId
Result:
EMPLOYEEID EMPLOYEENAME PROJECTNAME
1 Emp1 ProjA,ProjB
3 Emp3 ProjC
4 Emp4 ProjC,ProjD
5 Emp5 ProjE
7 Emp7 ProjE
8 Emp8 ProjE
See result in SQL Fiddle. | unknown | |
d844 | train | SELECT denomination, count(com)
FROM security
WHERE denomination IN (200, 50, 1000, 100)
GROUP BY denomination; | unknown | |
d845 | train | Your filename should be a string.
Filename e, m, g should be "e", "m", "g", result should be "result".
Refer to code below:
#!/usr/bin/python
# -*- coding: utf-8 -*-
filenames= ["e","g","m"]
with open("results", "w") as outfile:
for file in filenames:
with open(file) as infile:
for line in infile:
outfile.write(line) | unknown | |
d846 | train | You have a very procedural way of thinking this which would not work well in SQL. You can think of it as joining the city with all its nearby airports.
The following may work:
SELECT a.name, SUM(c.cty_population)
FROM cities c JOIN airports a ON (
6371 * acos (
cos ( radians(a.latitude) )
* cos( radians( c.cty_latitude ) )
* cos( radians( c.cty_longitude ) - radians(a.longitude) )
+ sin ( radians(a.latitude) )
* sin( radians( c.cty_latitude ) )
) < 100
WHERE (filter airports or something else here)
GROUP BY a.airport_id, a.name
Also, I suggest you migrate to MySQL 5.7 which includes spatial functions and data types built in. | unknown | |
d847 | train | According to this tutorials on Hibernate 4+Gradle:
your resources folder should be under main, not under java:
Edit:
probably, you are missing something in the way you are building the sessionfactory:
Configuration configuration = new Configuration().configure();
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
sessionFactory = configuration.buildSessionFactory(builder.build());
instead of :
return new Configuration().configure().buildSessionFactory(
new StandardServiceRegistryBuilder().build() );
you have to applysettings to pass properties of your configuration to the builder: | unknown | |
d848 | train | Several immediate problems:
If word contains an apostrophe, all pointers in root are set to NULL here:
for (int j = 0; j < N; j++)
{
root->children[j] = NULL;
}
Typo? That will make them "unfreeable" (not to mention, check will never find them).
Same problem in the else branch:
for (int k = 0; k < N; k++)
{
root->children[k] = NULL;
}
The apostrophe check needs to be discrete. It also looks like program doesn't "save" enough pointers, but you won't be able to work through that until these big structural problems are corrected. | unknown | |
d849 | train | One way I am thinking, there could be other better ways also:
@Override
public void run() {
String name = Thread.currentThread().getName();
while (true) {
while (queue.peek() == null) {
//some sleep time
}
synchronized (lock) {
while (queue.peek() != null && !name.equals(String.valueOf(queue.peek().intValue() % 2 ))) {
try {
lock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if(queue.peek() != null) {
try {
System.out.println(name + ",consumed," + queue.take());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
lock.notify();
}
}
}
Another Way: To have anotherLock that will be notified by producer thread whenever element is added to queue.
@Override
public void run() {
String name = Thread.currentThread().getName();
while (true) {
synchronized (anotherLock) {
while (queue.peek() == null) {
anotherLock.wait();
}
}
synchronized (lock) {
while (queue.peek() != null && !name.equals(String.valueOf(queue.peek().intValue() % 2 ))) {
try {
lock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if(queue.peek() != null) {
try {
System.out.println(name + ",consumed," + queue.take());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
lock.notify();
}
}
} | unknown | |
d850 | train | I pasted simple regression modeling here.
You can use original train data and test data as tuple.
train = (data, label)
Here, data.shape = (Number of data, Number of data dimesion)
And, label.shape = (Number of data,)
Both of their data type should be numpy.float32.
import chainer
from chainer.functions import *
from chainer.links import *
from chainer.optimizers import *
from chainer import training
from chainer.training import extensions
from chainer import reporter
from chainer import datasets
import numpy
class MyNet(chainer.Chain):
def __init__(self):
super(MyNet, self).__init__(
l0=Linear(None, 30, nobias=True),
l1=Linear(None, 1, nobias=True),
)
def __call__(self, x, t):
l0 = self.l0(x)
f0 = relu(l0)
l1 = self.l1(f0)
f1 = flatten(l1)
self.loss = mean_squared_error(f1, t)
reporter.report({'loss': self.loss}, self)
return self.loss
def get_optimizer():
return Adam()
def training_main():
model = MyNet()
optimizer = get_optimizer()
optimizer.setup(model)
train, test = datasets.get_mnist(label_dtype=numpy.float32)
train_iter = chainer.iterators.SerialIterator(train, 50)
test_iter = chainer.iterators.SerialIterator(test, 50,
repeat=False,
shuffle=False)
updater = training.StandardUpdater(train_iter, optimizer)
trainer = training.Trainer(updater, (10, 'epoch'))
trainer.extend(extensions.ProgressBar())
trainer.extend(extensions.Evaluator(test_iter, model))
trainer.extend(
extensions.PlotReport(['main/loss', 'validation/main/loss'],
'epoch'))
trainer.run()
if __name__ == '__main__':
training_main() | unknown | |
d851 | train | According to @juvian help The problem was that styling was set inline on div cointainer and it seems that tooltips inherited it from div. So the answer is to remove the styling from div container and apply it to the desired element. | unknown | |
d852 | train | Default behaviour of git push is just to push "matching refs", i.e. branches which are present both in the local and the remote repository. In your example, there are no such branches, so you need to tell git push which branches to push explicitly, i.e. via
git push origin branch-to-be-pushed
or, if you want to push all branches,
git push --all origin | unknown | |
d853 | train | Logic:
*
*Read the file
*Replace "<?xml version='1.0' encoding='UTF-8'?>" with ""
*Write the data to a temp file. If you are ok with replacing the original file then you can do that as well. Amend the code accordingly.
*Open the text file in Excel
Is this what you are trying? (UNTESTED)
Code:
Option Explicit
Sub Sample()
Dim MyData As String
Dim FlName As String, tmpFlName As String
'~~> I am hardcoding the paths. Please change accordingly
FlName = "C:\Sample.xml"
tmpFlName = "C:\Sample.txt"
'~~> Kill tempfile name if it exists
On Error Resume Next
Kill tmpFlName
On Error GoTo 0
'~~> Open the xml file and read the data
Open FlName For Binary As #1
MyData = Space$(LOF(1))
Get #1, , MyData
'~~> Replace the relevant tag
MyData = Replace(MyData, "<?xml version='1.0' encoding='UTF-8'?>", "")
Close #1
'~~> Write to a temp text file
Open tmpFlName For Output As #1
Print #1, MyData
Close #1
Workbooks.OpenText Filename:=tmpFlName, _
StartRow:=1, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=True, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=True, _
OtherChar:="|"
End Sub
Alternative Way:
After
'~~> Open the xml file and read the data
Open FlName For Binary As #1
MyData = Space$(LOF(1))
Get #1, , MyData
'~~> Replace the relevant tag
MyData = Replace(MyData, "<?xml version='1.0' encoding='UTF-8'?>", "")
Close #1
use
strData() = Split(MyData, vbCrLf)
and then write this array to Excel and use .TextToColumns | unknown | |
d854 | train | You can read the header of your input csv files first and find the indexes of required field in this given csv file.
Once you have required indexes for every header, read those fields using indexes in the standard order you want for your output csv file.
sample codes:
`CSVReader reader = new CSVReader(new FileReader(fileName ));
String[] header = reader.readNext();
List<String> list= Arrays.asList(header);
int indexOfFieldTransaction=list.indexOf("transaction");`
Now make a List and insert the field in order you want to write in output file.you will get -1 if the field you are trying to get index of is not present in the input file. | unknown | |
d855 | train | This is gotten from the manual, and is for windows (Since you didn't specify the OS.) using the COM class.
Note : This has nothing to do with the client side.
<?php
$fso = new COM('Scripting.FileSystemObject');
$D = $fso->Drives;
$type = array("Unknown","Removable","Fixed","Network","CD-ROM","RAM Disk");
foreach($D as $d ){
$dO = $fso->GetDrive($d);
$s = "";
if($dO->DriveType == 3){
$n = $dO->Sharename;
}else if($dO->IsReady){
$n = $dO->VolumeName;
$s = file_size($dO->FreeSpace) . " free of: " . file_size($dO->TotalSize);
}else{
$n = "[Drive not ready]";
}
echo "Drive " . $dO->DriveLetter . ": - " . $type[$dO->DriveType] . " - " . $n . " - " . $s . "<br>";
}
function file_size($size)
{
$filesizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
return $size ? round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i] : '0 Bytes';
}
?>
Would output something similar to
Drive C: - Fixed - Bla - 88.38 GB free of: 444.14 GB
Drive D: - Fixed - Blas - 3.11 GB free of: 21.33 GB
Drive E: - Fixed - HP_TOOLS - 90.1 MB free of: 99.02 MB
Drive F: - CD-ROM - [Drive not ready] -
Drive G: - CD-ROM - Usb - 0 Bytes free of: 24.75 MB
Drive H: - Removable - [Drive not ready] - | unknown | |
d856 | train | If you want what you ask, you need a regex that splits by colon and period.
Something like this?
:.+\.
EDIT: Here is a breakdown of this regular expression (as requested by Roman C)
: matches the colon character (:) literally
.+ matches any character one and unlimited times, greedy (except newline)
\. matches the period character (.) literally
A: This splits the string on both the colon or period. Element index 1 (the second element) is what you want. Just trim it.
String description = "Description: This is the description. Observation: This is the description.".
split("[\\.:]")[1].trim();
You could also pre-trim it:
String description = "Description: This is the description. Observation: This is the description.".
split("[\\.:] +")[1];
Use "[\\.:]\\s+" if there might be non-space whitespace.
A: Split is not the best method to use. This code gets you the part you want:
String part = string.replaceAll("\\w+:\\s+(.*?)\\s+\\w+:.*", "$1");
This also trims the part extracted.
Some test code:
String string = "Description: This is the description. Observation: This is the description.";
String part = string.replaceAll("\\w+:\\s+(.*?)\\s+\\w+:.*", "$1");
System.out.println(part);
Output:
This is the description.
A: What about the next?:
String string = "Description: This is the description. Observation: This is the description.";
String str = string.replaceFirst(".*:\\s+(.*)", "$1"); | unknown | |
d857 | train | You can add one more button below the next button. Keep that button hidden till you reach the last step. When you reach the last step make it visible and on click of it write the logic to process your data. | unknown | |
d858 | train | There is a built in feed in Wordpress that you can use.
I would recommend you to read up on https://codex.wordpress.org/WordPress_Feeds and try the examples to see if you can make it work.
A: Wordpress creates an RSS feed in XML by default; this might appear to you as HTML when you view the RSS in a browser. View the page source to see the XML structure.
Get the feed programmatically (the DOM structure might be different in your instance):
$xml = simplexml_load_file('http://wordpress.example.com/feed/');
foreach ($xml->channel->item as $item) {
print $item->title;
print PHP_EOL;
} | unknown | |
d859 | train | This will work:
const getObjectId = (fieldID) => {
const object = objects.find(object => object.fields.find(field => field.id === fieldID )!== undefined)
if(object) return object.objectID;
return null
}
A: Using the find array method:
const objects = [
{ objectId: 1, fields: ["aaa"] },
{ objectId: 2, fields: ["bbb"] },
{ objectId: 3, fields: ["ccc"] },
];
const getObjectId = (id) => objects.find(object.objectId === id);
console.log(getObjectId(2));
// { objectId: 2, fields: ["bbb"] }
Read more here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find | unknown | |
d860 | train | There are literal arrowheads in the Spacing Modifier Letters block:
U+02C2 ˂ ˂ Modifier Letter Left Arrowhead
U+02C3 ˃ ˃ Modifier Letter Right Arrowhead
U+02C4 ˄ ˄ Modifier Letter Up Arrowhead
U+02C5 ˅ ˅ Modifier Letter Down Arrowhead
A: Since you're using these arrows for a toggle switch you may want to consider creating these arrows with an html element using the following styles instead of unicode characters.
.upparrow {
height: 0;
width: 0;
border: 4px solid transparent;
border-bottom-color: #000;
}
.downarrow {
height: 0;
width: 0;
border: 4px solid transparent;
border-top-color: #000;
}
http://jsfiddle.net/FrsGR/
A: For HTML Entities
◄ = ◄
► = ►
▼ = ▼
▲ = ▲
A: OPTION 1: UNICODE COLUMN SORT ARROWS
I found this one very handy for a single character column sorter.
(Looks good upscaled)
⇕ = ⇕
IMPORTANT NOTE (When using Unicode symbols)
Unicode support varies dependant on the symbol of choice, browser and
the font family. If you find your chosen symbol does not work in some
browsers then try using a different font-family. Microsoft recommends
"Segoe UI Symbol" however it would be wise to include the font with
your website as not many people have it on their computers.
Open this page in other browsers to see which symbols render with the default font.
Some more unicode arrows.
To use them:
*
*Copy them right off the page.
*Use the code above each row inserting the corresponding hexadeximal number before the closing semi-colon relating to it's poition in the row.
Last Digit
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
ș
← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↚ ↛ ↜ ↝ ↞ ↟
___
Ț
↠ ↡ ↢ ↣ ↤ ↥ ↦ ↧ ↨ ↩ ↪ ↫ ↬ ↭ ↮ ↯
___
ț
↰ ↱ ↲ ↳ ↴ ↵ ↶ ↷ ↸ ↹ ↺ ↻ ↼ ↽ ↾ ↿
___
Ȝ
⇀ ⇁ ⇂ ⇃ ⇄ ⇅ ⇆ ⇇ ⇈ ⇉ ⇊ ⇋ ⇌ ⇍ ⇎ ⇏
___
ȝ
⇐ ⇑ ⇒ ⇓ ⇔ ⇕ ⇖ ⇗ ⇘ ⇙ ⇚ ⇛ ⇜ ⇝ ⇞ ⇟
___
Ȟ
⇠ ⇡ ⇢ ⇣ ⇤ ⇥ ⇦ ⇧ ⇨ ⇩ ⇪ ⇫ ⇬ ⇭ ⇮ ⇯
___
ȟ
⇰ ⇱ ⇲ ⇳ ⇴ ⇵ ⇶ ⇷ ⇸ ⇹ ⇺ ⇻ ⇼ ⇽ ⇾ ⇿
___
Additional HTML unicode symbols
A selected list of other helpful Unicode icons/symbols.
U+2302 ⌂ HOUSE
U+2303 ⌃ UP ARROWHEAD
U+2304 ⌄ DOWN ARROWHEAD
U+2305 ⌅ PROJECTIVE
U+2306 ⌆ PERSPECTIVE
U+2307 ⌇ WAVY LINE
U+2315 ⌕ TELEPHONE RECORDER
U+2316 ⌖ POSITION INDICATOR
U+2317 ⌗ VIEWDATA SQUARE
U+2318 ⌘ PLACE OF INTEREST SIGN
U+231A ⌚ WATCH
U+231B ⌛ HOURGLASS
U+2326 ⌦ ERASE TO THE RIGHT
U+2327 ⌧ X IN A RECTANGLE BOX
U+2328 ⌨ KEYBOARD
U+2329 〈 LEFT-POINTING ANGLE BRACKET
U+232A 〉 RIGHT-POINTING ANGLE BRACKET
U+232B ⌫ ERASE TO THE LEFT
U+23E9 ⏩ BLACK RIGHT-POINTING DOUBLE TRIANGLE
U+23EA ⏪ BLACK LEFT-POINTING DOUBLE TRIANGLE
U+23EB ⏫ BLACK UP-POINTING DOUBLE TRIANGLE
U+23EC ⏬ BLACK DOWN-POINTING DOUBLE TRIANGLE
U+23ED ⏭ BLACK RIGHT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR
U+23EE ⏮ BLACK LEFT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR
U+23EF ⏯ BLACK RIGHT-POINTING TRIANGLE WITH DOUBLE VERTICAL BAR
U+23F0 ⏰ ALARM CLOCK
U+23F1 ⏱ STOPWATCH
U+23F2 ⏲ TIMER CLOCK
U+23F3 ⏳ HOURGLASS WITH FLOWING SAND
U+2600 ☀ BLACK SUN WITH RAYS
U+2601 ☁ CLOUD
U+2602 ☂ UMBRELLA
U+2603 ☃ SNOWMAN
U+2604 ☄ COMET
U+2605 ★ BLACK STAR
U+2606 ☆ WHITE STAR
U+2607 ☇ LIGHTNING
U+2608 ☈ THUNDERSTORM
U+2609 ☉ SUN
U+260A ☊ ASCENDING NODE
U+260B ☋ DESCENDING NODE
U+260C ☌ CONJUNCTION
U+260D ☍ OPPOSITION
U+260E ☎ BLACK TELEPHONE
U+260F ☏ WHITE TELEPHONE
U+2610 ☐ BALLOT BOX
U+2611 ☑ BALLOT BOX WITH CHECK
U+2612 ☒ BALLOT BOX WITH X
U+2613 ☓ SALTIRE
U+2614 ☔ UMBRELLA WITH RAINDROPS
U+2615 ☕ HOT BEVERAGE
U+2616 ☖ WHITE SHOGI PIECE
U+2617 ☗ BLACK SHOGI PIECE
U+2618 ☘ SHAMROCK
U+2619 ☙ REVERSED ROTATED FLORAL HEART BULLET
U+261A ☚ BLACK LEFT-POINTING INDEX
U+261B ☛ BLACK RIGHT-POINTING INDEX
U+261C ☜ WHITE LEFT POINTING INDEX
U+261D ☝ WHITE UP POINTING INDEX
U+261E ☞ WHITE RIGHT POINTING INDEX
U+261F ☟ WHITE DOWN POINTING INDEX
U+2620 ☠ SKULL AND CROSSBONES
U+2621 ☡ CAUTION SIGN
U+2622 ☢ RADIOACTIVE SIGN
U+2623 ☣ BIOHAZARD SIGN
U+262A ☪ STAR AND CRESCENT
U+262B ☫ FARSI SYMBOL
U+262C ☬ ADI SHAKTI
U+262D ☭ HAMMER AND SICKLE
U+262E ☮ PEACE SYMBOL
U+262F ☯ YIN YANG
U+2638 ☸ WHEEL OF DHARMA
U+2639 ☹ WHITE FROWNING FACE
U+263A ☺ WHITE SMILING FACE
U+263B ☻ BLACK SMILING FACE
U+263C ☼ WHITE SUN WITH RAYS
U+263D ☽ FIRST QUARTER MOON
U+263E ☾ LAST QUARTER MOON
U+263F ☿ MERCURY
U+2640 ♀ FEMALE SIGN
U+2641 ♁ EARTH
U+2642 ♂ MALE SIGN
U+2643 ♃ JUPITER
U+2644 ♄ SATURN
U+2645 ♅ URANUS
U+2646 ♆ NEPTUNE
U+2647 ♇ PLUTO
U+2648 ♈ ARIES
U+2649 ♉ TAURUS
U+264A ♊ GEMINI
U+264B ♋ CANCER
U+264C ♌ LEO
U+264D ♍ VIRGO
U+264E ♎ LIBRA
U+264F ♏ SCORPIUS
U+2650 ♐ SAGITTARIUS
U+2651 ♑ CAPRICORN
U+2652 ♒ AQUARIUS
U+2653 ♓ PISCES
U+2654 ♔ WHITE CHESS KING
U+2655 ♕ WHITE CHESS QUEEN
U+2656 ♖ WHITE CHESS ROOK
U+2657 ♗ WHITE CHESS BISHOP
U+2658 ♘ WHITE CHESS KNIGHT
U+2659 ♙ WHITE CHESS PAWN
U+265A ♚ BLACK CHESS KING
U+265B ♛ BLACK CHESS QUEEN
U+265C ♜ BLACK CHESS ROOK
U+265D ♝ BLACK CHESS BISHOP
U+265E ♞ BLACK CHESS KNIGHT
U+265F ♟ BLACK CHESS PAWN
U+2660 ♠ BLACK SPADE SUIT
U+2661 ♡ WHITE HEART SUIT
U+2662 ♢ WHITE DIAMOND SUIT
U+2663 ♣ BLACK CLUB SUITE
U+2664 ♤ WHITE SPADE SUIT
U+2665 ♥ BLACK HEART SUIT
U+2666 ♦ BLACK DIAMOND SUIT
U+2667 ♧ WHITE CLUB SUITE
U+2668 ♨ HOT SPRINGS
U+2669 ♩ QUARTER NOTE
U+266A ♪ EIGHTH NOTE
U+266B ♫ BEAMED EIGHTH NOTES
U+266C ♬ BEAMED SIXTEENTH NOTES
U+266D ♭ MUSIC FLAT SIGN
U+266E ♮ MUSIC NATURAL SIGN
U+266F ♯ MUSIC SHARP SIGN
U+267A ♺ RECYCLING SYMBOL FOR GENERIC MATERIALS
U+267B ♻ BLACK UNIVERSAL RECYCLING SYMBOL
U+267C ♼ RECYCLED PAPER SYMBOL
U+267D ♽ PARTIALLY-RECYCLED PAPER SYMBOL
U+267E ♾ PERMANENT PAPER SIGN
U+267F ♿ WHEELCHAIR SYMBOL
U+2680 ⚀ DIE FACE-1
U+2681 ⚁ DIE FACE-2
U+2682 ⚂ DIE FACE-3
U+2683 ⚃ DIE FACE-4
U+2684 ⚄ DIE FACE-5
U+2685 ⚅ DIE FACE-6
U+2686 ⚆ WHITE CIRCLE WITH DOT RIGHT
U+2687 ⚇ WHITE CIRCLE WITH TWO DOTS
U+2688 ⚈ BLACK CIRCLE WITH WHITE DOT RIGHT
U+2689 ⚉ BLACK CIRCLE WITH TWO WHITE DOTS
U+268A ⚊ MONOGRAM FOR YANG
U+268B ⚋ MONOGRAM FOR YIN
U+268C ⚌ DIGRAM FOR GREATER YANG
U+268D ⚍ DIGRAM FOR LESSER YIN
U+268E ⚎ DIGRAM FOR LESSER YANG
U+268F ⚏ DIGRAM FOR GREATER YIN
U+2690 ⚐ WHITE FLAG
U+2691 ⚑ BLACK FLAG
U+2692 ⚒ HAMMER AND PICK
U+2693 ⚓ ANCHOR
U+2694 ⚔ CROSSED SWORDS
U+2695 ⚕ STAFF OF AESCULAPIUS
U+2696 ⚖ SCALES
U+2697 ⚗ ALEMBIC
U+2698 ⚘ FLOWER
U+2699 ⚙ GEAR
U+269A ⚚ STAFF OF HERMES
U+269B ⚛ ATOM SYMBOL
U+269C ⚜ FLEUR-DE-LIS
U+269D ⚝ OUTLINED WHITE STAR
U+269E ⚞ THREE LINES CONVERGING RIGHT
U+269F ⚟ THREE LINES CONVERGING LEFT
U+26A0 ⚠ WARNING SIGN
U+26A1 ⚡ HIGH VOLTAGE SIGN
U+26A2 ⚢ DOUBLED FEMALE SIGN
U+26A3 ⚣ DOUBLED MALE SIGN
U+26A4 ⚤ INTERLOCKED FEMALE AND MALE SIGN
U+26A5 ⚥ MALE AND FEMALE SIGN
U+26A6 ⚦ MALE WITH STROKE SIGN
U+26A7 ⚧ MALE WITH STROKE AND MALE AND FEMALE SIGN
U+26A8 ⚨ VERTICAL MALE WITH STROKE SIGN
U+26A9 ⚩ HORIZONTAL MALE WITH STROKE SIGN
U+26AA ⚪ MEDIUM WHITE CIRCLE
U+26AB ⚫ MEDIUM BLACK CIRCLE
U+26BD ⚽ SOCCER BALL
U+26BE ⚾ BASEBALL
U+26BF ⚿ SQUARED KEY
U+26C0 ⛀ WHITE DRAUGHTSMAN
U+26C1 ⛁ WHITE DRAUGHTS KING
U+26C2 ⛂ BLACK DRAUGHTSMAN
U+26C3 ⛃ BLACK DRAUGHTS KING
U+26C4 ⛄ SNOWMAN WITHOUT SNOW
U+26C5 ⛅ SUN BEHIND CLOUD
U+26C6 ⛆ RAIN
U+26C7 ⛇ BLACK SNOWMAN
U+26C8 ⛈ THUNDER CLOUD AND RAIN
U+26C9 ⛉ TURNED WHITE SHOGI PIECE
U+26CA ⛊ TURNED BLACK SHOGI PIECE
U+26CB ⛋ WHITE DIAMOND IN SQUARE
U+26CC ⛌ CROSSING LANES
U+26CD ⛍ DISABLED CAR
U+26CE ⛎ OPHIUCHUS
U+26CF ⛏ PICK
U+26D0 ⛐ CAR SLIDING
U+26D1 ⛑ HELMET WITH WHITE CROSS
U+26D2 ⛒ CIRCLED CROSSING LANES
U+26D3 ⛓ CHAINS
U+26D4 ⛔ NO ENTRY
U+26D5 ⛕ ALTERNATE ONE-WAY LEFT WAY TRAFFIC
U+26D6 ⛖ BLACK TWO-WAY LEFT WAY TRAFFIC
U+26D7 ⛗ WHITE TWO-WAY LEFT WAY TRAFFIC
U+26D8 ⛘ BLACK LEFT LANE MERGE
U+26D9 ⛙ WHITE LEFT LANE MERGE
U+26DA ⛚ DRIVE SLOW SIGN
U+26DB ⛛ HEAVY WHITE DOWN-POINTING TRIANGLE
U+26DC ⛜ LEFT CLOSED ENTRY
U+26DD ⛝ SQUARED SALTIRE
U+26DE ⛞ FALLING DIAGONAL IN WHITE CIRCLE IN BLACK SQUARE
U+26DF ⛟ BLACK TRUCK
U+26E0 ⛠ RESTRICTED LEFT ENTRY-1
U+26E1 ⛡ RESTRICTED LEFT ENTRY-2
U+26E2 ⛢ ASTRONOMICAL SYMBOL FOR URANUS
U+26E3 ⛣ HEAVY CIRCLE WITH STROKE AND TWO DOTS ABOVE
U+26E4 ⛤ PENTAGRAM
U+26E5 ⛥ RIGHT-HANDED INTERLACED PENTAGRAM
U+26E6 ⛦ LEFT-HANDED INTERLACED PENTAGRAM
U+26E7 ⛧ INVERTED PENTAGRAM
U+26E8 ⛨ BLACK CROSS ON SHIELD
U+26E9 ⛩ SHINTO SHRINE
U+26EA ⛪ CHURCH
U+26EB ⛫ CASTLE
U+26EC ⛬ HISTORIC SITE
U+26ED ⛭ GEAR WITHOUT HUB
U+26EE ⛮ GEAR WITH HANDLES
U+26EF ⛯ MAP SYMBOL FOR LIGHTHOUSE
U+26F0 ⛰ MOUNTAIN
U+26F1 ⛱ UMBRELLA ON GROUND
U+26F2 ⛲ FOUNTAIN
U+26F3 ⛳ FLAG IN HOLE
U+26F4 ⛴ FERRY
U+26F5 ⛵ SAILBOAT
U+26F6 ⛶ SQUARE FOUR CORNERS
U+26F7 ⛷ SKIER
U+26F8 ⛸ ICE SKATE
U+26F9 ⛹ PERSON WITH BALL
U+26FA ⛺ TENT
U+26FD ⛽ FUEL PUMP
U+26FE ⛾ CUP ON BLACK SQUARE
U+26FF ⛿ WHITE FLAG WITH HORIZONTAL MIDDLE BLACK STRIPE
U+2701 ✁ UPPER BLADE SCISSORS
U+2702 ✂ BLACK SCISSORS
U+2703 ✃ LOWER BLADE SCISSORS
U+2704 ✄ WHITE SCISSORS
U+2705 ✅ WHITE HEAVY CHECK MARK
U+2706 ✆ TELEPHONE LOCATION SIGN
U+2707 ✇ TAPE DRIVE
U+2708 ✈ AIRPLANE
U+2709 ✉ ENVELOPE
U+270A ✊ RAISED FIST
U+270B ✋ RAISED HAND
U+270C ✌ VICTORY HAND
U+270D ✍ WRITING HAND
U+270E ✎ LOWER RIGHT PENCIL
U+270F ✏ PENCIL
U+2710 ✐ UPPER RIGHT PENCIL
U+2711 ✑ WHITE NIB
U+2712 ✒ BLACK NIB
U+2713 ✓ CHECK MARK
U+2714 ✔ HEAVY CHECK MARK
U+2715 ✕ MULTIPLICATION X
U+2716 ✖ HEAVY MULTIPLICATION X
U+2717 ✗ BALLOT X
U+2718 ✘ HEAVY BALLOT X
U+2719 ✙ OUTLINED GREEK CROSS
U+271A ✚ HEAVY GREEK CROSS
U+271B ✛ OPEN CENTRE CROSS
U+271C ✜ HEAVY OPEN CENTRE CROSS
U+271D ✝ LATIN CROSS
U+271E ✞ SHADOWED WHITE LATIN CROSS
U+271F ✟ OUTLINED LATIN CROSS
U+2720 ✠ MALTESE CROSS
U+2721 ✡ STAR OF DAVID
U+2722 ✢ FOUR TEARDROP-SPOKED ASTERISK
U+2723 ✣ FOUR BALLOON-SPOKED ASTERISK
U+2724 ✤ HEAVY FOUR BALLOON-SPOKED ASTERISK
U+2725 ✥ FOUR CLUB-SPOKED ASTERISK
U+2726 ✦ BLACK FOUR POINTED STAR
U+2727 ✧ WHITE FOUR POINTED STAR
U+2728 ✨ SPARKLES
U+2729 ✩ STRESS OUTLINED WHITE STAR
U+272A ✪ CIRCLED WHITE STAR
U+272B ✫ OPEN CENTRE BLACK STAR
U+272C ✬ BLACK CENTRE WHITE STAR
U+272D ✭ OUTLINED BLACK STAR
U+272E ✮ HEAVY OUTLINED BLACK STAR
U+272F ✯ PINWHEEL STAR
U+2730 ✰ SHADOWED WHITE STAR
U+2731 ✱ HEAVY ASTERISK
U+2732 ✲ OPEN CENTRE ASTERISK
U+2733 ✳ EIGHT SPOKED ASTERISK
U+2734 ✴ EIGHT POINTED BLACK STAR
U+2735 ✵ EIGHT POINTED PINWHEEL STAR
U+2736 ✶ SIX POINTED BLACK STAR
U+2737 ✷ EIGHT POINTED RECTILINEAR BLACK STAR
U+2738 ✸ HEAVY EIGHT POINTED RECTILINEAR BLACK STAR
U+2739 ✹ TWELVE POINTED BLACK STAR
U+273A ✺ SIXTEEN POINTED ASTERISK
U+273B ✻ TEARDROP-SPOKED ASTERISK
U+273C ✼ OPEN CENTRE TEARDROP-SPOKED ASTERISK
U+273D ✽ HEAVY TEARDROP-SPOKED ASTERISK
U+273E ✾ SIX PETALLED BLACK AND WHITE FLORETTE
U+273F ✿ BLACK FLORETTE
U+2740 ❀ WHITE FLORETTE
U+2741 ❁ EIGHT PETALLED OUTLINED BLACK FLORETTE
U+2742 ❂ CIRCLED OPEN CENTRE EIGHT POINTED STAR
U+2743 ❃ HEAVY TEARDROP-SPOKED PINWHEEL ASTERISK
U+2744 ❄ SNOWFLAKE
U+2745 ❅ TIGHT TRIFOLIATE SNOWFLAKE
U+2746 ❆ HEAVY CHEVRON SNOWFLAKE
U+2747 ❇ SPARKLE
U+2748 ❈ HEAVY SPARKLE
U+2749 ❉ BALLOON-SPOKED ASTERISK
U+274A ❊ EIGHT TEARDROP-SPOKED PROPELLER ASTERISK
U+274B ❋ HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK
U+274C ❌ CROSS MARK
U+274D ❍ SHADOWED WHITE CIRCLE
U+274E ❎ NEGATIVE SQUARED CROSS MARK
U+2753 ❓ BLACK QUESTION MARK ORNAMENT
U+2754 ❔ WHITE QUESTION MARK ORNAMENT
U+2755 ❕ WHITE EXCLAMATION MARK ORNAMENT
U+2756 ❖ BLACK DIAMOND MINUS WHITE X
U+2757 ❗ HEAVY EXCLAMATION MARK SYMBOL
U+275B ❛ HEAVY SINGLE TURNED COMMA QUOTATION MARK ORNAMENT
U+275C ❜ HEAVY SINGLE COMMA QUOTATION MARK ORNAMENT
U+275D ❝ HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT
U+275E ❞ HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT
U+275F ❟ HEAVY LOW SINGLE COMMA QUOTATION MARK ORNAMENT
U+2760 ❠ HEAVY LOW DOUBLE COMMA QUOTATION MARK ORNAMENT
U+2761 ❡ CURVED STEM PARAGRAPH SIGN ORNAMENT
U+2762 ❢ HEAVY EXCLAMATION MARK ORNAMENT
U+2763 ❣ HEAVY HEART EXCLAMATION MARK ORNAMENT
U+2764 ❤ HEAVY BLACK HEART
U+2765 ❥ ROTATED HEAVY BLACK HEART BULLET
U+2766 ❦ FLORAL HEART
U+2767 ❧ ROTATED FLORAL HEART BULLET
U+276C ❬ MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT
U+276D ❭ MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT
U+276E ❮ HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT
U+276F ❯ HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT
U+2770 ❰ HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT
U+2771 ❱ HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT
U+2794 ➔ HEAVY WIDE-HEADED RIGHTWARDS ARROW
U+2795 ➕ HEAVY PLUS SIGN
U+2796 ➖ HEAVY MINUS SIGN
U+2797 ➗ HEAVY DIVISION SIGN
U+2798 ➘ HEAVY SOUTH EAST ARROW
U+2799 ➙ HEAVY RIGHTWARDS ARROW
U+279A ➚ HEAVY NORTH EAST ARROW
U+279B ➛ DRAFTING POINT RIGHTWARDS ARROW
U+279C ➜ HEAVY ROUND-TIPPED RIGHTWARDS ARROW
U+279D ➝ TRIANGLE-HEADED RIGHTWARDS ARROW
U+279E ➞ HEAVY TRIANGLE-HEADED RIGHTWARDS ARROW
U+279F ➟ DASHED TRIANGLE-HEADED RIGHTWARDS ARROW
U+27A0 ➠ HEAVY DASHED TRIANGLE-HEADED RIGHTWARDS ARROW
U+27A1 ➡ BLACK RIGHTWARDS ARROW
U+27A2 ➢ THREE-D TOP-LIGHTED RIGHTWARDS ARROWHEAD
U+27A3 ➣ THREE-D BOTTOM-LIGHTED RIGHTWARDS ARROWHEAD
U+27A4 ➤ BLACK RIGHTWARDS ARROWHEAD
U+27A5 ➥ HEAVY BLACK CURVED DOWNWARDS AND RIGHTWARDS ARROW
U+27A6 ➦ HEAVY BLACK CURVED UPWARDS AND RIGHTWARDS ARROW
U+27A7 ➧ SQUAT BLACK RIGHTWARDS ARROW
U+27A8 ➨ HEAVY CONCAVE-POINTED BLACK RIGHTWARDS ARROW
U+27A9 ➩ RIGHT-SHADED WHITE RIGHTWARDS ARROW
U+27AA ➪ LEFT-SHADED WHITE RIGHTWARDS ARROW
U+27AB ➫ BACK-TILTED SHADOWED WHITE RIGHTWARDS ARROW
U+27AC ➬ FRONT-TILTED SHADOWED WHITE RIGHTWARDS ARROW
U+27AD ➭ HEAVY LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW
U+27AE ➮ HEAVY UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW
U+27AF ➯ NOTCHED LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW
U+27B0 ➰ CURLY LOOP
U+27B1 ➱ NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW
U+27B2 ➲ CIRCLED HEAVY WHITE RIGHTWARDS ARROW
U+27B3 ➳ WHITE-FEATHERED RIGHTWARDS ARROW
U+27B4 ➴ BLACK-FEATHERED SOUTH EAST ARROW
U+27B5 ➵ BLACK-FEATHERED RIGHTWARDS ARROW
U+27B6 ➶ BLACK-FEATHERED NORTH EAST ARROW
U+27B7 ➷ HEAVY BLACK-FEATHERED SOUTH EAST ARROW
U+27B8 ➸ HEAVY BLACK-FEATHERED RIGHTWARDS ARROW
U+27B9 ➹ HEAVY BLACK-FEATHERED NORTH EAST ARROW
U+27BA ➺ TEARDROP-BARBED RIGHTWARDS ARROW
U+27BB ➻ HEAVY TEARDROP-SHANKED RIGHTWARDS ARROW
U+27BC ➼ WEDGE-TAILED RIGHTWARDS ARROW
U+27BD ➽ HEAVY WEDGE-TAILED RIGHTWARDS ARROW
U+27BE ➾ OPEN-OUTLINED RIGHTWARDS ARROW
U+27C0 ⟀ THREE DIMENSIONAL ANGLE
U+27E8 ⟨ MATHEMATICAL LEFT ANGLE BRACKET
U+27E9 ⟩ MATHEMATICAL RIGHT ANGLE BRACKET
U+27EA ⟪ MATHEMATICAL LEFT DOUBLE ANGLE BRACKET
U+27EB ⟫ MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET
U+27F0 ⟰ UPWARDS QUADRUPLE ARROW
U+27F1 ⟱ DOWNWARDS QUADRUPLE ARROW
U+27F2 ⟲ ANTICLOCKWISE GAPPED CIRCLE ARROW
U+27F3 ⟳ CLOCKWISE GAPPED CIRCLE ARROW
U+27F4 ⟴ RIGHT ARROW WITH CIRCLED PLUS
U+27F5 ⟵ LONG LEFTWARDS ARROW
U+27F6 ⟶ LONG RIGHTWARDS ARROW
U+27F7 ⟷ LONG LEFT RIGHT ARROW
U+27F8 ⟸ LONG LEFTWARDS DOUBLE ARROW
U+27F9 ⟹ LONG RIGHTWARDS DOUBLE ARROW
U+27FA ⟺ LONG LEFT RIGHT DOUBLE ARROW
U+27FB ⟻ LONG LEFTWARDS ARROW FROM BAR
U+27FC ⟼ LONG RIGHTWARDS ARROW FROM BAR
U+27FD ⟽ LONG LEFTWARDS DOUBLE ARROW FROM BAR
U+27FE ⟾ LONG RIGHTWARDS DOUBLE ARROW FROM BAR
U+27FF ⟿ LONG RIGHTWARDS SQUIGGLE ARROW
U+2900 ⤀ RIGHTWARDS TWO-HEADED ARROW WITH VERTICAL STROKE
U+2901 ⤁ RIGHTWARDS TWO-HEADED ARROW WITH DOUBLE VERTICAL STROKE
U+2902 ⤂ LEFTWARDS DOUBLE ARROW WITH VERTICAL STROKE
U+2903 ⤃ RIGHTWARDS DOUBLE ARROW WITH VERTICAL STROKE
U+2904 ⤄ LEFT RIGHT DOUBLE ARROW WITH VERTICAL STROKE
U+2905 ⤅ RIGHTWARDS TWO-HEADED ARROW FROM BAR
U+2906 ⤆ LEFTWARDS DOUBLE ARROW FROM BAR
U+2907 ⤇ RIGHTWARDS DOUBLE ARROW FROM BAR
U+2908 ⤈ DOWNWARDS ARROW WITH HORIZONTAL STROKE
U+2909 ⤉ UPWARDS ARROW WITH HORIZONTAL STROKE
U+290A ⤊ UPWARDS TRIPLE ARROW
U+290B ⤋ DOWNWARDS TRIPLE ARROW
U+290C ⤌ LEFTWARDS DOUBLE DASH ARROW
U+290D ⤍ RIGHTWARDS DOUBLE DASH ARROW
U+290E ⤎ LEFTWARDS TRIPLE DASH ARROW
U+290F ⤏ RIGHTWARDS TRIPLE DASH ARROW
U+2910 ⤐ RIGHTWARDS TWO-HEADED TRIPLE DASH ARROW
U+2911 ⤑ RIGHTWARDS ARROW WITH DOTTED STEM
U+2912 ⤒ UPWARDS ARROW TO BAR
U+2913 ⤓ DOWNWARDS ARROW TO BAR
U+2914 ⤔ RIGHTWARDS ARROW WITH TAIL WITH VERTICAL STROKE
U+2915 ⤕ RIGHTWARDS ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE
U+2916 ⤖ RIGHTWARDS TWO-HEADED ARROW WITH TAIL
U+2917 ⤗ RIGHTWARDS TWO-HEADED ARROW WITH TAIL WITH VERTICAL STROKE
U+2918 ⤘ RIGHTWARDS TWO-HEADED ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE
U+2919 ⤙ LEFTWARDS ARROW-TAIL
U+291A ⤚ RIGHTWARDS ARROW-TAIL
U+291B ⤛ LEFTWARDS DOUBLE ARROW-TAIL
U+291C ⤜ RIGHTWARDS DOUBLE ARROW-TAIL
U+291D ⤝ LEFTWARDS ARROW TO BLACK DIAMOND
U+291E ⤞ RIGHTWARDS ARROW TO BLACK DIAMOND
U+291F ⤟ LEFTWARDS ARROW FROM BAR TO BLACK DIAMOND
U+2920 ⤠ RIGHTWARDS ARROW FROM BAR TO BLACK DIAMOND
U+2921 ⤡ NORTHWEST AND SOUTH EAST ARROW
U+2922 ⤢ NORTHEAST AND SOUTH WEST ARROW
U+2923 ⤣ NORTH WEST ARROW WITH HOOK
U+2924 ⤤ NORTH EAST ARROW WITH HOOK
U+2925 ⤥ SOUTH EAST ARROW WITH HOOK
U+2926 ⤦ SOUTH WEST ARROW WITH HOOK
U+2927 ⤧ NORTH WEST ARROW AND NORTH EAST ARROW
U+2928 ⤨ NORTH EAST ARROW AND SOUTH EAST ARROW
U+2929 ⤩ SOUTH EAST ARROW AND SOUTH WEST ARROW
U+292A ⤪ SOUTH WEST ARROW AND NORTH WEST ARROW
U+292B ⤫ RISING DIAGONAL CROSSING FALLING DIAGONAL
U+292C ⤬ FALLING DIAGONAL CROSSING RISING DIAGONAL
U+292D ⤭ SOUTH EAST ARROW CROSSING NORTH EAST ARROW
U+292E ⤮ NORTH EAST ARROW CROSSING SOUTH EAST ARROW
U+292F ⤯ FALLING DIAGONAL CROSSING NORTH EAST ARROW
U+2930 ⤰ RISING DIAGONAL CROSSING SOUTH EAST ARROW
U+2931 ⤱ NORTH EAST ARROW CROSSING NORTH WEST ARROW
U+2932 ⤲ NORTH WEST ARROW CROSSING NORTH EAST ARROW
U+2933 ⤳ WAVE ARROW POINTING DIRECTLY RIGHT
U+2934 ⤴ ARROW POINTING RIGHTWARDS THEN CURVING UPWARDS
U+2935 ⤵ ARROW POINTING RIGHTWARDS THEN CURVING DOWNWARDS
U+2936 ⤶ ARROW POINTING DOWNWARDS THEN CURVING LEFTWARDS
U+2937 ⤷ ARROW POINTING DOWNWARDS THEN CURVING RIGHTWARDS
U+2938 ⤸ RIGHT-SIDE ARC CLOCKWISE ARROW
U+2939 ⤹ LEFT-SIDE ARC ANTICLOCKWISE ARROW
U+293A ⤺ TOP ARC ANTICLOCKWISE ARROW
U+293B ⤻ BOTTOM ARC ANTICLOCKWISE ARROW
U+293C ⤼ TOP ARC CLOCKWISE ARROW WITH MINUS
U+293D ⤽ TOP ARC ANTICLOCKWISE ARROW WITH PLUS
U+293E ⤾ LOWER RIGHT SEMICIRCULAR CLOCKWISE ARROW
U+293F ⤿ LOWER LEFT SEMICIRCULAR ANTICLOCKWISE ARROW
U+2940 ⥀ ANTICLOCKWISE CLOSED CIRCLE ARROW
U+2941 ⥁ CLOCKWISE CLOSED CIRCLE ARROW
U+2942 ⥂ RIGHTWARDS ARROW ABOVE SHORT LEFTWARDS ARROW
U+2943 ⥃ LEFTWARDS ARROW ABOVE SHORT RIGHTWARDS ARROW
U+2944 ⥄ SHORT RIGHTWARDS ARROW ABOVE LEFTWARDS ARROW
U+2945 ⥅ RIGHTWARDS ARROW WITH PLUS BELOW
U+2946 ⥆ LEFTWARDS ARROW WITH PLUS BELOW
U+2962 ⥢ LEFTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB DOWN
U+2963 ⥣ UPWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT
U+2964 ⥤ RIGHTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB DOWN
U+2965 ⥥ DOWNWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT
U+2966 ⥦ LEFTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB UP
U+2967 ⥧ LEFTWARDS HARPOON WITH BARB DOWN ABOVE RIGHTWARDS HARPOON WITH BARB DOWN
U+2968 ⥨ RIGHTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB UP
U+2969 ⥩ RIGHTWARDS HARPOON WITH BARB DOWN ABOVE LEFTWARDS HARPOON WITH BARB DOWN
U+296A ⥪ LEFTWARDS HARPOON WITH BARB UP ABOVE LONG DASH
U+296B ⥫ LEFTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH
U+296C ⥬ RIGHTWARDS HARPOON WITH BARB UP ABOVE LONG DASH
U+296D ⥭ RIGHTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH
U+296E ⥮ UPWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT
U+296F ⥯ DOWNWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT
U+2989 ⦉ Z NOTATION LEFT BINDING BRACKET
U+298A ⦊ Z NOTATION RIGHT BINDING BRACKET
U+2991 ⦑ LEFT ANGLE BRACKET WITH DOT
U+2992 ⦒ RIGHT ANGLE BRACKET WITH DOT
U+2993 ⦓ LEFT ARC LESS-THAN BRACKET
U+2994 ⦔ RIGHT ARC GREATER-THAN BRACKET
U+2995 ⦕ DOUBLE LEFT ARC GREATER-THAN BRACKET
U+2996 ⦖ DOUBLE RIGHT ARC LESS-THAN BRACKET
U+29A8 ⦨ MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT
U+29A9 ⦩ MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND LEFT
U+29AA ⦪ MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT
U+29AB ⦫ MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND LEFT
U+29AC ⦬ MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND UP
U+29AD ⦭ MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND UP
U+29AE ⦮ MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND DOWN
U+29AF ⦯ MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND DOWN
U+29BE ⦾ CIRCLED WHITE BULLET
U+29BF ⦿ CIRCLED BULLET
U+29C9 ⧉ TWO JOINED SQUARES
U+29CE ⧎ RIGHT TRIANGLE ABOVE LEFT TRIANGLE
U+29CF ⧏ LEFT TRIANGLE BESIDE VERTICAL BAR
U+29D0 ⧐ VERTICAL BAR BESIDE RIGHT TRIANGLE
U+29D1 ⧑ BOWTIE WITH LEFT HALF BLACK
U+29D2 ⧒ BOWTIE WITH RIGHT HALF BLACK
U+29D3 ⧓ BLACK BOWTIE
U+29D4 ⧔ TIMES WITH LEFT HALF BLACK
U+29D5 ⧕ TIMES WITH RIGHT HALF BLACK
U+29D6 ⧖ WHITE HOURGLASS
U+29D7 ⧗ BLACK HOURGLASS
U+29E8 ⧨ DOWN-POINTING TRIANGLE WITH LEFT HALF BLACK
U+29E9 ⧩ DOWN-POINTING TRIANGLE WITH RIGHT HALF BLACK
U+29EA ⧪ BLACK DIAMOND WITH DOWN ARROW
U+29EB ⧫ BLACK LOZENGE
U+29EC ⧬ WHITE CIRCLE WITH DOWN ARROW
U+29ED ⧭ BLACK CIRCLE WITH DOWN ARROW
U+29F4 ⧴ RULE-DELAYED
U+29FC ⧼ LEFT-POINTING CURVED ANGLE BRACKET
U+29FD ⧽ RIGHT-POINTING CURVED ANGLE BRACKET
U+29FE ⧾ TINY
U+29FF ⧿ MINY
U+2B00 ⬀ NORTH EAST WHITE ARROW
U+2B01 ⬁ NORTH WEST WHITE ARROW
U+2B02 ⬂ SOUTH EAST WHITE ARROW
U+2B03 ⬃ SOUTH WEST WHITE ARROW
U+2B04 ⬄ LEFT RIGHT WHITE ARROW
U+2B05 ⬅ LEFTWARDS BLACK ARROW
U+2B06 ⬆ UPWARDS BLACK ARROW
U+2B07 ⬇ DOWNWARDS BLACK ARROW
U+2B08 ⬈ NORTH EAST BLACK ARROW
U+2B09 ⬉ NORTH WEST BLACK ARROW
U+2B0A ⬊ SOUTH EAST BLACK ARROW
U+2B0B ⬋ SOUTHWEST BLACK ARROW
U+2B0C ⬌ LEFT RIGHT BLACK ARROW
U+2B0D ⬍ UP DOWN BLACK ARROW
U+2B0E ⬎ RIGHTWARDS ARROW WITH TIP DOWNWARDS
U+2B0F ⬏ RIGHTWARDS ARROW WITH TIP UPWARDS
U+2B10 ⬐ LEFTWARDS ARROW WITH TIP DOWNWARDS
U+2B11 ⬑ LEFTWARDS ARROW WITH TIP UPWARDS
U+2B12 ⬒ SQUARE WITH TOP HALF BLACK
U+2B13 ⬓ SQUARE WITH BOTTOM HALF BLACK
U+2B14 ⬔ SQUARE WITH UPPER RIGHT DIAGONAL HALF BLACK
U+2B15 ⬕ SQUARE WITH LOWER LEFT DIAGONAL HALF BLACK
U+2B16 ⬖ DIAMOND WITH LEFT HALF BLACK
U+2B17 ⬗ DIAMOND WITH RIGHT HALF BLACK
U+2B18 ⬘ DIAMOND WITH TOP HALF BLACK
U+2B19 ⬙ DIAMOND WITH BOTTOM HALF BLACK
U+2B1A ⬚ DOTTED SQUARE
U+2B1B ⬛ BLACK LARGE SQUARE
U+2B1C ⬜ WHITE LARGE SQUARE
U+2B1D ⬝ BLACK VERY SMALL SQUARE
U+2B1E ⬞ WHITE VERY SMALL SQUARE
U+2B1F ⬟ BLACK PENTAGON
U+2B20 ⬠ WHITE PENTAGON
U+2B21 ⬡ WHITE HEXAGON
U+2B22 ⬢ BLACK HEXAGON
U+2B23 ⬣ HORIZONTAL BLACK HEXAGON
U+2B24 ⬤ BLACK LARGE CIRCLE
U+2B25 ⬥ BLACK MEDIUM DIAMOND
U+2B26 ⬦ WHITE MEDIUM DIAMOND
U+2B27 ⬧ BLACK MEDIUM LOZENGE
U+2B28 ⬨ WHITE MEDIUM LOZENGE
U+2B29 ⬩ BLACK SMALL DIAMOND
U+2B2A ⬪ BLACK SMALL LOZENGE
U+2B2B ⬫ WHITE SMALL LOZENGE
U+2B30 ⬰ LEFT ARROW WITH SMALL CIRCLE
U+2B31 ⬱ THREE LEFTWARDS ARROWS
U+2B32 ⬲ LEFT ARROW WITH CIRCLED PLUS
U+2B33 ⬳ LONG LEFTWARDS SQUIGGLE ARROW
U+2B34 ⬴ LEFTWARDS TWO-HEADED ARROW WITH VERTICAL STROKE
U+2B35 ⬵ LEFTWARDS TWO-HEADED ARROW WITH DOUBLE VERTICAL STROKE
U+2B36 ⬶ LEFTWARDS TWO-HEADED ARROW FROM BAR
U+2B37 ⬷ LEFTWARDS TWO-HEADED TRIPLE DASH ARROW
U+2B38 ⬸ LEFTWARDS ARROW WITH DOTTED STEM
U+2B39 ⬹ LEFTWARDS ARROW WITH TAIL WITH VERTICAL STROKE
U+2B3A ⬺ LEFTWARDS ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE
U+2B3B ⬻ LEFTWARDS TWO-HEADED ARROW WITH TAIL
U+2B3C ⬼ LEFTWARDS TWO-HEADED ARROW WITH TAIL WITH VERTICAL STROKE
U+2B3D ⬽ LEFTWARDS TWO-HEADED ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE
U+2B3E ⬾ LEFTWARDS ARROW THROUGH X
U+2B3F ⬿ WAVE ARROW POINTING DIRECTLY LEFT
U+2B40 ⭀ EQUALS SIGN ABOVE LEFTWARDS ARROW
U+2B41 ⭁ REVERSE TILDE OPERATOR ABOVE LEFTWARDS ARROW
U+2B42 ⭂ LEFTWARDS ARROW ABOVE REVERSE ALMOST EQUAL TO
U+2B43 ⭃ RIGHTWARDS ARROW THROUGH GREATER-THAN
U+2B44 ⭄ RIGHTWARDS ARROW THROUGH SUPERSET
U+2B45 ⭅ LEFTWARDS QUADRUPLE ARROW
U+2B46 ⭆ RIGHTWARDS QUADRUPLE ARROW
U+2B47 ⭇ REVERSE TILDE OPERATOR ABOVE RIGHTWARDS ARROW
U+2B48 ⭈ RIGHTWARDS ARROW ABOVE REVERSE ALMOST EQUAL TO
U+2B49 ⭉ TILDE OPERATOR ABOVE LEFTWARDS ARROW
U+2B4A ⭊ LEFTWARDS ARROW ABOVE ALMOST EQUAL TO
U+2B4B ⭋ LEFTWARDS ARROW ABOVE REVERSE TILDE OPERATOR
U+2B4C ⭌ RIGHTWARDS ARROW ABOVE REVERSE TILDE OPERATOR
U+2B50 ⭐ WHITE MEDIUM STAR
U+2B51 ⭑ BLACK SMALL STAR
U+2B52 ⭒ WHITE SMALL STAR
U+2B53 ⭓ BLACK RIGHT-POINTING PENTAGON
U+2B54 ⭔ WHITE RIGHT-POINTING PENTAGON
U+2B55 ⭕ HEAVY LARGE CIRCLE
U+2B56 ⭖ HEAVY OVAL WITH OVAL INSIDE
U+2B57 ⭗ HEAVY CIRCLE WITH CIRCLE INSIDE
U+2B58 ⭘ HEAVY CIRCLE
U+2B59 ⭙ HEAVY CIRCLED SALTIRE
OPTION 2: PURE CSS CHEVRONS
You can create the chevrons efficiently using only CSS
(No images required).
It's easy to manipulate:
*
*ROTATION
*THICKNESS
*COLOR
*SIZE
CLICK FOR DEMO ON JSFIDDLE
CSS
(Efficient with cross browser support)
.chevron {
position: relative;
display: block;
height: 50px; /*height should be double border*/
}
.chevron::before,
.chevron::after {
position: absolute;
display: block;
content: "";
border: 25px solid transparent; /*adjust size*/
}
/* Replace all text `top` below with left/right/bottom to rotate the chevron */
.chevron::before {
top: 0;
border-top-color: #b00; /*Chevron Color*/
}
.chevron::after {
top: -10px; /*adjust thickness*/
border-top-color: #fff; /*Match background colour*/
}
<i class="chevron"></i>
OPTION 3: CSS BASE64 IMAGE ICONS
UP/DOWN
DOWN
UP
Using only a few lines of CSS we can encode our images into base64.
CLICK FOR DEMO ON JSFIDDLE
PROS
*
*No need to include additional resources in the form of images or fonts.
*Supports full alpha transparency.
*Full cross-browser support.
*Small images/icons can be stored in a database.
CONS
*
*Updating/editing can become a hassle.
*Not suitable for large images due to excessive code markup that's generated.
CSS
.sorting,
.sorting_asc,
.sorting_desc{
padding:4px 21px 4px 4px;
cursor:pointer;
}
.sorting{
background:url(data:image/gif;base64,R0lGODlhCwALAJEAAAAAAP///xUVFf///yH5BAEAAAMALAAAAAALAAsAAAIUnC2nKLnT4or00PvyrQwrPzUZshQAOw==) no-repeat center right;
}
.sorting_asc{
background:url(data:image/gif;base64,R0lGODlhCwALAJEAAAAAAP///xUVFf///yH5BAEAAAMALAAAAAALAAsAAAIRnC2nKLnT4or00Puy3rx7VQAAOw==) no-repeat center right;
}
.sorting_desc{
background:url(data:image/gif;base64,R0lGODlhCwALAJEAAAAAAP///xUVFf///yH5BAEAAAMALAAAAAALAAsAAAIPnI+py+0/hJzz0IruwjsVADs=) no-repeat center right;
}
A: This one seems to imply that 030 and 031 are up and down triangles.
(As bobince pointed out, this doesn't seem to be an ASCII standard)
A: I use ▼ and ▲, but they might not work for you. I use alt 11551 for the first one and 11550 for the second one. You can always copy paste them if the ascii isnt the same for your system.
A: Sorry but they are only in Unicode. :(
Big ones:
*
*U+25B2 (Black up-pointing triangle ▲)
*U+25BC (Black down-pointing triangle ▼)
*U+25C0 (Black left-pointing triangle ◀)
*U+25B6 (Black right-pointing triangle ▶)
Big white ones:
*
*U+25B3 (White up-pointing triangle △)
*U+25BD (White down-pointing triangle ▽)
*U+25C1 (White left-pointing triangle ◁)
*U+25B7 (White right-pointing triangle ▷)
There is also some smalller triangles:
*
*U+25B4 (Black up-pointing small triangle ▴)
*U+25C2 (Black left-pointing small triangle ◂)
*U+25BE (Black down-pointing small triangle ▾)
*U+25B8 (Black right-pointing small triangle ▸)
Also some white ones:
*
*U+25C3 (White left-pointing small triangle ◃)
*U+25BF (White down-pointing small triangle ▿)
*U+25B9 (White right-pointing small triangle ▹)
*U+25B5 (White up-pointing small triangle ▵)
There are also some "pointy" triangles. You can read more here in Wikipedia:http://en.wikipedia.org/wiki/Geometric_Shapes
But unfortunately, they are all Unicode instead of ASCII.
If you still want to use ASCII, then you can use an image file for it of just use ^ and v. (Just like the Google Maps in the mobile version this was referring to the ancient mobile Google Maps)
As others also suggested, you can also create triangles with HTML, either with CSS borders or SVG shapes or even JavaScript canvases.
CSS
div{
width: 0px;
height: 0px;
border-top: 10px solid black;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: none;
}
SVG
<svg width="16" height="10">
<polygon points="0,0 16,0 8,10"/>
</svg>
JavaScript
var ctx = document.querySelector("canvas").getContext("2d");
// do not use with() outside of this demo!
with(ctx){
beginPath();
moveTo(0,0);
lineTo(16,0);
lineTo(8,10);
fill();
endPath();
}
Demo
A: There are several correct ways to display a down-pointing triangle.
Method 1 : use decimal HTML entity
HTML :
▼
Method 2 : use hexidecimal HTML entity
HTML :
▼
Method 3 : use character directly
HTML :
▼
Method 4 : use CSS
HTML :
<span class='icon-down'></span>
CSS :
.icon-down:before {
content: "\25BC";
}
Each of these three methods should have the same output. For other symbols, the same three options exist. Some even have a fourth option, allowing you to use a string based reference (eg. ♥ to display ♥).
You can use a reference website like Unicode-table.com to find which icons are supported in UNICODE and which codes they correspond with. For example, you find the values for the down-pointing triangle at http://unicode-table.com/en/25BC/.
Note that these methods are sufficient only for icons that are available by default in every browser. For symbols like ☃,❄,★,☂,☭,⎗ or ⎘, this is far less likely to be the case. While it is possible to provide cross-browser support for other UNICODE symbols, the procedure is a bit more complicated.
If you want to know how to add support for less common UNICODE characters, see Create webfont with Unicode Supplementary Multilingual Plane symbols for more info on how to do this.
Background images
A totally different strategy is the use of background-images instead of fonts. For optimal performance, it's best to embed the image in your CSS file by base-encoding it, as mentioned by eg. @weasel5i2 and @Obsidian. I would recommend the use of SVG rather than GIF, however, is that's better both for performance and for the sharpness of your symbols.
This following code is the base64 for and SVG version of the icon :
/* size: 0.9kb */
url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMTYiIGhlaWdodD0iMjgiIHZpZXdCb3g9IjAgMCAxNiAyOCI+PGcgaWQ9Imljb21vb24taWdub3JlIj48L2c+PHBhdGggZD0iTTE2IDE3cTAgMC40MDYtMC4yOTcgMC43MDNsLTcgN3EtMC4yOTcgMC4yOTctMC43MDMgMC4yOTd0LTAuNzAzLTAuMjk3bC03LTdxLTAuMjk3LTAuMjk3LTAuMjk3LTAuNzAzdDAuMjk3LTAuNzAzIDAuNzAzLTAuMjk3aDE0cTAuNDA2IDAgMC43MDMgMC4yOTd0MC4yOTcgMC43MDN6TTE2IDExcTAgMC40MDYtMC4yOTcgMC43MDN0LTAuNzAzIDAuMjk3aC0xNHEtMC40MDYgMC0wLjcwMy0wLjI5N3QtMC4yOTctMC43MDMgMC4yOTctMC43MDNsNy03cTAuMjk3LTAuMjk3IDAuNzAzLTAuMjk3dDAuNzAzIDAuMjk3bDcgN3EwLjI5NyAwLjI5NyAwLjI5NyAwLjcwM3oiIGZpbGw9IiMwMDAwMDAiPjwvcGF0aD48L3N2Zz4=
When to use background-images or fonts
For many use cases, SVG-based background images and icon fonts are largely equivalent with regards to performance and flexibility. To decide which to pick, consider the following differences:
SVG images
*
*They can have multiple colors
*They can embed their own CSS and/or be styled by the HTML document
*They can be loaded as a seperate file, embedded in CSS AND embedded in HTML
*Each symbol is represented by XML code or base64 code. You cannot use the character directly within your code editor or use an HTML entity
*Multiple uses of the same symbol implies duplication of the symbol when XML code is embedded in the HTML. Duplication is not required when embedding the file in the CSS or loading it as a seperate file
*You can not use color, font-size, line-height, background-color or other font related styling rules to change the display of your icon, but you can reference different components of the icon as shapes individually.
*You need some knowledge of SVG and/or base64 encoding
*Limited or no support in old versions of IE
Icon fonts
*
*An icon can have but one fill color, one background color, etc.
*An icon can be embedded in CSS or HTML. In HTML, you can use the character directly or use an HTML entity to represent it.
*Some symbols can be displayed without the use of a webfont. Most symbols cannot.
*Multiple uses of the same symbol implies duplication of the symbol when your character embedded in the HTML. Duplication is not required when embedding the file in the CSS.
*You can use color, font-size, line-height, background-color or other font related styling rules to change the display of your icon
*You need no special technical knowledge
*Support in all major browsers, including old versions of IE
Personally, I would recommend the use of background-images only when you need multiple colors and those color can't be achieved by means of color, background-color and other color-related CSS rules for fonts.
The main benefit of using SVG images is that you can give different components of a symbol their own styling. If you embed your SVG XML code in the HTML document, this is very similar to styling the HTML. This would, however, result in a web page that uses both HTML tags and SVG tags, which could significantly reduce the readability of a webpage. It also adds extra bloat if the symbol is repeated across multiple pages and you need to consider that old versions of IE have no or limited support for SVG.
A: Unicode arrows heads:
*
*▲ - U+25B2 BLACK UP-POINTING TRIANGLE
*▼ - U+25BC BLACK DOWN-POINTING TRIANGLE
*▴ - U+25B4 SMALL BLACK UP-POINTING TRIANGLE
*▾ - U+25BE SMALL BLACK DOWN-POINTING TRIANGLE
For ▲ and ▼ use ▲ and ▼ respectively if you cannot include Unicode characters directly (use UTF-8!).
Note that the font support for the smaller versions is not as good. Better to use the large versions in smaller font.
More Unicode arrows are at:
*
*http://en.wikipedia.org/wiki/Arrow_%28symbol%29#Arrows_in_Unicode
*http://en.wikipedia.org/wiki/Geometric_Shapes
Lastly, these arrows are not ASCII, including ↑ and ↓: they are Unicode.
A: Usually, best is to see a character in his context.
Here is the full list of Unicode chars, and how your browser currently displays them. I am seeing this list evolving, browser versions after others.
This list is obtained by iteration in decimal of the html entities unicode table, it may take some seconds, but is very useful to me in many cases.
By hovering quickly a given char you will get the dec and hex and the shortcuts to generate it with a keyboard.
var i = 0
do document.write("<a title='(Linux|Hex): [CTRL+SHIFT]+u"+(i).toString(16)+"\nHtml entity: &# "+i+";\n&#x"+(i).toString(16)+";\n(Win|Dec): [ALT]+"+i+"' onmouseover='this.focus()' onclick='this.href=\"//google.com/?q=\"+this.innerHTML' style='cursor:pointer' target='new'>"+"&#"+i+";</a>"),i++
while (i<136690)
window.stop()
// From https://codepen.io/Nico_KraZhtest/pen/mWzXqy
The same snippet as a bookmarklet:
javascript:void%20!function(){var%20t=0;do{document.write(%22%3Ca%20title='(Linux|Hex):%20[CTRL+SHIFT]+u%22+t.toString(16)+%22\nHtml%20entity:%20%26%23%20%22+t+%22;\n%26%23x%22+t.toString(16)+%22;\n(Win|Dec):%20[ALT]+%22+t+%22'%20onmouseover='this.focus()'%20onclick='this.href=\%22https://google.com/%3Fq=\%22+this.innerHTML'%20style='cursor:pointer'%20target='new'%3E%26%23%22+t+%22;%3C/a%3E%22),t++}while(t%3C136690);window.stop()}();
To generate that list from php:
for ($x = 0; $x < 136690; $x++) {
echo html_entity_decode('&#'.$x.';',ENT_NOQUOTES,'UTF-8');
}
To generate that list into the console, using php:
php -r 'for ($x = 0; $x < 136690; $x++) { echo html_entity_decode("&#".$x.";",ENT_NOQUOTES,"UTF-8");}'
Here is a plain text extract, of arrows, some are coming with unicode 10.0.
http://unicode.org/versions/Unicode10.0.0/
Unicode 10.0 adds 8,518 characters, for a total of 136,690 characters.
⭝⭞⭟⭠⭡⭢⭣⭤⭥⭦⭧⭨⭩⭪⭫⭬⭭⭮⭯⭰⭱⭲⭳⭶⭷⭸⭹⭺⭻⭼⭽⭾⭿⮀⮁⮂⮃⮄⮅⮆⮇⮈⮉⮊⮋⮌⮍⮎⮏⮐⮑⮒⮓⮔⮕⮘⮙⮚⮛⮜⮝⮞⮟⮠⮡⮢⮣⮤⮥⮦⮧⮨⮩⮪⮫⮬⮭⮮⮯⮰⮱⮲⮳⮴⮵⮶⮷⮸⮹⮽⮾⮿⯀⯁⯂⯅⯆⯇⯈⬶⬷⬸⬹⬺⬻⬼⬽⬾⬀⬁⬂⬃⬄⬅⬆⬇⬈⬉⬊⬋⬌⬍⬎⬏⬐⬑⤀⤁⤂⤃⤄⤅⤆⤇⤈⤉⤊⤋⤌⤍⤎⤏⤐⤑⤒⤓⤔⤕⤖⤗⤘⤙⤚⤛⤜⤝⤞⤟⤠⤡⤢⤣⤤⤥⤦⤧⤨⤩⤪⤫⤬⤭⤮⤯⤰⤱⤲⤳⤴⤵⤶⤷⤸⤹⤺⤻⤼⤽⤾⤿⥀⥁⥂⥃⥄⥅⥆⥇⥈⥉⥊⥋⥌⥍⥎⥏⥐⥑⥒⥓⥔⥕⥖⥗⥘⥙⥚⥛⥜⥝⥞⥟⥠⥡⥢⥣⥤⥥⥦⥧⥨⥩⥪⥫⥬⥭⥮⥯⥰⥱⥲⥳⥴⥵⟨⟩⟪⟫⟬⟭⟮⟯⟰⟱⟲⟳⟴⟵⟶⟷⟸⟹⟺⟻⟼⟽⟾⟿➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾⊲⊳⊴⊵←↑→↓↔↕↖↗↘↙↚↛↜↝↞↟↠↡↢↣↤↥↦↧↨↩↪↫↬↭↮↯↰↱↲↳↴↵↶↷↸↹↺↻↼↽↾↿⇀⇁⇂⇃⇄⇅⇆⇇⇈⇉⇊⇋⇌⇍⇎⇏⇐⇑⇒⇓⇔⇕⇖⇗⇘⇙⇚⇛⇜⇝⇞⇟⇠⇡⇢⇣⇤⇥⇦⇧⇨⇩⇪⇫⇬⇭⇮⇯⇰⇱⇲⇳⇴⇵⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿ᐂᐃᐄᐅᐆᐇᐈᐉᐊᐋᐌᐍᐎᐏᐐᐑᐒᐓᐔᐕᐖᐗᐘᐙᐚᐛᐫᐬᐭᐮᐯᐰᐱᐲᐳᐴᐵᐶᐷᐸᐹᐺᐻᐼᐽᐾᐿᑀᑁᑂᑃᑄᑅᑆᑇᑈ
Hey, did you notice the plain html <details> element has a drop down arrow? This is sometimes all what we need.
<details>
<summary>Morning</summary>
<p>Hello world!</p>
</details>
<details>
<summary>Evening</summary>
<p>How sweat?</p>
</details>
A: "Not ASCII (neither's ↑/↓)" needs qualification.
While these characters are not defined in the American Standard Code for Information Interchange as glyphs, their codes WERE commonly used to give a graphical presentation for ASCII codes 24 and 25 (hex 18 and 19, CANcel and EM:End of Medium). Code page 437 (called Extended ASCII by IBM, includes the numeric codes 128 to 255) defined the use of these glyphs as ASCII codes and the ubiquity of these conventions permeated the industry as seen by their deployment as standards by leading companies such as HP, particularly for printers, and IBM, particularly for microcomputers starting with the original PC.
Just as the use of the ASCII codes for CAN and EM was relatively obsolete at the time, justifying their use as glyphs, so has the passage of time made the use of the codes as glyphs obsolete by the current use of UNICODE conventions.
It should be emphasized that the extensions to ASCII made by IBM in Extended ASCII, included not only a larger numeric set for numeric codes 128 to 255, but also extended the use of some numeric control codes, in the ASCII range 0 to 32, from just media transmission control protocols to include glyphs. It is often assumed, incorrectly, that the first 0 to 128 were not "extended" and that IBM was using the glyphs of conventional ASCII for this range. This error is also perpetrated in one of the previous references. This error became so pervasive that it colloquially redefined ASCII subliminally.
A: I know I'm late to the party but you can accomplish this with plain CSS as well:
HTML:
(It can be any HTML element, if you're using an inline element like a <span> for example, make sure you make it a block/inline-block element with display:block; or display:inline-block):
<div class="up"></div>
and
<div class="down"></div>
CSS:
.up {
height:0;
width:0;
border-top:100px solid black;
border-left:100px solid transparent;
transform:rotate(-45deg);
}
.down {
height:0;
width:0;
border-bottom:100px solid black;
border-right:100px solid transparent;
transform:rotate(-45deg);
}
You can also accomplish it using :before and :after pseudo-elements, which is actually a better way since you avoid creating extra markup. But that's up to you on how you'd like to accomplish it.
--
Here's a Demo in CodePen with many arrow possibilities.
A: A lot of people here are suggesting to use the triangles, but sometimes you need a chevron.
We had a case where our button shows a chevron, and wanted the user's manual to refer to the button in a way which will be recognized by a non-technical user too. So we needed a chevron sign.
We used ﹀ in the end. It is known as PRESENTATION FORM FOR VERTICAL RIGHT ANGLE BRACKET and its code is U+FE40.
A: I think the asker may be referring to one of these (see attached image) - I found this StackOverflow question while searching for the same thing myself.
Unfortunately, this glyph doesn't seem to exist as a distinct character entity anywhere. Wikipedia accomplishes it below by using inline javascript and img content="data:image/gif..." to achieve the symbol.
Incidentally, here's the base64 for it:
data:image/gif;base64,R0lGODlhFQAJAIABAAAAAAAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjAxODAxMTc0MDcyMDY4MTE4OEM2REYyN0ExMDhBNDJFIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjdCNTAyODcwMEY4NjExRTBBMzkyQzAyM0E1RDk3RDc3IiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjdCNTAyODZGMEY4NjExRTBBMzkyQzAyM0E1RDk3RDc3IiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDUzUgTWFjaW50b3NoIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MDE4MDExNzQwNzIwNjgxMTg4QzZERjI3QTEwOEE0MkUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MDE4MDExNzQwNzIwNjgxMTg4QzZERjI3QTEwOEE0MkUiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4B//79/Pv6+fj39vX08/Lx8O/u7ezr6uno5+bl5OPi4eDf3t3c29rZ2NfW1dTT0tHQz87NzMvKycjHxsXEw8LBwL++vby7urm4t7a1tLOysbCvrq2sq6qpqKempaSjoqGgn56dnJuamZiXlpWUk5KRkI+OjYyLiomIh4aFhIOCgYB/fn18e3p5eHd2dXRzcnFwb25tbGtqaWhnZmVkY2JhYF9eXVxbWllYV1ZVVFNSUVBPTk1MS0pJSEdGRURDQkFAPz49PDs6OTg3NjU0MzIxMC8uLSwrKikoJyYlJCMiISAfHh0cGxoZGBcWFRQTEhEQDw4NDAsKCQgHBgUEAwIBAAAh+QQBAAABACwAAAAAFQAJAAACF4yPgMsJ2mJ4VDKKrd4GVz5lYPeMiVUAADs=
Hope this helps someone!
A: ▲▼
These are U+25B2 (▲) and U+25BC (▼) respectively
A: HTML Entities for empty triangles
◁ = ◁
▷ = ▷
▽ = ▽
△ = △
A: I decided that most popular symbols recommended here (▼ and ▲) are looking too bold, so on the site codepoints.net, recommended by user ADJenks, I found these symbols which are looking better for my taste:
(U+1F780) (U+1F781) (U+1F782) (U+1F783)
A: The site I like to use for this is codepoints.net
Here is a search for the words "arrowhead" and "triangle": https://codepoints.net/search?q=arrowhead+triangle
It has some matches for "triangle-headed arrow" that have stems, but it's only 4 small pages to skim over and there are many good matches with nice details on each character.
There is also a code block for "Miscellaneous Symbols and Arrows" and this website lists them here: https://codepoints.net/miscellaneous_symbols_and_arrows
A: Here is another one - ᐞ - Unicode U+141E / CANADIAN SYLLABICS GLOTTAL STOP
A: Unicode arrows seem pretty much out, because as of 2021 Android phones do not seem to come installed with full Unicode fonts that contain arrows (simply most top language fonts, ie Chinese, Arabic, etc); and a webpage asking to download a decent Unicode font, such as Arial Unicode MS, will put a 22Meg hit on your download time.
FontAwesome is quite useful for these kinds of dingbats. Version 4.7 font-awesome.min.css weighs in at 30KB. sort-up, sort-down, chevron-up, chevron-down provide your characters. https://fontawesome.com/v4.7/get-started/ Works great in regular HTML (text, etc). However it requires rewriting, and so inside literal span contexts is more tricky to use.
jquery already supports icons that people can use, by quietly downloading a 6.8K font image and then taking chunks out of it under the hood. Both carets (chevrons) and triangles (arrowheads). See https://api.jqueryui.com/theming/icons/ for a catalog. After including jquery, include a glyph by using code <span class="ui-icon ui-icon-arrowthick-1-n"></span>. The up and down arrows you requested are ui-icon-caret-1-n and ui-icon-caret-1-s (for north and south); the carets are better than triangles for looking pointy at low resolutions. And they can be colorized.
Unfortunately, jquery currently appears hardwired to display icons at 16x16 pixel resolution--grain-of-sand on today's monitors. They can be enlarged using the transform function. But it starts to get sloppy.
jquery icons can also be hacked by locally overriding with your own image, through background:url(). See the jquery docs.
Bytesize Icons https://github.com/danklammer/bytesize-icons is not too bad.
there are others. | unknown | |
d861 | train | Sadly you didn't follow the tutorial, otherwise you'd have noticed that inside the tutorial they define a function getObjectManager() inside the Controller. You don't define this function and therefore the Controller assumes this to be a ControllerPlugin and therefore asks the ControllerPluginManager to create an instance for this plugin. But no such Plugin was ever registered and that's why you see this error.
TL/DR -> do the tutorial step by step. Understand what you're doing, don't blindly copy paste the lines you think are important.
A: You forgot to implement the getObjectManager for your controller :
protected function getObjectManager()
{
if (!$this->_objectManager) {
$this->_objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
}
return $this->_objectManager;
}
this method is included at the end of the IndexController in the tutorial you mentionned. | unknown | |
d862 | train | The question is, why does it write to old_hole? It has been taken out from write and its scope is limited to the current block only, then what difference does it make?
Not quite. old_hole is "in scope" on the read side. You have to look at newChan for the full picture:
newChan = do {
read <- newEmptyMVar ;
write <- newEmptyMVar ;
hole <- newEmptyMVar ;
putMVar read hole ;
putMVar write hole ;
return (read,write) }
So right after calling newChan the "old_hole" from putChan is the same MVar as hole in newChan. And as channel operations progress, that old_hole is always somewhere nested in the MVars of read.
I found the design of linked list-style channels truly difficult to wrap my head around at first. The illustration from that paper does a decent job of showing the structure, but the basic idea is readers "peel off" a layer of MVar to reveal a value, while writers are inserting values "at the bottom" of the pile of MVars, mainting a pointer to the bottom-most one.
By the way this is the design used in Control.Concurrent.Chan | unknown | |
d863 | train | I found the answer to your question. After updating yajra/laravel-datatables-orakle package to version 7.* - All columns escaped by default to protect from XSS attack. To allow columns to have an html content, use rawColumns api. doc | unknown | |
d864 | train | You should use Globally override require of proxyquire package.
a depends b, b depends on c. Now you want to mock the indirect c dependency instead of direct b dependency when you test a. It's NOT recommended to do this. But anyway, here is the solution:
E.g.
a.js:
const b = require('./b');
function aGetResult() {
return b.getInfo();
}
exports.aGetResult = aGetResult;
b.js:
const c = require('./c');
function getInfo() {
return getDetailInfo();
}
function getDetailInfo() {
const result = c.getApiResult();
return result;
}
module.exports = { getInfo };
c.js:
const api = {
get(url) {
return 'real result';
},
};
function getApiResult() {
return api.get('/test/1');
}
module.exports = { getApiResult };
a.test.js:
const proxyquire = require('proxyquire');
const { expect } = require('chai');
const sinon = require('sinon');
describe('63275147', () => {
it('should pass', () => {
const stubs = {
'./c': {
getApiResult: sinon.stub().returns('stubbed result'),
'@global': true,
},
};
const a = proxyquire('./a', stubs);
const actual = a.aGetResult();
expect(actual).to.be.eq('stubbed result');
sinon.assert.calledOnce(stubs['./c'].getApiResult);
});
});
unit test result:
63275147
✓ should pass (2630ms)
1 passing (3s)
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 83.33 | 100 | 60 | 83.33 |
a.js | 100 | 100 | 100 | 100 |
b.js | 100 | 100 | 100 | 100 |
c.js | 50 | 100 | 0 | 50 | 3-8
----------|---------|----------|---------|---------|------------------- | unknown | |
d865 | train | You should create each element at once and add them to the root element. if you are loading the string dynamically you can use XElement.Parse Method (String)
something like this
var obj = new XElement("object");
//obj.SetElementValue("InnerXml", "<testXml>Test_data</testXml>");
XElement elt = new XElement("InnerXml");
obj.Add(elt);
XElement elt2 = XElement.Parse("<testXml>Test_data</testXml>");
elt.Add(elt2); | unknown | |
d866 | train | Change:
var tbody_row = $("<tr></tr>").append($("<td></td>",{"text": k}));
to
var tbody_row = $("<tr></tr>").append($("<td></td>",{"html": '<a href="' + k + '.html">' + k + '</a>'}));
to construct links to math.html when subject is math.
See updated jsFiddle for code and demonstration. | unknown | |
d867 | train | Fixed: I needed to use window.open instead of showmodaldialog as when using showmodaldialog, the parent/calling page was (i believe) pausing/halting/breaking execution of the parent page until the child page was closed | unknown | |
d868 | train | I would try wiping the caches. I think the issue could be in either the Android Studio cache or in the Gradle cache, so I would wipe them both.
To clear the Gradle cache:
Locate the folder .gradle in your home directory, and delete it.
To clear the Android Studio cache:
In Android Studio, choose File->Invalidate Caches/Restart. Then choose Invalidate and Restart from the pop-up.
A: Fixed the problem. The problem was that Android Studio was auto-generating local.properties in the parent folder as well while importing my project. The local.properties in the parent folder had only the sdk.dir and not the ndk.dir. On adding ndk.dir to that file, I was able to gradle sync successfully. | unknown | |
d869 | train | From the storage side, maybe this is safe, but your single replica is only able to be read / sent from a single broker.
If that machine goes down, the data will still be available on your backend, sure, but you cannot serve requests for it without knowing there is another replica for that topic (replication factor < 2). | unknown | |
d870 | train | You can use pivot_longer() but it is easier if you rename the variables first as below:
x <- data.frame(
ID = 1:4,
A1 = c(10,25,40,25),
A1.1=c(1,1,0,1),
A1.2=c(1,0,1,1),
A1.3=c(0,0,0,0),
B1 = c(15,30,15,10),
B1.1=c(0,0,0,0),
B1.2=c(1,1,1,1),
B1.3=c(0,1,0,1),
C1 = c(30,25,10,30),
C1.1=c(1,1,0,1),
C1.2=c(0,0,0,0),
C1.3=c(0,1,1,0)
)
x %>%
rename("A1.0" = "A1",
"B1.0" = "B1",
"C1.0" = "C1") %>%
pivot_longer(`A1.0`:`C1.3`,
names_pattern=c("([A-C])\\d.(\\d)"),
names_to=c("A_C", ".value"),
names_prefix = "R") %>%
rename("A1_C1_value" = "0",
"R1" = "1",
"R2" = "2",
"R3" = "3")
# # A tibble: 12 × 6
# ID A_C A1_C1_value R1 R2 R3
# <int> <chr> <dbl> <dbl> <dbl> <dbl>
# 1 1 A 10 1 1 0
# 2 1 B 15 0 1 0
# 3 1 C 30 1 0 0
# 4 2 A 25 1 0 0
# 5 2 B 30 0 1 1
# 6 2 C 25 1 0 1
# 7 3 A 40 0 1 0
# 8 3 B 15 0 1 0
# 9 3 C 10 0 0 1
# 10 4 A 25 1 1 0
# 11 4 B 10 0 1 1
# 12 4 C 30 1 0 0**
A: You can do this pretty efficiently using data.table:
library(data.table)
df1 <- data.table(df1)
df2 <- melt(df1, measure = patterns("^F1", "r1$", "r2$", "r3$"),
value.name = c("F1_value", "R1", "R2", "R3"), variable.name = "F1_x")
Producing:
ID F1_x F1_value R1 R2 R3
1: 1 1 10 1 1 0
2: 2 1 25 1 0 0
3: 3 1 40 0 1 0
4: 4 1 25 1 1 0
5: 1 2 15 0 1 0
6: 2 2 30 0 1 1
7: 3 2 15 0 1 0
8: 4 2 10 0 1 1
9: 1 3 30 1 0 0
10: 2 3 25 1 0 1
11: 3 3 10 0 0 1
12: 4 3 30 1 0 0 | unknown | |
d871 | train | Just use a backslash, as it will revert to the default grep command and not your alias:
\grep -I --color
A: You could use command to remove all arguments.
command grep -I --color
A: I realize this is an older question, but I've been running up against the same problem. This solution works, but isn't the most elegant:
# Not part of your original question, but I learned that if an alias
# contains a trailing space, it will use alias expansion. For the case
# of 'xargs', it allows you to use the below grep aliases, such as the
# 'chgrep' alias defined below:
# grep -l 'something' file1 file2 ... | xargs chgrep 'something else'
alias xargs='xargs '
export GREP_OPT='-n'
# Note the $(...) INSIDE the 'single quotes'
alias grep_='\grep --color=auto -I $(echo "$GREP_OPT")'
# Due to alias expansion, the below aliases benefit from the 'GREP_OPT' value:
alias cgrep='grep_ -r --include=\*.{c,cc,cpp}'
alias hgrep='grep_ -r --include=\*.{h,hh,hpp}'
alias chgrep=cgrep_ --include=\*.{h,hh,hpp}' # Not sure if there's a way to combine cgrep+hgrep
...
alias pygrep='grep_ -r --include=\*.py'
In the situations where you want a non-numbered output, unset GREP_OPT (or remove -n from it, like if you're using it to include other flags).
I've used grep_ instead of grep in the above example just to show that aliases will happily chain/use alias expansion as needed all the way back to the original command. Feel free to name them grep instead. You'll note that the original grep_ uses the command \grep so the alias expansion stops at that point.
I'm totally open to suggestions if there is a better way of doing this (since setting/unsetting the GREP_OPT isn't always the most elegant). | unknown | |
d872 | train | For wdthRect = 250, hgtRect = 200, innerR = 65, startA = 280.0, angle = 30.0, gap = 10.0R
Private Sub DrawAnnular2(ByVal pntC As Point, ByVal wdthRect As Integer, ByVal hgtRect As Integer, ByVal innerR As Integer, ByVal startA As Single, ByVal angle As Single, ByVal gap As Double)
Dim g As Graphics
Dim pth As New GraphicsPath
Dim pthRct As New GraphicsPath
Dim pthCrclIn As New GraphicsPath
Dim pthCrclOut As New GraphicsPath
Dim fe, theta, dbl As Double
Dim outerR, wdth As Integer
Dim rect As Rectangle
wdth = Math.Min(wdthRect, hgtRect)
outerR = CInt(Math.Sqrt(2.0R * (CDbl(wdth) / 2.0R) * (CDbl(wdth) / 2.0R))) 'πυθαγόρειο θεώρημα
rect.X = CInt(CDbl(pntC.X) - CDbl(wdth) / 2.0R)
rect.Y = CInt(CDbl(pntC.Y) - CDbl(wdth) / 2.0R)
rect.Width = wdth
rect.Height = wdth
pthCrclOut.AddEllipse(pntC.X - outerR, pntC.Y - outerR, 2 * outerR, 2 * outerR)
pthCrclIn.AddEllipse(rect)
pthRct.AddRectangle(rect)
'////// The same as annular 1 //////////////////////////////////////////////////
g = Me.CreateGraphics
g.SmoothingMode = SmoothingMode.AntiAlias
gap /= 2.0R
dbl = gap / CDbl(outerR)
theta = Math.Asin(dbl) * 180.0R / Math.PI
fe = theta
pth.AddArc(pntC.X - outerR, pntC.Y - outerR, 2 * outerR, 2 * outerR, startA + CSng(fe), angle - CSng(2.0R * fe)) 'Outer
dbl = gap / CDbl(innerR)
theta = Math.Asin(dbl) * 180.0R / Math.PI
fe = theta
pth.AddArc(pntC.X - innerR, pntC.Y - innerR, 2 * innerR, 2 * innerR, startA + angle - CSng(fe), -(angle - CSng(2.0R * fe))) 'Inner
'////////////////////////////////////////////////////////////
Dim Reg1 As New Region(pth)
Dim Reg2 As New Region(pthRct)
Reg2.Intersect(Reg1)
g.FillRegion(Brushes.Aqua, Reg2) 'This is the actual annular 2.
g.DrawPath(Pens.Green, pthCrclIn)
g.DrawPath(Pens.Green, pthCrclOut)
g.DrawPath(Pens.Red, pthRct)
Reg1.Dispose()
Reg2.Dispose()
pthRct.Dispose()
pthCrclOut.Dispose()
pthCrclIn.Dispose()
pth.Dispose()
g.Dispose()
End Sub
This line of code:
Reg2.Intersect(Reg1)
is actually the intersect between the blue and the red
EDIT
Private Function DrawAnnular2(ByVal pntC As Point, ByVal wdthRect As Integer, ByVal hgtRect As Integer, ByVal innerR As Integer, ByVal startA As Single, ByVal angle As Single, ByVal gap As Double) As GraphicsPath
Dim g As Graphics
Dim pth As New GraphicsPath
Dim pthRct As New GraphicsPath
Dim pthFinal As New GraphicsPath
Dim fe, theta, dbl As Double
Dim outerR, wdth As Integer
Dim rect As Rectangle
Dim lst1 As New List(Of Integer)
Dim lst2 As New List(Of Integer)
Dim lst3 As New List(Of Integer)
Dim lst4 As New List(Of Integer)
Dim i As Integer
Dim lstBl(3) As Boolean
Dim position As Integer
lstBl(0) = False
lstBl(1) = False
lstBl(2) = False
lstBl(3) = False
wdth = Math.Min(wdthRect, hgtRect)
outerR = CInt(Math.Sqrt(2.0R * (CDbl(wdth) / 2.0R) * (CDbl(wdth) / 2.0R))) 'πυθαγόρειο θεώρημα
rect.X = CInt(CDbl(pntC.X) - CDbl(wdth) / 2.0R)
rect.Y = CInt(CDbl(pntC.Y) - CDbl(wdth) / 2.0R)
rect.Width = wdth
rect.Height = wdth
pthRct.AddRectangle(rect)
'////////////////////////////////////////////////////////
g = Me.CreateGraphics
g.SmoothingMode = SmoothingMode.AntiAlias
gap /= 2.0R
dbl = gap / CDbl(outerR)
theta = Math.Asin(dbl) * 180.0R / Math.PI
fe = theta
If CDbl(angle) - 2.0R * fe >= 360.0R Then
pthFinal.AddEllipse(pntC.X - innerR, pntC.Y - innerR, 2 * innerR, 2 * innerR)
pthFinal.AddRectangle(rect)
g.FillPath(Brushes.Aqua, pthFinal)
g.DrawPath(Pens.Red, pthRct)
pthRct.Dispose()
pth.Dispose()
g.Dispose()
Return pthFinal
End If
pth.AddArc(pntC.X - outerR, pntC.Y - outerR, 2 * outerR, 2 * outerR, startA + CSng(fe), angle - CSng(2.0R * fe)) 'Outer
dbl = gap / CDbl(innerR)
theta = Math.Asin(dbl) * 180.0R / Math.PI
fe = theta
pth.AddArc(pntC.X - innerR, pntC.Y - innerR, 2 * innerR, 2 * innerR, startA + angle - CSng(fe), -(angle - CSng(2.0R * fe))) 'Inner
'////////////////////////////////////////////////////////////
For i = rect.X To rect.X + wdth
If pth.IsVisible(i, rect.Y) Then
If lst1.Count <> 0 Then
If i <> lst1(lst1.Count - 1) + 1 Then
lstBl(0) = True
position = lst1.Count
End If
End If
lst1.Add(i)
End If
Next
For i = rect.Y To rect.Y + wdth
If pth.IsVisible(rect.X + wdth, i) Then
If lst2.Count <> 0 Then
If i <> lst2(lst2.Count - 1) + 1 Then
lstBl(1) = True
position = lst2.Count
End If
End If
lst2.Add(i)
End If
Next
For i = rect.X To rect.X + wdth
If pth.IsVisible(i, rect.Y + wdth) Then
If lst3.Count <> 0 Then
If i <> lst3(lst3.Count - 1) + 1 Then
lstBl(2) = True
position = lst3.Count
End If
End If
lst3.Add(i)
End If
Next
For i = rect.Y To rect.Y + wdth
If pth.IsVisible(rect.X, i) Then
If lst4.Count <> 0 Then
If i <> lst4(lst4.Count - 1) + 1 Then
lstBl(3) = True
position = lst4.Count
End If
End If
lst4.Add(i)
End If
Next
'If lstBl(0) = True Or lstBl(1) = True Or lstBl(2) = True Or lstBl(3) = True Then
'It is a rare case that i have to work on, when angle is too large
'MsgBox(lstBl(0).ToString + " " + lstBl(1).ToString + " " + lstBl(2).ToString + " " + lstBl(3).ToString + " ")
'Application.Exit()
'End If
'TextBox1.Text = lst1.Count.ToString + " " + lst2.Count.ToString + " " + lst3.Count.ToString + " " + " " + lst4.Count.ToString
pthFinal.AddArc(pntC.X - innerR, pntC.Y - innerR, 2 * innerR, 2 * innerR, startA + angle - CSng(fe), -(angle - CSng(2.0R * fe))) 'Inner
If CDbl(startA) + fe >= 225.0R And CDbl(startA) + fe <= 315.0R Then '1
If lst1.Count <> 0 Then
If lstBl(0) = True Then
pthFinal.AddLine(lst1(position), rect.Y, lst1(lst1.Count - 1), rect.Y)
Else
pthFinal.AddLine(lst1(0), rect.Y, lst1(lst1.Count - 1), rect.Y)
End If
End If
If lst2.Count <> 0 Then
pthFinal.AddLine(lst1(lst1.Count - 1), rect.Y, rect.X + wdth, lst2(lst2.Count - 1))
End If
If lst3.Count <> 0 Then
pthFinal.AddLine(rect.X + wdth, lst2(lst2.Count - 1), lst3(0), rect.Y + wdth)
End If
If lst4.Count <> 0 Then
pthFinal.AddLine(lst3(0), rect.Y + wdth, rect.X, lst4(0))
End If
If lstBl(0) = True Then
pthFinal.AddLine(rect.X, lst4(0), lst1(position - 1), rect.Y)
End If
ElseIf (CDbl(startA) + fe > 315.0R And CDbl(startA) + fe <= 360.0R) Or _
(CDbl(startA) + fe >= 0.0R And CDbl(startA) + fe <= 45.0R) Then '2
If lst2.Count <> 0 Then
If lstBl(1) = True Then
pthFinal.AddLine(rect.X + wdth, lst2(position), rect.X + wdth, lst2(lst2.Count - 1))
Else
pthFinal.AddLine(rect.X + wdth, lst2(0), rect.X + wdth, lst2(lst2.Count - 1))
End If
End If
If lst3.Count <> 0 Then
pthFinal.AddLine(rect.X + wdth, lst2(lst2.Count - 1), lst3(0), rect.Y + wdth)
End If
If lst4.Count <> 0 Then
pthFinal.AddLine(lst3(0), rect.Y + wdth, rect.X, lst4(0))
End If
If lst1.Count <> 0 Then
pthFinal.AddLine(rect.X, lst4(0), lst1(lst1.Count - 1), rect.Y)
End If
If lstBl(1) = True Then
pthFinal.AddLine(lst1(lst1.Count - 1), rect.Y, rect.X + wdth, lst2(position - 1))
End If
ElseIf CDbl(startA) + fe > 45.0R And CDbl(startA) + fe <= 135.0R Then '3
If lst3.Count <> 0 Then
If lstBl(2) = True Then
pthFinal.AddLine(lst3(position - 1), rect.Y + wdth, lst3(0), rect.Y + wdth)
Else
pthFinal.AddLine(lst3(lst3.Count - 1), rect.Y + wdth, lst3(0), rect.Y + wdth)
End If
End If
If lst4.Count <> 0 Then
pthFinal.AddLine(lst3(0), rect.Y + wdth, rect.X, lst3(0))
End If
If lst1.Count <> 0 Then
pthFinal.AddLine(rect.X, lst3(0), lst1(lst1.Count - 1), rect.Y)
End If
If lst2.Count <> 0 Then
pthFinal.AddLine(lst1(lst1.Count - 1), rect.Y, rect.X + wdth, lst2(lst2.Count - 1))
End If
If lstBl(2) = True Then
pthFinal.AddLine(rect.X + wdth, lst2(lst2.Count - 1), lst3(position), rect.Y + wdth)
End If
Else '4
If lst4.Count <> 0 Then
If lstBl(3) = True Then
pthFinal.AddLine(rect.X, lst4(position - 1), rect.X, lst4(0))
Else
pthFinal.AddLine(rect.X, lst4(lst4.Count - 1), rect.X, lst4(0))
End If
End If
If lst1.Count <> 0 Then
pthFinal.AddLine(rect.X, lst4(0), lst1(lst1.Count - 1), rect.Y)
End If
If lst2.Count <> 0 Then
pthFinal.AddLine(lst1(lst1.Count - 1), rect.Y, rect.X + wdth, lst2(lst2.Count - 1))
End If
If lst3.Count <> 0 Then
pthFinal.AddLine(rect.X + wdth, lst2(lst2.Count - 1), lst3(0), rect.Y + wdth)
End If
If lstBl(3) = True Then
pthFinal.AddLine(lst3(0), rect.Y + wdth, rect.X, lst4(position))
End If
End If
'g.FillPath(Brushes.Blue, pth)
g.FillPath(Brushes.Aqua, pthFinal)
g.DrawPath(Pens.Red, pthRct)
pthRct.Dispose()
pth.Dispose()
g.Dispose()
Return pthFinal
End Function
Your values: | unknown | |
d873 | train | From Spring documentation "Consuming a RESTful Web Service" :
This guide walks you through the process of creating an application
that consumes a RESTful web service.
First, you will have to define your model. In this case, it is Quote and Value.
Then, you will be able to call your API.
Here's the example :
public class Application {
private static final Logger log = LoggerFactory.getLogger(Application.class);
public static void main(String args[]) {
RestTemplate restTemplate = new RestTemplate();
Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class);
log.info(quote.toString());
}
}
RestTemplate will automatically transform JSON from API into Java object. | unknown | |
d874 | train | You follow a completely wrong approach. Do not first publish something and then try to hold it back. You will never be able to really secure that. Instead use a routing endpoint in those "subdomain hosts", thus being able to limit the access to that folder to a single IP address, your own system. So that from a client side perspective the browser requests the script from the websites own "subdomain" which in turn internally re-routes the request to that folder / host / whatever.
There are many solutions for that. Any many explanations of how to do that are found on the internet.
According to your description you have a very simple setup, so do not require any special logic in such routing logic. Instead you want a simple and static mapping. Easiest would be to do that on the level of the http server itself. If you have the proxy module loaded, then you can do something like that to implement a simple forward proxy:
ProxyPass /scripts/ http://example.com/scripts/
If it is not only scripts served from http://example.com/scripts/ but also something holding back references then you need to setup a reverse proxy:
ProxyPass /scripts/ http://example.com/scripts/
ProxyPassReverse /scripts/ http://example.com/scripts/
Best is to place such definitions in the http server configurations of the "subdomains". You can also use dynamic configuration files for such stuff, but that has many disadvantages.
As said there are other solutions. For example you can implement a simple router script, that allows fine tuned authorization management and the like. But you apparently don't need that.
The main goal of all this is:
*
*do not publish anything from http://example.com directly, so block access to it except for the subdomains http server(s).
*make all client side requests from your "webpages" point to the http host they were served from, so the subdomains http hosts.
The official documentation of the apache http server contains all the information you need. It is of excellent quality and comes with good examples. | unknown | |
d875 | train | It depends exactly on the OS, but in general, another desktop program can register a specific protocol, or URI scheme, to open up a program. Then, when Chrome doesn't know how to deal with a protocol, it'll just hand it over to the OS to deal with.
In Windows for example, they're configured by putting something into the system registry under a specific key (https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx).
Most applications will setup themselves as a default for the particular protocol when installed.
A: Chrome is a "desktop" program. It can open any program exposed from the operating system.
A link can contain a specific protocol instead of http://, the OS can have a map that ties protocols directly to installed programs. Chrome is not communicating with the app at any point. It only tells the os to open a resource at a given url with a given program. | unknown | |
d876 | train | Add a bucket wide policy rather than on each file:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::my-brand-new-bucket/*"
]
}
]
}
http://s3browser.com/working-with-amazon-s3-bucket-policies.php
A: Instead of adding a new bucket policy, I fixed my problem by aliasing a domain name to my bucket. When I access bucket files through the alias, I'm seeing no permission errors. | unknown | |
d877 | train | Both jqt and jconsole read the command line arguments and box them:
jqt script.ijs arg1 arg2
ARGV
┌───┬──────────┬────┬────┐
│jqt│script.ijs│arg1│arg2│
└───┴──────────┴────┴────┘
2}. ARGV
┌────┬────┐
│arg1│arg2│
└────┴────┘
] x =: > 3 { ARGV
arg2
example script:
$ cat script.ijs
x =: ". every 2 }. ARGV
echo +/ x
$ jqt script.ijs 1 2 3
6 | unknown | |
d878 | train | I do implementing coupon system on my project. And I think we have the same term for this. You might try my way:
*
*This is my vouchers table attributes. I declared it as fillable attributes in Voucher model.
protected $fillable = [
'service_id',
'code',
'name',
'description',
'percentage', // percentage of discount
'maximum_value', // maximum value of discount
'maximum_usage', // maximum usage per user. If it's 1, it means user only can use it once.
'user_terms', // additional terms
'amount', // amount of voucher. If it's 1, it means the voucher is only can be redeemed once.
'expired_at',
'is_active', // for exception if we want to deactivate the voucher (although voucher is valid)
];
*This is my voucher_redemptions table, this table is used when the user redeem the voucher. I declared it in VoucherRedemption model.
protected $fillable = [
'redeemer_id', // user id who redeems the voucher
'voucher_id', // voucher
'item_id', // product item
];
*This is my function to redeem voucher
/**
* Apply voucher to an item
* @param int $redeemerId user id
* @param string $voucherCode voucher code
* @param int $itemId project batch package id
* @return VoucherRedemption $redemption
*/
public static function apply($redeemerId, $voucherCode, $itemId)
{
$voucher = Voucher::where('code', $voucherCode)->first();
// Make sure item is exist and the batch has not been checked out
$item = ProjectBatchPackage::where('id', $itemId)->first();
if (!$item) {
return;
} else if ($item->batch->status != null) {
return;
}
// Make sure voucher exist
if (!$voucher) {
return;
}
// Make sure is voucher active, not expired and available.
if ($voucher->is_active == false || $voucher->isExpired() || !$voucher->isAvailable()) {
return;
}
// Make sure voucher usage for user
if ($voucher->maximum_usage != null) {
$user_usages = VoucherRedemption::where('redeemer_id', $redeemerId)
->where('voucher_id', $voucher->id)
->get()
->count();
if ($user_usages >= $voucher->maximum_usage) {
return;
}
}
// Apply voucher to project batch package (item)
$redemption = VoucherRedemption::create([
'redeemer_id' => $redeemerId,
'voucher_id' => $voucher->id,
'item_id' => $itemId
]);
return $redemption;
}
Thank you. | unknown | |
d879 | train | A compiler that warned about all constructs that violate the constraints in N1570 6.5p7 as written would generate a lot of warnings about constructs which all quality implementations would support without difficulty. The only way those parts of the Standard would make any sense would be if the authors expected quality implementations to extend the semantics of the language to support use cases which, even if they're not mandated by the Standard, they should have no reason not to support. The use case illustrated in the presented code is an example of this.
Although the Standard would not forbid implementations from using N1570 6.5p7 as an excuse to behave nonsensically even in situations where an object is only ever used as a single type of storage, the stated purpose of the rules is to describe situations where implementations would or would not be required to allow for the possibility of pointer aliasing. Forbidding the particular construct at issue even in cases where storage is only used as a single type would do nothing to further that aim. If code were to use the subscripting operator on buffer, in addition to accessing the storage via a struct thing*, a compiler might legitimately fail to recognize the possibility that accesses using the latter lvalue might interact with those using the former. In the presented code, however, the storage is only used as type struct thing or via memcpy, usage cases that there would have been no reason to prohibit. Writing the rules in such a way as to only forbid use of a char[] to hold data of some other type in situations where it was also subscripted would definitely add complexity, but would not have been expected to make compilers support any constructs they wouldn't have supported anyway.
If the Standard had been intended to characterize programs into those that were correct or incorrect, it would need to have been worthwhile to write more detailed rules. Since it made no attempt to distinguish constructs which are erroneous from those which are correct but "non-portable" (in the sense that there might exist some implementations which don't process them meaningfully), however, there was no need to try to explicitly identify and provide for all of the constructs which compilers would have no reason not to process meaningfully. | unknown | |
d880 | train | It shows a leak because you allocate arrayDetPerformance and then not release it. Simple as that. At least that's what we can tell from the code you are showing us.
As for the rest, don't use retainCount to debug memory problems, ever! You have to understand the simple memory management rules and follow them, nothing else. Since you don't know what Apple's underlying code does, you cannot rely on the retain count of an object.
As to your question relating to this code:
NSLog(@"Array2 : %d",[arrayDetail retainCount]); //RETAIN COUNT IS 0
arrayDetail = [[finalResult objectForKey:@"Detail"]
NSLog(@"Array2 : %d",[arrayDetail retainCount]); //RETAIN COUNT IS 2
You are assigning a whole other object to arrayDetail so it's completely meaningless to compare any properties of arrayDetail before and after the assignment. The retain count could be all over the place and it would not tell you anything.
I get the impression that you don't really know what you are doing here. You should read the memory management rules again and again until you understand them thoroughly.
A: retainCount won't help you debug your problem (in fact it will almost never be relevant to debugging, so best forget it's even there).
Don't release arrayDetail, as you don't own it. The problem is with arrayDetPerformance. You're allocing an object on that line, and it's not being released anywhere. Now, you may be doing that elsewhere in your code, but if you aren't, send it a release when you've finished using it.
Edit
If you're deallocating arrayDetPerformance in your dealloc method, I'm assuming it's an instance variable? In this case, you can't assume that it doesn't already point at an object, so you should send it a release before assigning it to the new object.
Alternatively, if it is configured as a property, just use self.arrayDetPerformance = ... which will take care of the memory management for you.
A: Do not call retainCount
retainCount is useless. The absolute retain count of an object is an implementation detail. The rule is simple; if you cause something to be retained, you must cause it to be released when you are done with it. End of story.
The memory management documentation discusses this fully.
First, retainCount can never return zero. The only time you'll get a zero is if you happened to message nil. This:
NSLog(@"Array2 : %d",[arrayDetail retainCount]); //RETAIN COUNT IS 0
arrayDetail = [[finalResult objectForKey:@"Detail"]
NSLog(@"Array2 : %d",[arrayDetail retainCount]); //RETAIN COUNT IS 2
You are causing arrayDetail to point to a different object on that second line. Thus, no relation between the retain count before/after that line.
When leaks tells you a leak is on a particular line like this one...
arrayDetPerformance = [[NSMutableArray alloc] initWithArray:arrayDetail];
... it is telling you that said object allocated on that line was leaked. It is not telling you that particular line was the cause of the leak. The leak is likely because you either over-retained it somewhere else or forgot to leak it.
You've said in several comments that you are "deallocating [something] in your dealloc". Show your dealloc method's implementation.
A: [arrayDetPerformance release]; is not written in your code;
So, its show memory leak. | unknown | |
d881 | train | Your custom tag can grab and remove all page attributes before evaluating the body, and then clear and restore afterwards. | unknown | |
d882 | train | I found the API call was hidden in a library which is only in preview mode at the moment. It's found in the following NuGet package, enable include prerelease in Visual Studio to find it in the NuGet client.
https://www.nuget.org/packages/Microsoft.Azure.Management.Resources/
Then to create a resource group I can use
var credentials = new TokenCloudCredentials("", "");
var client = new Microsoft.Azure.Management.Resources.ResourceManagementClient(credentials);
var result = c.ResourceGroups.CreateOrUpdateAsync("MyResourceGroup", new Microsoft.Azure.Management.Resources.Models.ResourceGroup("West US"), new System.Threading.CancellationToken()).Result;
There is another stack overflow post explaining how to do the authentication:
How to get Tags of Azure ResourceManagementClient object
The following blog post explains how to set up TokenCloudCredentials, required for the authentication part, in more detail, but only for command line apps:
http://www.bradygaster.com/post/using-windows-azure-active-directory-to-authenticate-the-management-libraries
If you want to use something other than a command line app the following can work for authentication:
http://www.dushyantgill.com/blog/2015/05/23/developers-guide-to-auth-with-azure-resource-manager-api/
A: Go to https://resources.azure.com - the ARMExplorer shows both the REST and the PowerShell commands to create a resource group. All the APIs are REST based. In C#, send a WebClient request. | unknown | |
d883 | train | You can get the download URL like this
fileRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
final Uri download_url = uri;
}
}):
A: You can get your download path after uploading the file as follows (you need to call a second method on your reference object (getDownloadUrl):
profilePicUploadTask = fileRef.putFile(imgUrl).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>()
{
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot)
{
// note: you can get the download path only after the file is uploaded successfully.
// To get the download path you have to call another method like follows:
fileRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>()
{
@Override
public void onSuccess(Uri uri)
{
// uri is your download path
}
}
}); | unknown | |
d884 | train | This line is very very wrong:
cmd.CommandText = "Select * from users where TX_EMPLOYEE='"; (Environment.UserName) & "'";
It should be this:
cmd.CommandText = "Select * from users where TX_EMPLOYEE='" + Environment.UserName + "'";
Except, it shouldn't be like that because of SQL injection. If I could make Environment.UserName into ' or 1 = 1 or TX_EMPLOYEE = ' then your final query would become this:
Select * from users where TX_EMPLOYEE='' or 1 = 1 or TX_EMPLOYEE = ''
Which clearly isn't what you want - somebody with no credentials being able to access this. You should instead use SQL parameters:
cmd.CommandText = "Select * from users where TX_EMPLOYEE=?userName";
cmd.Parameters.AddWithValue("?userName", Environment.UserName);
On a separate note, I'm confused by this code:
i = Convert.ToInt32(dt.Rows.Count.ToString());
DataTable.Rows.Count is already an int, so you're converting a number to a string to a number. Why? | unknown | |
d885 | train | You need to import the matplotlib.dates module explicitly:
import matplotlib.dates
before it is available.
Alternatively, import the function into your local namespace:
from matplotlib.dates import date2num
dates = date2num(listOfDates)
A: this error usually comes up when the date and time of your system is not correct. just correct and restart the whole console and it should work perfect. | unknown | |
d886 | train | The approach is sound.
It occurs to me that you only need Message_id and Display_id in the "intersection entity", as the other columns would probably come from the "parent" entity.
Message_type_id
Display_location_id
Display_type_id | unknown | |
d887 | train | In C, for integers, you add 'U', 'L', or 'LL' to numbers to make them unsigned, long, or long long in a few combinations
a = -1LL; // long long
b = -1U; // unsigned
c = -1ULL; // unsigned long long
d = -1LLU; // unsigned long long
e = -1LU; // unsigned long
f = -1UL; // unsigned long
One other option, in C, is to cast. The compiler, very probably, will do the right thing :)
return (uint32)42 - (int64)10;
But probably the best option, as pointed by ouah in the comments below, is to use Macros for integer constants (C99 Standard 7.18.4)
a = UINT32_C(-1); // -1 of type uint_least32_t
b = INT64_C(42); // 42 of type int_least64_t
A: Is there something wrong this?
inline T foo(T x)
{
int k1 = 42;
int k2 = 21;
int k3 = 33;
return 1ull * x * k1 * k2 - k3;
}
Your comments on the other answer suggest you are unsure about which types to use for the constants.
I don't see what the problem is with just using any type in which that constant is representable.
For the calculation expression, you would need to think about the size and signed-ness of intermediate calculations. In this example I start with 1ull to use unsigned arithmetic mod 2^64. If you actually wanted arithmetic mod 2^32 then use 1ul instead, and so on.
Can you elaborate on what you meant by "space wasted"? It sounds as if you think there is some problem with using 64-bit ints. What sort of "space" are you talking about?
Also, to clarify, the reason you don't want to declare k1 global is because k1 has a different value in one function than it does in another function? (As opposed to it having the same value but you think it should have a different data type for some reason). | unknown | |
d888 | train | This is just a guess, but complex types can NEVER be null. So if you have any reference to a complex type (ICollection) you should initialize them from the Entity constructor.
Example:
public class NewsProvider
{
public int Id { get; set; }
[Required(ErrorMessage = "Please enter a name")]
[StringLength(50, ErrorMessage = "The name is too long")]
public string Name { get; set; }
}
public class NewsFeed
{
public NewsFeed() {
//Never allow NewsProvider to be null
NewsProvider = new NewsProvider();
}
public int Id { get; set; }
[Required(ErrorMessage = "Please enter a name")]
[StringLength(50, ErrorMessage = "The name is too long")]
public string Name { get; set; }
[Required(ErrorMessage = "Please enter a URL")]
[StringLength(300, ErrorMessage = "The URL is too long")]
public string Url { get; set; }
[Required(ErrorMessage = "Please enter a news provider")]
public virtual NewsProvider NewsProvider { get; set; }
}
For more info, here is a great blog post:
http://weblogs.asp.net/manavi/archive/2010/12/11/entity-association-mapping-with-code-first-part-1-one-to-one-associations.aspx | unknown | |
d889 | train | Replace:
event_router.register(r'events', views.EventViewSet, base_name='events')
with
event_router.register(r'events', views.EventViewSet, base_name='event') | unknown | |
d890 | train | Give your ESP8266 devices a static IP addresses so the mobile app will know in advance where they could be 'found':
IPAddress ip(192,168,1,xx); // desired static IP address
IPAddress gateway(192,168,1,yy); // IP address of the router
IPAddress subnet(255,255,255,0);
WiFi.begin(ssid, password);
WiFi.config(ip, gateway, subnet);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
and use dynamic DNS service (unless you have a static IP address) with port forwarding to access each of the ESPs. You can choose ports 8266, 8267, 8268, 8269, ... or any other above 1024 and then set the port forwarding in your router settings so port 8266 will be forwarded to the IP address of your first ESP and port 80 (or any other), port 8267 will be forwarded to the IP address of your second ESP and port 80 etc.
Afterwards you can access your ESPs from mobile app (or internet) using URLs looking like http://xx.xx.xx.xx:8266, http://xx.xx.xx.xx:8267, http://xx.xx.xx.xx:8268, http://xx.xx.xx.xx:8269, ... or by using dynamic DNS service with: http://myhome.something.com:8266, http://myhome.something.com:8267 etc. Or you can access them from your local network by known static IP addresses. That is - your mobile app will have to determine if it is inside local network or not. Or you can always access ESPs using proxy - in that case the URLs will not depend upon being inside or outside the local network.
A: Your friend may have more of the details of your solution, but IMO the gateway has nothing to do with it. If all clients and the server are on the same subnet inside the router's local network then the gateway doesn't come into play.
I would do a UDP multicast. Your mobile app would just need to send one request and then listen for replies from the ESPs for a few seconds.
A: One way is to check all the Mac addresses on the network. The first 6 digits is the unique code for the company that made the wifi dongle.
This is assuming you do not have any other devices on the network using the same dongle and aren't what you're trying to search for.
You can find all the Mac addresses on a network by performing an ARP request on each IP.
But all the devices would have to be on the same subnet.
If you devices are remote, then I would go with your original plan, however your friend is correct if the gateway changes this would require something a little more robust. Use a Dynamic DNS service along with a domain name. The Dynamic DNS will update your DNS records in almost real time if your gateway address changes. | unknown | |
d891 | train | I agree with Kuba. Mostly GUI malfunctions are occurred when another action is blocking the thread it is running on, so your solution in these cases is to either move the GUI or that action to another thread.
Since I only see the code for GUI here, let's try moving the GUI to another thread first. With the header QThread, add these codes to your function and see if it helps:
QThread * t1 = new QThread();
this->moveToThread(t1);
t1->start(); | unknown | |
d892 | train | Your code didn't work because the "Select" button in your image is a HTML <button> element not a <a> element. When user click this button, it calls JavaScript functions to open in new window. So your code won't work for this scenario.
For handling the new window request, I'd suggest using WebView.NewWindowRequested event. This event occurs when a user performs an action in a WebView that causes content to be opened in a new window. We can provide custom handling of the new window request and set the Handled property to true to prevent the default browser from being launched. Following is a simple sample:
private void webView_NewWindowRequested(WebView sender, WebViewNewWindowRequestedEventArgs args)
{
webView.Navigate(args.Uri);
args.Handled = true;
}
For more info, please see Remarks and Examples in WebView.NewWindowRequested event. | unknown | |
d893 | train | What happens in your deploy:
*
*you push changes to your repo
*vercel watches your repo, see there is a new commit
*it sends the status pending to your repo and builds the stuff on vercel servers. So now your repo knows vercel is doing something and you can see that e.g. in your PR in the ckecks. => with this "Status update" your workflow is automaticaly triggered (but skipped because the condition is false), because the status changed from nothing to "pending"
*vercel has finished the deployment and sends another status update to GitHub. => your workflow is triggered again. But this time the if condition in the workflow is true and the rest will be executed.
So it is not possible to avoid the skipped workflow with the deployment_status as a trigger for the workflow. | unknown | |
d894 | train | Because your files have a space in the name, try your original script but change this line:
sed -i "s/$name$artist//" $file
to this:
sed -i "s/$name$artist//" "$file" | unknown | |
d895 | train | There is no way to accomplish this directly using rails only.
To be able to use require("react-clipboard"), one solution (the less intrusive) would be to use a combination of rails, react-rails and browserify as explained here:
http://collectiveidea.com/blog/archives/2016/04/13/rails-react-npm-without-the-pain/
and here
https://gist.github.com/oelmekki/c78cfc8ed1bba0da8cee
I did not re paste the whole code example as it is rather long and prone to changes in the future | unknown | |
d896 | train | There is no parameter to specify the year in crontab.
You can move the year logic to the bash script and add that script to crontab.
A: No. Crontab is for events that REPEAT on cycles within the year. It's got no capacity for scheduling events on a particular year, nor even for events that happen in some years and not others. It's just not something the designers of cron needed to do. | unknown | |
d897 | train | Though the Question is super Old.
Still if anyone faces the same issue,
Also it can be used as a UILabel. Though
Below solution will do the job : [There isn't a need for any library..]
So I've used MFMailcomposer() and UITexView [ Code is in Swift 3.0 - Xcode 8.3.2 ]
A 100% Crash Proof and Working Code Handles all the corner cases. =D
Step 1.
import MessageUI
Step 2. Add the delegate
class ViewController: UITextViewDelegate, MFMailComposeViewControllerDelegate{
Step 3. Add the textView IBOutlet From StoryBoard
@IBOutlet weak var infoTextView: UITextView!
Step 4. Call the below method in your viewDidload()
func addInfoToTextView() {
let attributedString = NSMutableAttributedString(string: "For further info call us on : \(phoneNumber)\nor mail us at : \(email)")
attributedString.addAttribute(NSLinkAttributeName, value: "tel://", range: NSRange(location: 30, length: 10))
attributedString.addAttribute(NSLinkAttributeName, value: "mailto:", range: NSRange(location: 57, length: 18))
self.infoTextView.attributedText = attributedString
self.infoTextView.linkTextAttributes = [NSForegroundColorAttributeName:UIColor.blue, NSUnderlineStyleAttributeName:NSNumber(value: 0)]
self.infoTextView.textColor = .white
self.infoTextView.textAlignment = .center
self.infoTextView.isEditable = false
self.infoTextView.dataDetectorTypes = UIDataDetectorTypes.all
self.infoTextView.delegate = self
}
Step 5. Implement delegate methods for TextView
@available(iOS, deprecated: 10.0)
func textView(_ textView: UITextView, shouldInteractWith url: URL, in characterRange: NSRange) -> Bool {
if (url.scheme?.contains("mailto"))! && characterRange.location > 55{
openMFMail()
}
if (url.scheme?.contains("tel"))! && (characterRange.location > 29 && characterRange.location < 39){
callNumber()
}
return false
}
//For iOS 10
@available(iOS 10.0, *)
func textView(_ textView: UITextView, shouldInteractWith url: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
if (url.scheme?.contains("mailto"))! && characterRange.location > 55{
openMFMail()
}
if (url.scheme?.contains("tel"))! && (characterRange.location > 29 && characterRange.location < 39){
callNumber()
}
return false
}
Step 6. Write the helper Methods to open MailComposer and Call App
func callNumber() {
if let phoneCallURL = URL(string: "tel://\(phoneNumber)")
{
let application:UIApplication = UIApplication.shared
if (application.canOpenURL(phoneCallURL))
{
let alert = UIAlertController(title: "Call", message: "\(phoneNumber)", preferredStyle: UIAlertControllerStyle.alert)
if #available(iOS 10.0, *)
{
alert.addAction(UIAlertAction(title: "Call", style: .cancel, handler: { (UIAlertAction) in
application.open(phoneCallURL, options: [:], completionHandler: nil)
}))
}
else
{
alert.addAction(UIAlertAction(title: "Call", style: .cancel, handler: { (UIAlertAction) in
application.openURL(phoneCallURL)
}))
}
alert.addAction(UIAlertAction(title: "cancel", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
else
{
self.showAlert("Couldn't", message: "Call, cannot open Phone Screen")
}
}
func openMFMail(){
let mailComposer = MFMailComposeViewController()
mailComposer.mailComposeDelegate = self
mailComposer.setToRecipients(["\(email)"])
mailComposer.setSubject("Subject..")
mailComposer.setMessageBody("Please share your problem.", isHTML: false)
present(mailComposer, animated: true, completion: nil)
}
Step 7. Write MFMailComposer's Delegate Method
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
switch result {
case .cancelled:
print("Mail cancelled")
case .saved:
print("Mail saved")
case .sent:
print("Mail sent")
case .failed:
print("Mail sent failure: \(String(describing: error?.localizedDescription))")
default:
break
}
controller.dismiss(animated: true, completion: nil)
}
That's it you're Done... =D
Here is the swift file for the above code :
textViewWithEmailAndPhone.swift
Set the below properties to Use it as a UILabel
A: A note on detecting email addresses: The Mail app must be installed (it's not on the iOS Simulator) for email links to open a message compose screen.
A: Swift 3.0 +
As of swift 3.0, use the following code if you want to do it programmatically.
textview.isEditable = false
textview.dataDetectorTypes = .all
Or if you have a storyboard
A: If you are using OS3.0
you can do it like the following
textview.editable = NO;
textview.dataDetectorTypes = UIDataDetectorTypeAll;
A: Step 1. Create a subclass of UITextview and override the canBecomeFirstResponder function
KDTextView.h Code:
@interface KDTextView : UITextView
@end
KDTextView.m Code:
#import "KDTextView.h"
// Textview to disable the selection options
@implementation KDTextView
- (BOOL)canBecomeFirstResponder {
return NO;
}
@end
Step 2. Create the Textview using subclass KDTextView
KDTextView*_textView = [[KDTextView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[_textView setScrollEnabled:false];
[_textView setEditable:false];
_textView.delegate = self;
[_textView setDataDetectorTypes:UIDataDetectorTypeAll];
_textView.selectable = YES;
_textView.delaysContentTouches = NO;
_textView.userInteractionEnabled = YES;
[self.view addSubview:_textView];
Step 3: Implement the delegate method
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange
{
return true;
}
A: I'm curious, do you have control over the text shown? If so, you should probably just stick it in a UIWebView and throw some links in there to do it "the right way".
A: Swift 4.2 Xcode 10.1
func setupContactUsTextView() {
let text = NSMutableAttributedString(string: "Love your App, but need more help? Text, Call (123) 456-1234 or email ")
if let font = UIFont(name: "Calibri", size: 17) {
text.addAttribute(NSAttributedStringKey.font,
value: font,
range: NSRange(location: 0, length: text.length))
} else {
text.addAttribute(NSAttributedStringKey.font,
value: UIFont.systemFont(ofSize: 17),
range: NSRange(location: 0, length: text.length))
}
text.addAttribute(NSAttributedStringKey.foregroundColor,
value: UIColor.init(red: 112/255, green: 112/255, blue: 112/255, alpha: 1.0),
range: NSRange(location: 0, length: text.length))
text.addAttribute(NSAttributedStringKey.link, value: "tel://", range: NSRange(location: 49, length: 15))
let interactableText = NSMutableAttributedString(string: "[email protected]")
if let font = UIFont(name: "Calibri", size: 17) {
interactableText.addAttribute(NSAttributedStringKey.font,
value: font,
range: NSRange(location: 0, length: interactableText.length))
} else {
interactableText.addAttribute(NSAttributedStringKey.font,
value: UIFont.systemFont(ofSize: 17),
range: NSRange(location: 0, length: interactableText.length))
}
interactableText.addAttribute(NSAttributedStringKey.link,
value: "[email protected]",
range: NSRange(location: 0, length: interactableText.length))
interactableText.addAttribute(NSAttributedStringKey.underlineStyle,
value: NSUnderlineStyle.styleSingle.rawValue,
range: NSRange(location: 0, length: interactableText.length))
text.append(interactableText)
videoDescTextView.attributedText = text
videoDescTextView.textAlignment = .center
videoDescTextView.isEditable = false
videoDescTextView.isSelectable = true
videoDescTextView.delegate = self
}
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool {
if (characterRange.location > 48 && characterRange.location < 65){
print("open phone")
}else{
print("open gmail")
}
return false
}
Steps -
1. Set the delegate to your text field and don't forget to implement UITextViewDelegate
2. Take the textView outlet - @IBOutlet weak var videoDescTextView: UITextView!
3. Add these two functions given above.
This function shows how to detect phone numbers, email from textView, how to underline your email id, how to give custom color to your text, custom font, how to call a function when tapping on phone or email, etc.
Hope this will help someone to save their valuable time. Happy Coding :)
A: If you want to auto detect links, email etc Please make sure "isSelectable" is set to true.
textview.isSelectable = true
textview.editable = false
textview.dataDetectorTypes = .all | unknown | |
d898 | train | Currently your code doesn't have anything that even attempts to collapse the row. You could change your code to this.
HTML:
<a ng-href ng-click="toggleAccordionRow(champion.clean)"> Zerg </a>
JavaScript:
$scope.activeRows = "";
$scope.isAccordionOpen = function(row) {
if ($scope.activeRows === row) {
return true;
} else {
return false;
}
}
$scope.toggleAccordionRow = function(row) {
$scope.activeRows = $scope.isAccordionOpen(row) ? "" : row;
}
A: If you want toggle. Just use these code.
$scope.activeRows = true // Am setting this for default to show
ng-click="$scope.activeRows = !$scope.activeRows" // change ng-click event
ng-show = "$scope.activeRows" // bind directly $scope.activeRows to show.
A: the easy way to do such a thing is the way bellow
<a ng-href ng-click="hideBar =!hideBar"> Zerg </a>
<div ng-show="hideBar">
info
</div> | unknown | |
d899 | train | VB implicitly try's to cast the DBNull Value to DateTime, since the method signature of DateTime.TryParse is
Public Shared Function TryParse(s As String, ByRef result As Date) As Boolean
which fails. You can use a variable instead:
dim startDate as DateTime
If DateTime.TryParse(dr("IX_ArticleStartDate").ToString(), startDate) Then
dr("startDate") = startDate
End If
A: A DateTime is a value type and cannot have a null value. You can do something like this:
Dim result As DateTime
Dim myDate As DateTime? = If(Not dr.IsNull("IX_ArticleStartDate") AndAlso _
DateTime.TryParse(dr.IsNull("IX_ArticleStartDate").ToString(), result), _
result, New DateTime?)
In this example, the variable myDate is not actually a DateTime, it's a Nullable(Of DateTime) as indicated by the question mark ? after DateTime in the declaration (see MSDN). The TryParse method actually takes a string value as the first argument and an output parameter which is a DateTime value as the second argument. If the parse is successful, it returns True and sets the output parameter to the parsed DateTime value; on the other hand, if the parse is not successful, it returns False and sets the output parameter to DateTime.MinDate which is not very useful because it's difficult to distinguish between a valid use of DateTime.MinDate and null.
The example makes use of a ternary operator which either parses and returns the date value, if it's not null, or else returns a nullable date instead (New DateTime?).
You would then use myDate.HasValue() accordingly to determine if the value is null, and if it's not null, you can use its value: myDate.Value. | unknown | |
d900 | train | Azure AD is available both through ADAL which uses the Azure AD v1 Endpoint and through MSAL which uses the Azure AD v2 Endpoint.
Azure AD B2C is accessible via the v2 endpoint but requires that a policy be indicated.
There are several differences between these. Your best bet is to compare the docs between the protocols/tokens of each:
*
*v1 endpoint - protocol doc & token doc
*v2 endpoint - protocol doc & token doc
*B2C - protocol doc & token doc
Just to name a few differences:
*
*v2 endpoint adds an extra v2.0 to the authorization and token endpoint URLs, https://login.microsoftonline.com/common/oauth2/**v2.0**/authorize
*v1 has a resource query parameter in the request to the authorization endpoint, v2 and B2C don't, it puts the resources as extra values in the existing scope query parameter. B2C has the extra p query string parameter
*The token has several differences including the value of the issuer and the name of some of the basic claims.
*v2 doesn't support the on-behalf-of flow yet. See v2 limitations doc as there are other protocol limitations. | unknown |