Posts

Using C# classes/structs in SQL Server -

is there way can declare instances of .net class or struct in sql server stored procedure and/or use them parameters in function? i have .net method takes 2 instances of unitofmeasure class , converts value 1 unit other. my .net class looks following. i've omitted lot of code sake of brevity... public class unitofmeasure { public static unitofmeasure gram {get;} = new unitofmeasure("gram","g",unittype.mass, 0.001, 0); public static unitofmeasure kilogram {get;} = new unitofmeasure("kilogram","kg",unittype.mass,1,0); ... public static ienumerable<unitofmeasure> namedunits {get;} = new list<unitofmeasure>(){gram, kilogram, ...}; public string name {get; private set;} public string symbol {get; private set; } public unittype {get; private set;} public double standardunits {get; private set} public double standardoffset {get; private set} public unitofmeasure(string name, st...

c# - Change TabItem child StackPanel to Vertical Orientation -

Image
i need adjust orientation property of stackpanel child tabitem above datatemplate in visual tree. from attached pic, can see wpf form, xaml, , visual tree. i'm not sure how stackpanel , change it's orientation. appreciated. thanks! i found out needed define own template (and not headertemplate).

wpf - Tab Item header styling inheritance -

i'm sure there simple i'm overlooking life of me haven't been able figure out. have started using mahapps mmetro ui has applied style of tabs. on tabs needed ability string formatting headers declared this: <tabitem content="{binding tasklist}"> <tabitem.header> <textblock text="{binding count, stringformat=tasks (\{0\})}" /> </tabitem.header> </tabitem> tab items headers defined not inherit metro ui styling. there way apply styling headers? unfortunately, bindingbase.stringformat used when target property of type string , tabitem.header of type object , binding directly stringformat specified fails give expected result. luckily, can use tabitem.headerstringformat property format header text while maintaining original style: <tabitem header="{binding count}" headerstringformat="tasks ({0})" (...) /> mind though headerstringformat used when value of header ...

android - Unable to instantiate main activity - ClassNotFound -

i cannot open application. far remember, appeared first time when created new class (now deleted). error occurs if delete below //referencje , part of layout related them. name of class edited, used work after that. 09-12 18:56:25.512: e/androidruntime(616): fatal exception: main 09-12 18:56:25.512: e/androidruntime(616): java.lang.runtimeexception: unable instantiate activity componentinfo{com.example.test2/com.example.test2.activity_main}: java.lang.classnotfoundexception: com.example.test2.activity_main 09-12 18:56:25.512: e/androidruntime(616): @ android.app.activitythread.performlaunchactivity(activitythread.java:1983) 09-12 18:56:25.512: e/androidruntime(616): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2084) 09-12 18:56:25.512: e/androidruntime(616): @ android.app.activitythread.access$600(activitythread.java:130) 09-12 18:56:25.512: e/androidruntime(616): @ android.app.activitythread$h.handlemessage(activitythread.java:1195) 09-12 18:56:25.5...

Scala equivalent of Haskell first and second -

haskell has convenient functions called first , second apply function 1 element of pair: first fn (a,b) = (fn a, b) second fn (a,b) = (a, fn b) are such functions defined in standard scala libraries? edit: know it's easy define them, possible it's cleaner use standard functions standard names… def first[a, b, x](fn: => x)(pair: (a, b)): (x, b) = (fn(pair._1), pair._2) def second[a, b, x](fn: b => x)(pair: (a, b)): (a, x) = (pair._1, fn(pair._2)) haskell's arrows ( first , second among them) implemented in scalaz: scalaz source some examples while it's technically not standard library it's stable , seems maintained. update syntax bit cumbersome though (maybe there way?): import scalaz._ import scalaz._ val f = (x: int) => x + 1 val g = f.second[string] g("1", 2) //> ("1", 3) // or type inference f second ("1", 2) //> ("1", 3)

gcc - Include assembly file in another assembly file -

i have 2 files, main.s , test.s test.s looks this: test: add a1,a2,a2 ...and main.s looks this: main: call test (very senseless examples). how can include test in main? using gcc this: gcc -o main main.c but have no idea how can use test in there...any help? you can include file else in gcc: #include"test.s" were using nasm use: %include "test.s"

Rails: Dropdown with links to show pages -

i trying put drop down in navbar users can click on links different stone show pages. code have in getting nomethoderror private method `each' called nil:nilclass. i pretty sure private method error coming because putting code in navbar in application.html.erb rather in stone model. point me in right direction should define methods navbar? or if there else should doing instead? here have attempted far: application.html.erb <div class="dropdown"> <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">dropdown example <span class="caret"></span></button> <ul class="dropdown-menu"> <% @stones.each |stone| %> <li> <%= link_to stone_url %> <%= stone.name %> <% end %> </li> <% end %> </ul> </div> application_controller.rb class applicationcontroller < action...