Posts

Showing posts from July, 2015

Led Light Like Button In Bootstrap 4 Code Example

Example 1: bootsrap buttons <button type= "button" class= "btn btn-primary" >Primary</button> <button type= "button" class= "btn btn-secondary" >Secondary</button> <button type= "button" class= "btn btn-success" >Success</button> <button type= "button" class= "btn btn-danger" >Danger</button> <button type= "button" class= "btn btn-warning" >Warning</button> <button type= "button" class= "btn btn-info" >Info</button> <button type= "button" class= "btn btn-light" >Light</button> <button type= "button" class= "btn btn-dark" >Dark</button> <button type= "button" class= "btn btn-link" >Link</button> Example 2: bootstrap buttons <button type= "button" class= "btn btn-primary&quo

Convert XML File To Csv File Format In C#

Answer : using System.IO; using System.Xml.Serialization; You can do like this: public class Sequence { public Point[] SourcePath { get; set; } } using (FileStream fs = new FileStream(@"D:\youXMLFile.xml", FileMode.Open)) { XmlSerializer serializer = new XmlSerializer(typeof(Sequence[])); var data=(Sequence[]) serializer.Deserialize(fs); List<string> list = new List<string>(); foreach(var item in data) { List<string> ss = new List<string>(); foreach (var point in item.SourcePath) ss.Add(point.X + "," + point.Y); list.Add(string.Join(",", ss)); } File.WriteAllLines("D:\\csvFile.csv", list); } In an alternate way you can use leverage the power of XSLT to convert it, Steps Create an Xml stylesheet to convert xml to csv Use XslCompiledTransform() to convert get the csv string save the csv string to a file You may came up with an Xslt like this, call it data.xsl <?

3 Oz To Grams Code Example

Example: oz to g 1 ounce (oz) = 28.3495231 grams (g)

(-215:Assertion Failed) !_src0.empty() In Function 'medianBlur' Code Example

Example: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' This error happened because the image didn't load properly. So you have problem with the previous line cv2.imread my suggestion is : check if the images exist in the path you give check the count variable if he have valid number

Android: No Activity Found To Handle Intent Error? How It Will Resolve

Answer : Add the below to your manifest: <activity android:name=".AppPreferenceActivity" android:label="@string/app_name"> <intent-filter> <action android:name="com.scytec.datamobile.vd.gui.android.AppPreferenceActivity" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> in my case, i was sure that the action is correct, but i was passing wrong URL, i passed the website link without the http:// in it's beginning, so it caused the same issue, here is my manifest (part of it) <activity android:name=".MyBrowser" android:label="MyBrowser Activity" > <intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="com.dsociety.activities.MyBrowser" /> <category android:name

Arduino Millis For Timing Code Example

Example 1: arduino millis() /*Description Returns the number of milliseconds passed since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 50 days. Syntax */ time = millis ( ) ; Example 2: arduino millis /*Description Returns the number of milliseconds passed since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 50 days. Syntax */ time = millis ( ) /* Returns Number of milliseconds passed since the program started. Return Data type: unsigned long. */

Remove Duplicate Characters In A String In C++ Code Example

Example: removing repeated characters in a string c++ s . erase ( std :: unique ( s . begin ( ) , s . end ( ) ) , s . end ( ) ) ;

Hide Ui Elements Unity Code Example

Example: how to hide ui elements unity GameObject . Find ( "the object name" ) . SetActive ( false ) ;

Convert Youtube To Mp4 Code Example

Example 1: youtube mp4 downloader I suggest videovor . com , it's really great and you even get an option to choose if you want the whole video or just the audio ! Example 2: youtube to mp4 ytmp3 . cc is the best by far Example 3: yt to mp4 yt1s . com for mp4 is my recommendation Example 4: youtube to mp4 flvto . biz is great for it

Shadow Bootstrap Class Code Example

Example: boostrap shadow <div class= "shadow-none p-3 mb-5 bg-light rounded" >No shadow</div> <div class= "shadow-sm p-3 mb-5 bg-white rounded" >Small shadow</div> <div class= "shadow p-3 mb-5 bg-white rounded" >Regular shadow</div> <div class= "shadow-lg p-3 mb-5 bg-white rounded" >Larger shadow</div>

Could Not Open JPA EntityManager For Transaction; Nested Exception Is Java.lang.IllegalStateException

Answer : The error comes from JpaTransactionManager line 403: TransactionSynchronizationManager.bindResource(getDataSource(), conHolder); The error means that the transaction manager is trying to bind the datasource (not the entity manager) to the thread, but the datasource is already there and this is unexpected. Note that the transaction manager had not started yet to bind the Entity Manager to the thread, that would happen next at JpaTransactionManager line 416: There are two possible explanations: Somebody (another transaction manager?) is adding the datasource to the thread before the transaction manager and this is unexpected. Or noone is adding the datasource to the transaction manager, is just that at the end of the task execution noone cleans the thread before returning it to the pool, maybe due an error or an unhandled exception. One question, does this also happen for only one execution thread, or only when there are several? To find out what the problem is, these are so

Html Img Align Center In Div Code Example

Example: image center in div img { display : block ; margin-left : auto ; margin-right : auto ; width : 40 % ; }

C : Typedef Struct Name {...}; VS Typedef Struct{...} Name;

Answer : There are several things going on here. First, as others have said, the compiler's complaint about unknown type may be because you need to define the types before using them. More important though is to understand the syntax of 3 things: (1) struct definition, (2) struct declaration, and (3) typedef. When Defining a struct, the struct can be named, or unnamed (if unnamed, then it must be used immediately (will explain what this means further below)). struct Name { ... }; This defines a type called "struct Name" which then can be used to Declare a struct variable: struct Name myNameStruct; This declares a variable called myNameStruct which is a struct of type struct Name . You can also Define a struct, and declare a struct variable at the same time: struct Name { ... } myNameStruct; As before, this declares a variable called myNameStruct which is a struct of type struct Name ... But it does it at the same time it defines the type str

403 Forbidden Vs 401 Unauthorized Code Example

Example: 401 vs 403 401 Unauthorized VS 403 Forbidden 401 Unauthorized meaning you did not provide a credential or correct credentials to send the request you are encorouranged to try again with correct credentials 403 Forbidden even you did provide valid credentials you are not authorized to take this action by who you are because you do not have authority or permission Do not bother to try again !

Select Next Element Childe Css Code Example

Example: css selector for sibling element /* Paragraphs that come immediately after any image */ img + p { font-weight : bold ; }

Crontab Every 2 Hour Code Example

Example 1: cron every 3 hours 0 */3 * * * Example 2: cron every two hours 0 */2 * * *

Can Equals Vs Equals Java Code Example

Example: java == vs equals In general both equals ( ) and == operator in Java are used to compare objects to check equality but here are some of the differences between the two : 1 ) . equals ( ) and == is that one is a method and other is operator . 2 ) We can use == operator for reference comparison ( address comparison ) and . equals ( ) method for content comparison . - > == checks if both objects point to the same memory location - > . equals ( ) evaluates to the comparison of values in the objects . 3 ) If a class does not override the equals method , then by default it uses equals ( Object o ) method of the closest parent class that has overridden this method . // Java program to understand // the concept of == operator public class Test { public static void main ( String [ ] args ) { String s1 = new String ( "HELLO" ) ; String s2 = new String ( "HELLO&quo

Copy TabControl Tab

Answer : EDIT I have rewritten my solution to use reflection. using System.Reflection; // your TabControl will be defined in your designer TabControl tc; // as will your original TabPage TabPage tpOld = tc.SelectedTab; TabPage tpNew = new TabPage(); foreach(Control c in tpOld.Controls) { Control cNew = (Control) Activator.CreateInstance(c.GetType()); PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(c); foreach (PropertyDescriptor entry in pdc) { object val = entry.GetValue(c); entry.SetValue(cNew, val); } // add control to new TabPage tpNew.Controls.Add(cNew); } tc.TabPages.Add(tpNew); Some information can be found here. http://www.codeproject.com/Articles/12976/How-to-Clone-Serialize-Copy-Paste-a-Windows-Forms

Add Circle Border To Container Flutter Code Example

Example 1: rounded borders for container in flutte Container ( decoration : BoxDecoration ( border : Border . all ( color : Colors . red [ 500 ] , ) , borderRadius : BorderRadius . all ( Radius . circular ( 20 ) ) ) , child : .. . ) Example 2: border at circleAvatar flutter CircleAvatar ( radius : 30 , backgroundColor : Colors . teal , child : CircleAvatar ( backgroundImage : AssetImage ( 'assets / appdev . png' ) , radius : 28 , ) , ) ,