[Solved] sed/regex to change only few of multiple matching characters

with sed based on position $ echo abc-def-ghi-2017-10-31 | sed ‘s/-/./4g’ abc-def-ghi-2017.10.31 based on surrounding chars $ echo abc-def-ghi-2017-10-31 | sed -r ‘s/([0-9])-([0-9])/\1.\2/g’ abc-def-ghi-2017.10.31 based on the position from the end of string $ echo abc-def-ghi-2017-10-31 | rev | sed ‘s/-/:/g; s/:/-/3g’ | rev abc-def-ghi-2017:10:31 2 solved sed/regex to change only few of multiple matching … Read more

[Solved] Why is it faster to print to the javascript console than printing to C++ console? [closed]

You are testing it in two different environments. To make it a fair test, I decided to test it in similar environments (same host, 2GHz AMD A10-6800K processor as reported by cat /proc/cpuinfo): Javascrtipt – using node binary version 0.10.25 on Linux executed from bash prompt. Results were consistent around 83ms. I had to remove … Read more

[Solved] Last day of the previous month – In Specific format using JS [duplicate]

I always use Moment.js whenever I want work with dates which gives you lot’s of options for format your date, but since you said with plain javascript, you can made a method like this to format your date : function formatDate(date) { date.setDate(0); var monthNames = [ “January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, … Read more

[Solved] Detect Specific Words on string

Check this out, i add comment for easy understand this code var str=”@hello, world how are you. I @am good”; str = str.split(‘ ‘); // split text to word array str = str.filter(function(word){ return word.includes(‘@’); // check words that using @ }).map(function (word) { return word.replace(/[^a-zA-Z^@ ]/g, “”) // remove special character except @ }); … Read more

[Solved] Checkbox and radiobutton won’t show

You have set opacity: 0 for checkboxes and radio buttons in main.css. Remove it and they will appear in your page. opacity sets the transparency of an element. Therefore opacity: 1 means no transparency while opacity: 0 means element having full transparency (invisible on the page). input[type=”checkbox”], input[type=”radio”] { -moz-appearance: none; -ms-appearance: none; appearance: none; … Read more

[Solved] What is this in JS flie

It’s a Base64 encoded PNG image. This image, to be exact: I had a hunch it would be an image (encoding images as Base64 is pretty common) and used this website to decode the string. Edit: Thank you Lee, for adding the link to the Base64 wiki page. I’d also recommend reading up on the … Read more

[Solved] Writing to a file errors – Android Studio

Well… In android you should save the info in a DB or use SharedPreferences. Its really simple: SharedPreferences sp = getSharedPreferences(SHARED_PREF, getApplicationContext().MODE_PRIVATE); Editor editor = sp.edit(); editor.putString(SP_NAME, etName.getText().toString()); editor.commit(); And if you want to recover the information: SharedPreferences sp = getSharedPreferences(SHARED_PREF,getApplicationContext().MODE_PRIVATE); String cadName = sp.getString(SP_NAME, “”); if (cadName.length()>0){ Log.d(“HELENA”,”info saved : “+cadName); } else Log.d(“HELENA”,”No … Read more

[Solved] Add objective c code to swift file [closed]

This is rough translation to Swift…no tested. // Define some colors. var darkGray: UIColor = UIColor.darkGrayColor() var lightGray: UIColor = UIColor.lightGrayColor() // Navigation bar background. UINavigationBar.appearance().barTintColor = darkGray UINavigationBar.appearance().tintColor = lightGray // Color of typed text in the search bar. var searchBarTextAttributes: [NSObject : AnyObject] = [NSForegroundColorAttributeName: lightGray, NSFontAttributeName: UIFont.systemFontOfSize(UIFont.systemFontSize())] UITextField.appearanceWhenContainedInInstancesOfClasses([UISearchBar.self]).defaultTextAttributes = searchBarTextAttributes // Color … Read more

[Solved] PHP – Data Strucure to hold Matrix of Strings and Numeric Values

I found the answer i was looking for from below link. [http://hawkee.com/snippet/10086/] for anyone who is interested in this finding out i will post it here. There is second solution for this also using array within array. Which i will post below this, <?php class Matrix { public $arr, $rows, $cols; function Matrix($row, $col) { … Read more