text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
var times = new double[10]; // times var values = new double[10]; // values for (int i = 0; i < 10; i++) { index[i] = i; times[i] = r.NextDouble(); values[i] = r.NextDouble(); } // a naive bubble sort for (int i = 0; i < 10; i++) for (int j = 0;
[ 0.07721602916717529, -0.46786606311798096, 0.0880463644862175, -0.2809608280658722, 0.42494747042655945, 0.44992852210998535, 0.51329505443573, -0.3883003890514374, 0.025134403258562088, -0.7353014945983887, -0.1131160706281662, 0.6638269424438477, -0.45972955226898193, -0.0933603793382644...
j < 10; j++) // compare time value at current index if (times[index[i]] < times[index[j]]) { // swap index value (times and values remain unchanged) var temp = index[i]; index[i] = index[j];
[ -0.012265370227396488, -0.35113027691841125, 0.29114997386932373, -0.4057745635509491, 0.09688090533018112, 0.20176611840724945, 0.10015098750591278, -0.2911803126335144, 0.03461603447794914, -0.537562906742096, -0.4152200222015381, 0.5989910364151001, -0.4265653192996979, 0.04471426457166...
index[j] = temp; } // check if the result is correct for (int i = 0; i < 10; i++) Console.WriteLine(times[index[i]]); Console.ReadKey(); } ``` Note: I used a naive bubble sort there, watchout. In your case, an insertion sort is probably a good candidate. Since you don't want complex...
[ -0.18137803673744202, -0.35879775881767273, 0.24965694546699524, -0.18102578818798065, 0.23265959322452545, -0.12526199221611023, 0.4578489065170288, -0.047325678169727325, 0.030283672735095024, -0.6907556056976318, -0.16327078640460968, 0.7077706456184387, -0.36420342326164246, -0.1956630...
How can I paint in red every time I meet the letter "A" in RichTextBox? Try this: ``` static void HighlightPhrase(RichTextBox box, string phrase, Color color) { int pos = box.SelectionStart; string s = box.Text; for (int ix = 0; ; ) { int jx = s.IndexOf(phrase, ix, StringComparison.CurrentCultureIgnoreCase);...
[ 0.11602982878684998, -0.22266067564487457, 0.4715733826160431, -0.33972570300102234, -0.014986312948167324, 0.30101025104522705, 0.588214635848999, -0.43286216259002686, -0.15493656694889069, -0.6338565349578857, -0.2979699671268463, 0.38347265124320984, -0.44606292247772217, 0.21141894161...
e) { richTextBox1.Text = "Aardvarks are strange animals"; HighlightPhrase(richTextBox1, "a", Color.Red); } ```
[ -0.09874184429645538, 0.1251024603843689, -0.015241559594869614, -0.08985890448093414, 0.19632568955421448, -0.11818621307611465, 0.40624332427978516, 0.14116133749485016, -0.20169879496097565, -0.21406002342700958, -0.6281678080558777, 0.2789459824562073, -0.5543609261512756, 0.2976569533...
I have a custom object that implements INotifyPropertyChanged. I have a collection of these objects where the collection is based on BindingList I have created a binding source for the collection, and set the datasources of the bindingsource and datagridview. Everything works great, except I need to update properties ...
[ 0.3318207859992981, 0.07222478091716766, 0.4444049894809723, 0.10640222579240799, -0.14497010409832, -0.2561272978782654, 0.33254316449165344, -0.15236105024814606, -0.310242623090744, -0.7421090602874756, 0.24940958619117737, 0.46529293060302734, -0.42127031087875366, 0.3807148039340973, ...
but I cannot quite figure it out. > <http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/3566f7c7-eb47-422e-ab09-9549a18da360/> I created and initialized the oper variables per the post in my business object, and then I put the two event functions into my collection class. This compiled correctl...
[ 0.12324594706296921, -0.16701747477054596, 0.47307443618774414, 0.15846394002437592, 0.10279643535614014, 0.05856451764702797, 0.04052572697401047, -0.4162416160106659, -0.08908470720052719, -0.30989691615104675, -0.10508711636066437, 0.5545369982719421, -0.3299170732498169, -0.05097357928...
in GUI references into the business object so that I am later able to call invoke using those references is not an option. I found this class in a forum that works. Just use this instead of BindingList ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentMode...
[ 0.03693866729736328, -0.0418708436191082, 0.7831653952598572, -0.12694141268730164, 0.2976962625980377, -0.058689866214990616, 0.30906832218170166, -0.42514970898628235, -0.09286973625421524, -0.6509816646575928, -0.16819235682487488, 0.7547512054443359, -0.7069451808929443, 0.293843299150...
== null) { BaseAddingNew(e); } else { ctx.Send(delegate {
[ 0.4114772379398346, -0.323759526014328, 0.1967928111553192, -0.0511416420340538, 0.19921323657035828, -0.1915636956691742, 0.4346849322319031, -0.5255597233772278, -0.06617944687604904, -0.4786530137062073, -0.2725925147533417, 0.3006174862384796, -0.39739274978637695, 0.3896633982658386, ...
BaseAddingNew(e); }, null); } } void BaseAddingNew(AddingNewEventArgs e) { base.OnAddingNew(e); }
[ 0.0172140970826149, -0.18811063468456268, 0.27913227677345276, -0.43424585461616516, 0.26410171389579773, -0.08215072005987167, 0.6342257261276245, -0.43243348598480225, -0.05664127692580223, -0.49704352021217346, -0.5794364213943481, 0.4101954400539398, -0.5755210518836975, 0.202351927757...
protected override void OnListChanged(ListChangedEventArgs e) { // SynchronizationContext ctx = SynchronizationContext.Current; if (ctx == null) { BaseListChanged(e); } else
[ 0.33488646149635315, -0.19120700657367706, 0.5999353528022766, -0.1017790213227272, 0.605543851852417, -0.2740704417228699, 0.3506511449813843, -0.3572675585746765, 0.10503021627664566, -0.15904192626476288, -0.09852500259876251, 0.6857652068138123, -0.6128111481666565, 0.35018178820610046...
{ ctx.Send(delegate { BaseListChanged(e); }, null); } }
[ 0.4080008864402771, -0.16531921923160553, 0.14698658883571625, 0.07405278831720352, 0.10378672182559967, -0.12343655526638031, 0.3293399512767792, -0.1250070184469223, -0.2938021421432495, -0.42452892661094666, -0.14459234476089478, 0.24329936504364014, -0.4635118842124939, 0.5646757483482...
void BaseListChanged(ListChangedEventArgs e) { base.OnListChanged(e); } } } ```
[ 0.5511136651039124, -0.04727911949157715, 0.5871629118919373, -0.27025479078292847, 0.3384146988391876, -0.3318352699279785, 0.4357740581035614, -0.3284364640712738, -0.1931556612253189, -0.18571342527866364, -0.07914934307336807, 0.4422573745250702, -0.6963046193122864, 0.1679470986127853...
In javascript you can easily create objects and Arrays like so: ``` var aObject = { foo:'bla', bar:2 }; var anArray = ['foo', 'bar', 2]; ``` Are similar things possible in PHP? I know that you can easily create an array using the array function, that hardly is more work then the javascript syntax, but is there a ...
[ -0.04354025796055794, 0.07162883132696152, -0.00006586409290321171, -0.2356707900762558, -0.4529259204864502, 0.1767520010471344, 0.4366673231124878, -0.2615842819213867, -0.07516428828239441, -0.6914005279541016, -0.08055642992258072, 0.48839378356933594, -0.6779306530952454, -0.024191873...
'bar'=>2); ``` So to summarize: Does PHP have javascript like object creation or should I just use associative arrays? For simple objects, you can use the associative array syntax and casting to get an object: ``` <?php $obj = (object)array('foo' => 'bar'); echo $obj->foo; // yields "bar" ``` But looking at tha...
[ -0.051345132291316986, 0.4247012436389923, 0.35899025201797485, -0.3932187855243683, -0.28347867727279663, 0.11168865859508514, 0.4449619948863983, -0.505699098110199, -0.05958886444568634, -0.2743808329105377, -0.1277582347393036, 0.3294215500354767, -0.479042649269104, -0.111788734793663...
I am trying out moq and I'm running into a problem with the following test body: ``` var child = new Mock<ZooNode>(); var parent = new Mock<ZooNode>(); child.Object.Parent = parent.Object; parent.Expect(p => p.Children.Contains(child.Object)).Returns(true); ``` which throws : > System.ArgumentException: Invalid > ...
[ 0.005791426170617342, 0.1359996795654297, 0.08039573580026627, -0.009710825979709625, 0.2354213297367096, 0.18461646139621735, 0.3287907838821411, -0.37878456711769104, -0.045843854546546936, -0.7896425724029541, -0.30302396416664124, 0.4426518678665161, -0.2701552212238312, 0.227848723530...
Parent { get { return _parent; } set { if(Parent != null) Parent.Children.Remove(value); _parent =
[ 0.08412492275238037, -0.12600542604923248, -0.0450504831969738, -0.00951114110648632, 0.2870817482471466, 0.22977294027805328, 0.5692659616470337, 0.0006038695573806763, -0.008264122530817986, -0.4427471160888672, -0.21477439999580383, 0.0543365404009819, -0.4587189257144928, 0.51900345087...
value; _parent.Children.Add(this); } } public virtual IList<ZooNode> Children { get; private set; } } ``` it now throws > Test method > ZooCms.Core.Tests.Model.ZooNodeTest.TestSetParentAddsNodeToParentNodeList > threw exception: > System.NullReferenceException: Object > reference n...
[ -0.05427626520395279, -0.24037116765975952, 0.06513699144124985, 0.30925533175468445, 0.2977445125579834, 0.2850216031074524, 0.009412040002644062, -0.1989123374223709, -0.2739306092262268, -0.9387161731719971, -0.24069876968860626, 0.47567853331565857, -0.365156888961792, 0.46971014142036...
} } ```
[ 0.17493881285190582, 0.41805654764175415, 0.05209751054644585, -0.04864929988980293, 0.437467485666275, -0.15825650095939636, 0.13202530145645142, 0.5446501970291138, 0.35430577397346497, -0.4846813380718231, -0.2295716553926468, 0.546978771686554, -0.3188462555408478, 0.2798506021499634, ...
I am building a class that handles NSURLConnection requests. To allow other classes to use this class, I would like to allow the main class to call a delegate when connectionDidFinishLoading is fired. I've looked through lots of documentation, but I can't find anything that gives any clear examples, and the code that ...
[ -0.18485350906848907, -0.24177418649196625, 0.4338095784187317, -0.02647804096341133, -0.2714250683784485, -0.2007807195186615, 0.31745395064353943, -0.32073062658309937, -0.22785119712352753, -0.8219332695007324, -0.313012033700943, 0.401125431060791, -0.39883655309677124, 0.3734129369258...
resultData = [self parseJSON:jsonData]; if(delegate && [delegate respondsToSelector:@selector(urlHandler:searchResultsFinishedLoading:)]) { NSLog(@"Delegating!"); [delegate urlHandler:self searchResultsFinishedLoading:resultData]; } else { NSLog(@"Not Delegating. I dont know why."); ...
[ -0.21494437754154205, -0.132259339094162, 0.6375118494033813, -0.14526139199733734, 0.09378669410943985, -0.0928443893790245, 0.42074716091156006, -0.3395073711872101, -0.13515783846378326, -0.32388827204704285, -0.5576604008674622, 0.49291422963142395, -0.22248515486717224, 0.271786004304...
I ran into an issue with something that I am probably just overlooking. I want to take a picture from the surface preview of the camera, and save it to the `sd_card`. This works ALMOST perfect. I assigned it a file name, but it does not use the `filename`. This is what I have been trying to do : ``` Button imagecap...
[ -0.19346792995929718, -0.2190690040588379, 0.9122136235237122, -0.21763716638088226, 0.09734059870243073, 0.10171104967594147, 0.20262543857097626, -0.500078022480011, -0.17837989330291748, -0.7876227498054504, 0.14542651176452637, 0.8519341349601746, -0.17876921594142914, 0.15067867934703...
try { filename = timeStampFormat.format(new Date()); ContentValues values = new ContentValues(); values.put(Media.TITLE, filename); values.put(Media.DESCRIPTION, "Image capture by camera"); Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, val...
[ 0.15313021838665009, -0.3747038245201111, 0.7696399092674255, 0.09902294725179672, 0.22903165221214294, 0.020272541791200638, 0.22328823804855347, -0.266937792301178, -0.03197800740599632, -0.7529396414756775, -0.4709063172340393, 0.5100663304328918, -0.2574216425418854, 0.4454291760921478...
} catch (Exception ex) { ex.printStackTrace(); Log.e(getClass().getSimpleName(), ex.getMessage(), ex); } camera.takePicture(mShutterCallback, mPictureCallbackRaw, iccb); com.froogloid.android.gspot.Park.imageFileName = filename; } }); ``` It won't use the filename (...
[ 0.25081610679626465, -0.30284354090690613, 0.7018234729766846, -0.21684247255325317, 0.3279012441635132, 0.04709384962916374, 0.3952692151069641, -0.304776668548584, -0.11249254643917084, -0.22054345905780792, -0.22749227285385132, 0.5800738334655762, -0.6008387804031372, 0.162223145365715...
you had to do was change the fileoutput stream to the filename you want.
[ 0.14607921242713928, -0.1354523003101349, -0.1319507509469986, 0.2567303776741028, 0.09495794773101807, -0.043961722403764725, -0.1429665982723236, 0.17382679879665375, -0.36696621775627136, -0.6951392292976379, 0.27542299032211304, 0.5761758089065552, -0.0362362265586853, 0.49716442823410...
I am looking for the state.sql file provided by the .NET framework to run sessionstates in sqlserver mode. Where can I find the sql file to create the required tables and stored procs. I tried in the FRAMEWORKS/VERSION2.0 folder but I am unable to find it. This [article](http://www.dbazine.com/sql/sql-articles/cook9) h...
[ 0.6036091446876526, 0.4122542142868042, -0.020946387201547623, -0.3515375554561615, -0.216046541929245, -0.04912648722529411, 0.7069156765937805, -0.1000518724322319, 0.11274514347314835, -0.5553241968154907, 0.13964234292507172, 0.31756845116615295, -0.11571236699819565, 0.288810014724731...
In [this answer](https://stackoverflow.com/questions/452517/does-this-entity-repository-service-example-fit-into-domain-driven-design#452564) to a [recent question](https://stackoverflow.com/questions/452517), I was advised to > "be wary of making every property in your domain model have public getters and setters. Th...
[ 0.046622149646282196, -0.22230865061283112, 0.36659613251686096, 0.34612467885017395, -0.18533511459827423, -0.26854225993156433, -0.05530863255262375, -0.10977746546268463, -0.3038175702095032, -0.4023791551589966, -0.19056430459022522, 0.36391186714172363, -0.5546205043792725, 0.66753506...
Type GetBaseTypeGenericArgument(Type type) { return type.BaseType.GetGenericArguments()[0]; } ... GetBaseTypeGenericArgument(typeof(MyClass)); ```
[ 0.14408060908317566, 0.0894809290766716, 0.27217817306518555, -0.27551740407943726, 0.20847253501415253, -0.18352054059505463, 0.45620837807655334, -0.24640320241451263, 0.28422513604164124, -0.47380033135414124, -0.20638731122016907, 0.46377241611480713, -0.43711209297180176, 0.2112040072...
Anybody knows a good alternative to ID Selector since it's now RPX and at least for me, won't be good? thanks Check out [Open-selector](http://open-selector.com/). It was created as an alternative to ID Selector. From the documentation: > Open-selector is a piece of Javascript > code that will take your existing > ...
[ 0.6010798215866089, -0.21561361849308014, 0.07426441460847855, -0.018695751205086708, -0.39951661229133606, -0.3366759419441223, -0.10291653126478195, -0.21940961480140686, -0.2569875419139862, -0.9048810601234436, 0.014711187221109867, 0.3770236372947693, -0.3109835386276245, 0.2039451450...
I am using an application in c++ that uses a special dprintf function to print information, this is an example: ``` dprintf(verbose, "The value is: %d", i); ``` What is doing is when I define verbose for test purposes then I print the information and when I am working in normal execution I do not define it and I do ...
[ 0.22001363337039948, 0.19110684096813202, -0.11240946501493454, -0.07467569410800934, -0.020053917542099953, -0.18049989640712738, 0.4719969630241394, -0.19697584211826324, 0.0763232484459877, -0.5267301201820374, -0.1131422147154808, 0.4164639413356781, -0.3432616889476776, -0.09878274053...
few or many arguments were provided I've made a way that works using `boost::fusion`, which is given arguments in a type-safe way. It iterates over those arguments, printing out them when a `%` is encountered. If too few or too many arguments were given, an exception is thrown. There is one problem still: Variadic m...
[ -0.11711294949054718, 0.012568685226142406, 0.19051411747932434, -0.38998156785964966, 0.030706167221069336, 0.30907827615737915, 0.023366574198007584, -0.12370872497558594, 0.06114911288022995, -0.4161216914653778, 0.09485795348882675, 0.8308224678039551, -0.3687525987625122, -0.295161873...
to write ``` dprintf("name: %, value: %\n", "foo", 42); ``` Here is the code. The [`boost.fusion`](http://www.boost.org/doc/libs/1_37_0/libs/fusion/doc/html/index.html) provides more details for this: ``` #include <boost/fusion/include/sequence.hpp> #include <boost/fusion/include/make_vector.hpp> #include <boost/fu...
[ -0.01911959797143936, 0.2806650698184967, 0.5930689573287964, -0.5378003716468811, 0.1600514054298401, 0.21516531705856323, 0.07871902734041214, -0.654667854309082, -0.2740316092967987, -0.606270432472229, -0.40006130933761597, 0.467427521944046, -0.515104353427887, -0.20744378864765167, ...
{ throw std::invalid_argument("too many '%'"); } } else { std::cout << *b; } ++b; } } template<typename IterS, typename IterSeqB, typename IterSeqE> void print_vec(IterS b, IterS e, IterSeqB seqb, IterSeqE seqe) { while(b != e) {
[ 0.38623690605163574, 0.15294896066188812, 0.22763541340827942, -0.5265871286392212, 0.014870591461658478, 0.30996596813201904, 0.5122928619384766, -0.6709286570549011, 0.15694507956504822, -0.5549174547195435, -0.2855992615222931, 0.5842489004135132, -0.46119454503059387, 0.073217764496803...
if(*b == '%') { if(++b != e && *b == '%') { std::cout << '%'; } else { std::cout << *seqb; return print_vec(b, e, next(seqb), seqe);
[ -0.027607139199972153, 0.0370607003569603, 0.41342321038246155, -0.6880942583084106, 0.355024516582489, 0.38953229784965515, 0.3037222623825073, -0.3622458875179291, 0.3569999039173126, -0.6130591630935669, -0.7181826233863831, 0.660712718963623, -0.3044014275074005, 0.012344646267592907, ...
} } else { std::cout << *b; } ++b; } throw std::invalid_argument("too few '%'"); } template<typename Seq> void print_vec(std::string const& msg, Seq const& seq) { print_vec(msg.begin(), msg.end(), begin(seq), end(seq)); } #ifdef USE_VARIADIC_MACRO # ifdef DEBUG # de...
[ 0.3010433614253998, -0.15845440328121185, 0.5669412016868591, -0.4922231435775757, 0.1948937624692917, 0.3071490228176117, 0.29435503482818604, -0.656600832939148, 0.06510522961616516, -0.7092920541763306, -0.4379729926586151, 0.8475404977798462, -0.40481510758399963, 0.08792468160390854, ...
define dprintf(format, ...) # endif #else # ifdef DEBUG # define dprintf(format, args) \ print_vec(format, boost::fusion::make_vector args) # else # define dprintf(format, args) # endif #endif // test, using the compatible version. int main() { dprintf("hello %, i'm % years old\n", ("litb", 22...
[ 0.46539822220802307, 0.09517219662666321, 0.333173930644989, -0.44112229347229004, 0.5394492149353027, -0.04120238497853279, 0.16817574203014374, -0.21808265149593353, 0.07705069333314896, -0.5981239080429077, -0.16406536102294922, 0.19410447776317596, 0.0863977000117302, 0.404852181673049...
I am attempting to use boost::asio to read and write from a device on a serial port. Both boost::asio:read() and boost::asio::serial\_port::read\_some() block when there is nothing to read. Instead I would like to detect this condition and write a command to the port to kick-start the device. How can I either detect t...
[ 0.1165669783949852, 0.02359134703874588, 0.2885637581348419, -0.02127005159854889, 0.1851801872253418, -0.11226003617048264, 0.32648995518684387, 0.03595292568206787, -0.010945286601781845, -0.5388787984848022, -0.19433867931365967, 0.7928071618080139, -0.12862762808799744, -0.009823901578...
run into the situation where you are effectively "blocked", since neither of these will call the callback unless (1) data has been read or (2) an error occurs. To get around this, you'll want to use a `deadline_timer` object to set a timeout. If the timeout fires first, no data was available. Otherwise, you will have r...
[ 0.1699703186750412, -0.4359758496284485, -0.07839858531951904, 0.20237620174884796, 0.23243285715579987, -0.08160783350467682, 0.2257108837366104, -0.044290609657764435, -0.2858756184577942, -0.4257778227329254, 0.13187642395496368, 0.430437833070755, -0.3554760217666626, 0.154032200574874...
you know it's the race winner (and you should cancel the other call). In the place where you would have had your blocking call to `read_some`, you will now have a call to `io_svc.run()`. Your function will still block as before when it calls `run`, but this time you control the duration. Here's an example: ``` void f...
[ 0.13653713464736938, -0.3554365932941437, 0.4838837683200836, -0.21059469878673553, 0.12936796247959137, -0.005557720549404621, 0.12357362359762192, -0.13502486050128937, -0.20481429994106293, -0.30533793568611145, -0.12638850510120392, 0.6448665261268616, -0.2037031203508377, 0.2360957860...
boost::bind(&read_callback, boost::ref(data_available), boost::ref(timeout), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); timeout.expires_from_now(boost::posix_time::milliseconds(<<your_timeout_here>>)); timeout.async_wait(boost::bind(&wait_ca...
[ -0.3908621668815613, 0.04641522094607353, 0.9565341472625732, -0.4730958044528961, 0.2098107486963272, 0.13826441764831543, 0.2541549503803253, -0.693768322467804, -0.2797080874443054, -0.4897204339504242, -0.6959845423698425, 0.6180450916290283, -0.04344112426042557, 0.1625247597694397, ...
{ // No data was read! data_available = false; return; } timeout.cancel(); // will cause wait_callback to fire with an error data_available = true; } void wait_callback(serial_port& ser_port, const boost::system::error_code& error) { if (error) { // Data was read and this timeout was cancel...
[ 0.0893474891781807, -0.0020996518433094025, 0.45540159940719604, -0.08627598732709885, 0.25946319103240967, 0.06286938488483429, 0.5069091320037842, -0.47924935817718506, -0.48830217123031616, -0.41039523482322693, -0.38479748368263245, 0.8288127183914185, -0.31154677271842957, 0.387362629...
extra threads were necessary to handle callbacks. Everything is handled within the call to `run()`. Not sure if you were already aware of this...
[ 0.6522617936134338, -0.45969003438949585, 0.051041387021541595, 0.14975011348724365, 0.22844183444976807, -0.1614798605442047, 0.40485429763793945, -0.002837670734152198, -0.4520860016345978, -0.15407028794288635, -0.11497887223958969, 0.5168569684028625, -0.4282482862472534, 0.02193444781...
Hi I am looking for some web framework for my prject and I found [Visual WebGui](http://www.visualwebgui.com/) It looks amazing, but I am pesimistic to miracles :) Can someone more experienced than me help me? classic asp.net vs Visual WebGui * what about speed ? * what about size of data? * what about security? hav...
[ 0.20777319371700287, 0.35433584451675415, 0.191857248544693, 0.16018882393836975, -0.6861718893051147, -0.2219969481229782, 0.15504112839698792, 0.19026556611061096, -0.19260995090007782, -0.881755530834198, 0.378439724445343, 0.4444803297519684, -0.002065355656668544, 0.10451056063175201,...
did. 2. Size of Data you can see our show cases. <http://visualwebgui.com/Gizmox/Showcases/tabid/358/Default.aspx> 3. Security <http://visualwebgui.com/Gizmox/Technology/Security/tabid/624/Default.aspx> All this links are new info compared to when you asked your question i hope you find it effective. For more info you...
[ 0.842430055141449, 0.08552245050668716, 0.16100291907787323, 0.10723056644201279, -0.2315993458032608, -0.3688329756259918, 0.1463073194026947, -0.29589566588401794, -0.3335118889808655, -0.12967267632484436, 0.34424567222595215, 0.45631903409957886, 0.1425783485174179, 0.11539505422115326...
When using powershell, sometimes I want to only display for example the name or fullname of a file. From what I can gather, the way to do this is by using `Get-ItemProperty` (alias of `gp`) and passing `-n fullname`, For example ``` PS C:\Dev> gp . -n fullname ``` Notably I want to use this in longer scripts comb...
[ 0.15208815038204193, -0.06790174543857574, 0.7007520198822021, 0.14001984894275665, -0.05805490165948868, -0.17212720215320587, 0.17692409455776215, 0.03525294363498688, -0.18302595615386963, -1.02150559425354, -0.34130480885505676, 0.5154460668563843, -0.42636021971702576, 0.0237111523747...
: Microsoft.PowerShell.Core\FileSystem fullname : C:\Dev ``` My question is, how can I get powershell to **only display the property I want** (fullname) and not cruft the display up with all the other stuff. Is `Get-ItemProperty` even the right way to do this? ### Update: If I do this: ``` ls -r | ?{ $_.fullna...
[ 0.3133094906806946, 0.20460373163223267, 0.46725761890411377, -0.02156260423362255, 0.16221211850643158, -0.20056270062923431, 0.09439519792795181, -0.06453483551740646, -0.2116660326719284, -0.6207754015922546, -0.3926882743835449, 0.6823776364326477, -0.34422653913497925, 0.1703314483165...
is not the correct way to show those things, what is? There are many ways. I think you were looking for Get-ChildItem: PS > get-childitem x.txt | select fullname ``` FullName -------- C:\WINDOWS\system32\WindowsPowerShell\v1.0\x.txt PS > get-childitem x.txt | select name Name ---- x.txt ...
[ 0.08224473893642426, 0.08059556782245636, 0.6456860303878784, 0.22899185121059418, 0.16169975697994232, 0.22843624651432037, -0.13725820183753967, 0.08883974701166153, -0.06661006808280945, -0.5771863460540771, -0.2473093718290329, 0.3895035982131958, -0.22087785601615906, -0.0249016080051...
alias ft is also good to know about... ``` PS > gci x.txt | format-table -a fullname,length FullName Length -------- ------ C:\WINDOWS\system32\WindowsPowerShell\v1.0\x.txt
[ -0.08775783330202103, -0.3625776171684265, 0.7622649669647217, 0.03731873631477356, 0.01896575652062893, -0.16915380954742432, 0.13440972566604614, 0.11815506219863892, -0.17237597703933716, -0.5300295352935791, -0.0549418181180954, 0.5729547142982483, -0.1852300763130188, -0.1301540285348...
126 ``` Commonly used aliases for Get-ChildItem, are ls, dir, and gci. I'd go with gci, when in Rome.
[ 0.36487460136413574, 0.10260067880153656, 0.16739165782928467, 0.044858984649181366, 0.2989072799682617, 0.18646393716335297, -0.07795491814613342, 0.21979153156280518, 0.019041379913687706, -0.2802373468875885, -0.310344934463501, 0.2198682725429535, 0.006646671798080206, -0.0180510245263...
I'm working on an SConstruct build file for a project and I'm trying to update from Options to Variables, since Options is being deprecated. I don't understand how to use Variables though. I have 0 python experience which is probably contributing to this. For example, I have this: ``` opts = Variables() opts.Add('fcg...
[ 0.3598219156265259, -0.07410704344511032, 0.17493978142738342, -0.08756030350923538, 0.045117367058992386, -0.2174002081155777, 0.30303412675857544, -0.3518495261669159, -0.02292124554514885, -0.6348651647567749, 0.18958432972431183, 0.7854937314987183, -0.4363894462585449, -0.270070970058...
I'm going around in circles with regards to WCF and security so i'm just going to shove a load of questions here and hope someone can help me gain a clear picture. 1. Can someone please give me a plain English explanation of Transport vs Message level security. 2. I *think* I have a service running under SSL that wil...
[ 0.2431611716747284, -0.060465581715106964, 0.54111248254776, 0.3419691026210785, -0.15309183299541473, -0.35480454564094543, 0.5750043988227844, 0.1365920901298523, -0.34606435894966125, -0.6565164923667908, 0.03704129531979561, 0.3486228585243225, -0.1764662265777588, 0.14957475662231445,...
who's calling the service? 3. I have figured out how to turn tracing on and I can see my trace logs using "Microsoft Service Trace Log Viewer" but ill be damned if I can figure out what Im being displayed. Is there a decent resource explaining how to use this thing? 4. When using the "Certificate" clientCredentialType,...
[ 0.5993369221687317, -0.02230297215282917, 0.45751243829727173, 0.055518731474876404, -0.023346122354269028, -0.35088586807250977, 0.4033883213996887, -0.22962425649166107, -0.0448351614177227, -0.4728352725505829, 0.049915630370378494, 0.5651646852493286, -0.29965564608573914, 0.2284611016...
I can not implement custom username/password for this binding? I know these questions may seem stupid, but any help with clarification would really help. EDIT: 7. How can I add custom SOAP headers to my service in a similar manor to .asmx services? Is this a valid approach? EDIT: Further to the above questions I...
[ 0.6964015364646912, 0.19930459558963776, 0.3970414996147156, 0.1493774801492691, -0.29427382349967957, -0.3173147737979889, 0.5024604797363281, -0.292144238948822, -0.16366243362426758, -0.7369966506958008, 0.04548391327261925, 0.38240712881088257, -0.1334754079580307, 0.3381142020225525, ...
of WCF its: Transport level security only, and either none/certificate for the Client Credential Type. So it seems that CE's WCF wont allow this by default but could I securely send this information in the message (via the method signature) and would this be an acceptable way of sending this kind of information? I don'...
[ 0.3141755759716034, 0.20575547218322754, 0.8113519549369812, 0.09349410235881805, -0.0861864984035492, -0.6172325611114502, 0.3310820162296295, -0.3234744966030121, -0.3937217891216278, -0.6479887366294861, -0.16878412663936615, 0.4343777000904083, -0.2847045958042145, 0.2809620797634125, ...
isn't necessarily. Message security can for instance be used with HTTP while transport security would require the use of HTTPS (or other bindings). 2. IPrincipal principal = Thread.CurrentPrincipal; 3. no answer 4. Yes, although SSL itself uses certificates it's not the same. You can have the client send a certificate ...
[ 0.2444455772638321, -0.20466956496238708, 0.6135388612747192, 0.17006589472293854, -0.09964669495820999, -0.4792598783969879, 0.27559104561805725, 0.07542110234498978, -0.4458317160606384, -0.4753158986568451, -0.4081062376499176, 0.14842794835567474, -0.35223904252052307, 0.28523787856101...
intercepting the network packages. 5. IPrincipal principal = Thread.CurrentPrincipal; principal.Identity.Name; 6. No. * You have None, Transport, Message and Mixed security as your options however Transport security will require calling the endpoint using HTTPS since thats the secured version of the protocol * EDIT: ...
[ 0.11943426728248596, -0.3380490839481354, 0.47605034708976746, 0.16417376697063446, -0.11042720079421997, -0.27056676149368286, 0.36055538058280945, 0.1311561018228531, -0.21072204411029816, -0.42060089111328125, 0.11875579506158829, 0.42007607221603394, -0.5284296870231628, -0.02529996819...
I am new to programming so i figured i'd get help from those that know it. I am currently writing a Registration Application which will basically take a users input, validates the data entered, displays a review screen (which the user must print out and mail in a copy), and then save the info entered to a database. ...
[ 0.19977837800979614, -0.02814796008169651, 0.46987345814704895, -0.10040293633937836, 0.3202124238014221, -0.01932232454419136, 0.04683835804462433, -0.11236535012722015, 0.1680087447166443, -0.5893658995628357, -0.007230667397379875, 0.6522594690322876, 0.032193373888731, 0.34932789206504...
private string formerFirstName; private string formerMiddleName; private string formerSuffixtName; private string currentAddressNumber; private string currentAddressDirection; private string currentAddressStreet; private string currentAddressStreetType; private string currentAddressAptNum; priv...
[ -0.5376086831092834, -0.2128610610961914, 0.4320257902145386, -0.2853136956691742, 0.47728896141052246, 0.6117037534713745, -0.17310768365859985, -0.06482478231191635, -0.183503657579422, 0.05451013520359993, -0.7298774719238281, 0.3060278594493866, -0.19432005286216736, 0.6937456727027893...
private string formerAddressCounty; private string mailAddressLineOne; private string mailAddressLineTwo; private string mailAddressLineThree; private DateTime birthdate; private string gender; private string HomePhone; private string WorkPhone; private string CellPhone; private string ...
[ 0.1674356460571289, -0.026889953762292862, 0.26256445050239563, -0.2841847836971283, 0.27139440178871155, 0.3296627402305603, 0.2730480134487152, 0.18744532763957977, -0.05292683467268944, -0.3005276918411255, -0.43781694769859314, 0.5147951245307922, -0.32637453079223633, 0.30977612733840...
a class for each of them and have a Person own each of the classes or an Interface for the classes. i.e. ``` public interface IName { string getLastName(); string getFirstName(); string getMiddleName(); string getSuffixName(); } public class Name : IName { private string _lastName; private...
[ -0.1939530372619629, -0.43977904319763184, 0.01804179884493351, 0.09145870059728622, -0.10549049079418182, 0.2582535445690155, 0.33764901757240295, 0.03504451736807823, 0.15773631632328033, -0.9614357948303223, -0.39462947845458984, 0.4005796015262604, -0.4325019419193268, 0.64183217287063...
string getAddressNumber(); string getAddressDirection(); string getAddressStreet(); string getAddressStreetType(); string getAddressAptNum(); string getAddressCity(); string getAddressState(); string getAddressZipcode(); string getAddressCounty(); } public class Address : IAddress { ...
[ -0.19774767756462097, -0.10290185362100601, 0.2783004343509674, -0.31371158361434937, -0.0661403015255928, 0.06163864955306053, 0.5266197323799133, -0.1321735829114914, 0.13185952603816986, -0.5111225247383118, -0.8969886898994446, 0.6508157849311829, -0.5072377324104309, 0.064800150692462...
// Validation Methods // private Set Methods // public get methods //#region IAddress Members } public interface IPerson { int getId(); IName getCurrentName(); IName getFormerName(); IAddress getCurrentAddress(); IAddress getFormerAddress(); IAddress getMailingAddress(); DateT...
[ -0.08500921726226807, -0.4273909032344818, 0.6233060956001282, -0.1866261065006256, -0.13490255177021027, 0.12296458333730698, 0.5303288698196411, -0.270073801279068, -0.17064127326011658, -0.6532590389251709, -0.5629479289054871, 0.34909653663635254, -0.34447401762008667, 0.17274998128414...
string getHomePhone(); string getWorkPhone(); string getCellPhone(); string getFaxNumber(); string getEmailAddress(); string getSecondaryEmailAddress(); bool save(); void load(); } public class Person : IPerson { private int _id; private IName _currentName; private IName _form...
[ -0.1601014882326126, -0.31367000937461853, 0.23460520803928375, -0.2551424503326416, 0.38626450300216675, 0.5394036173820496, 0.3475736975669861, -0.06397447735071182, -0.23168621957302094, -0.48229551315307617, -0.5338501334190369, 0.39866572618484497, -0.2252342849969864, 0.4223920404911...
string _personType; private DateTime _registrationDate; private string _ipAddress; private string _browserInfo; private string _driversLicense; private string _homePhone; private string _workPhone; private string _cellPhone; private string _faxNumber; private string _emailAddress; ...
[ 0.02923748828470707, -0.22454838454723358, 0.583695650100708, -0.13355539739131927, 0.345340371131897, 0.24048440158367157, 0.3247780203819275, 0.05922934040427208, -0.13436171412467957, -0.6470484137535095, -0.5848709344863892, 0.42092055082321167, -0.22741779685020447, 0.4980546832084656...
DataLayer dl = new DataLayer(); if (_id == 0) return dl.insertPerson(this); else return dl.updatePerson(this); } } ``` Here's my datalayer insert method ``` public bool insertPerson(IPerson person) { bool inserted = false; SqlConnection cnDB = DatabaseConnection.Ge...
[ -0.14763720333576202, -0.2551148235797882, 0.8928149342536926, -0.048060089349746704, -0.11191124469041824, -0.12527239322662354, 0.05528060346841812, -0.3397844731807709, -0.13601264357566833, -0.4445243775844574, -0.23460134863853455, 0.5079538822174072, -0.3577883839607239, 0.3273440301...
cmDB.CommandType = CommandType.StoredProcedure; cmDB.Parameters.Add("@last_name", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@last_name"].Value = person.getCurrentName().getLastName(); cmDB.Parameters.Add("@first_name", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@firs...
[ -0.4632701575756073, -0.16940201818943024, 0.7448481917381287, 0.06715673953294754, 0.147754967212677, 0.3893011510372162, 0.16185589134693146, -0.36659157276153564, -0.3013327419757843, -0.6077761054039001, -0.6431122422218323, 0.2996384799480438, -0.010095912031829357, 0.4881759583950043...
cmDB = new SqlCommand("sp_InsertName", cnDB); cmDB.Parameters.Add("@person_id", System.Data.SqlDbType.Int); cmDB.Parameters["@person_id"].Value = id; cmDB.Parameters.Add("@last_name", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@last_name"].Value = person.getFormerName().getLast...
[ -0.4296388626098633, 0.011631960980594158, 0.8845939040184021, 0.033540643751621246, 0.047735795378685, 0.4454929530620575, 0.009444494731724262, -0.4003101885318756, -0.2420862317085266, -0.5319991111755371, -0.4316160976886749, 0.22050464153289795, 0.023446938022971153, 0.602420270442962...
cmDB.Parameters["@suffix_name"].Value = person.getFormerName().getSuffixName(); cmDB.ExecuteNonQuery(); // Insert Current Address cmDB = new SqlCommand("sp_InsertAddress", cnDB); cmDB.Parameters.Add("@person_id", System.Data.SqlDbType.Int); cmDB.Parameters["@person_id"].Value =...
[ -0.6269571185112, -0.008959824219346046, 0.9309542775154114, -0.07527533173561096, 0.06101096048951149, 0.44712698459625244, 0.048453543335199356, -0.47940579056739807, -0.348497599363327, -0.5961711406707764, -0.4007522165775299, 0.29017582535743713, 0.05008700117468834, 0.549367964267730...
cmDB.Parameters.Add("@address_street", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@address_street"].Value = person.getCurrentAddress().getAddressStreet(); cmDB.Parameters.Add("@address_street_type", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@address_street_type"].Value = per...
[ -0.3136357367038727, 0.08529114723205566, 0.6967219114303589, -0.023297978565096855, -0.09404225647449493, 0.5519968271255493, 0.2521846294403076, -0.5896925926208496, -0.3388194441795349, -0.7702413201332092, -0.5352873206138611, 0.31205469369888306, -0.18598058819770813, 0.35125660896301...
cmDB.Parameters.Add("@address_zipcode", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@address_zipcode"].Value = person.getCurrentAddress().getAddressZipcode(); cmDB.Parameters.Add("@address_county", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@address_county"].Value = person.get...
[ -0.4306790232658386, 0.06429081410169601, 0.7071872353553772, 0.01084896270185709, 0.16095228493213654, 0.36097052693367004, 0.10782870650291443, -0.5554459095001221, -0.30916354060173035, -0.5626463890075684, -0.48411837220191956, 0.22579817473888397, -0.09149651974439621, 0.3675795495510...
cmDB.Parameters["@address_number"].Value = person.getFormerAddress().getAddressNumber(); cmDB.Parameters.Add("@address_direction", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@address_direction"].Value = person.getFormerAddress().getAddressDirection(); cmDB.Parameters.Add("@address_stre...
[ -0.3066764175891876, -0.07375384867191315, 0.900406002998352, -0.0014493427006527781, -0.09937505424022675, 0.5089590549468994, 0.16139791905879974, -0.6020582914352417, -0.3429923355579376, -0.7223058342933655, -0.5158706307411194, 0.43685182929039, 0.002074422547593713, 0.384969890117645...
cmDB.Parameters["@address_city"].Value = person.getFormerAddress().getAddressCity(); cmDB.Parameters.Add("@address_state", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@address_state"].Value = person.getFormerAddress().getAddressCity(); cmDB.Parameters.Add("@address_zipcode", System.Data...
[ -0.3412536680698395, 0.03759007155895233, 0.7832072377204895, -0.061106421053409576, 0.066000796854496, 0.2938437759876251, 0.20435550808906555, -0.5106917023658752, -0.44775494933128357, -0.6793045401573181, -0.5247634649276733, 0.16032618284225464, -0.17005422711372375, 0.355887830257415...
cmDB.Parameters.Add("@person_id", System.Data.SqlDbType.Int); cmDB.Parameters["@person_id"].Value = id; cmDB.Parameters.Add("@address_number", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@address_number"].Value = person.getMailingAddress().getAddressNumber(); cmDB.Parameters.Add...
[ -0.2529240846633911, -0.0071479850448668, 0.6375488042831421, -0.11674446612596512, -0.15138281881809235, 0.5768730044364929, 0.26277288794517517, -0.6073265075683594, -0.3523012399673462, -0.7049251794815063, -0.4939480721950531, 0.43551820516586304, -0.188436821103096, 0.3939998149871826...
cmDB.Parameters.Add("@address_apt_number", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@address_apt_number"].Value = person.getMailingAddress().getAddressAptNum(); cmDB.Parameters.Add("@address_city", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@address_city"].Value = person.ge...
[ -0.290435791015625, 0.1014552041888237, 0.6391102075576782, -0.01972901076078415, -0.1559855341911316, 0.4409119486808777, 0.36785510182380676, -0.5849875211715698, -0.3497259318828583, -0.6786602139472961, -0.5974084138870239, 0.14541393518447876, -0.20797905325889587, 0.3814746141433716,...
cmDB.ExecuteNonQuery(); // insert Personal Info cmDB = new SqlCommand("sp_InsertPersonalInfo", cnDB); cmDB.Parameters.Add("@person_id", System.Data.SqlDbType.Int); cmDB.Parameters["@person_id"].Value = id; cmDB.Parameters.Add("@birthdate", System.Data.SqlDbType.DateTime); ...
[ 0.003309223335236311, -0.06679141521453857, 0.5607742071151733, 0.1094045341014862, 0.08215748518705368, 0.6270332336425781, 0.14338938891887665, -0.2758984863758087, -0.1681610345840454, -0.5191675424575806, -0.13449789583683014, 0.11137596517801285, -0.037901993840932846, 0.3558261692523...
cmDB.Parameters["@ss_number"].Value = person.getSSNumber(); cmDB.Parameters.Add("@person_type", System.Data.SqlDbType.VarChar, 20); cmDB.Parameters["@person_type"].Value = person.getPersonType(); cmDB.Parameters.Add("@registration_date", System.Data.SqlDbType.DateTime); cmDB.Parameters["...
[ -0.2588413953781128, -0.011643516831099987, 0.7912830114364624, 0.14315077662467957, -0.06480315327644348, 0.496386855840683, 0.014598216861486435, -0.4919758439064026, -0.2575380504131317, -0.5279883742332458, -0.3096601068973541, 0.36947986483573914, -0.2542504668235779, 0.41342130303382...
cmDB.Parameters["@drivers_license"].Value = person.getDriversLicense(); cmDB.ExecuteNonQuery(); //insert email address contact type cmDB = new SqlCommand("sp_InsertContactType", cnDB); cmDB.Parameters.Add("@person_id", System.Data.SqlDbType.Int); cmDB.Parameters["@person_id"].Va...
[ -0.27029111981391907, 0.14042682945728302, 0.641051173210144, -0.00983726792037487, -0.087279312312603, 0.6149601936340332, 0.04833242669701576, -0.37029334902763367, -0.1930626779794693, -0.5304365158081055, -0.20024359226226807, 0.4886624217033386, -0.3172353208065033, 0.2255389392375946...
cmDB.ExecuteNonQuery(); //insert secondary email address contact type cmDB = new SqlCommand("sp_InsertContactType", cnDB); cmDB.Parameters.Add("@person_id", System.Data.SqlDbType.Int); cmDB.Parameters["@person_id"].Value = id; cmDB.Parameters.Add("@contact_type", System.Data.Sql...
[ -0.30577197670936584, -0.006726476363837719, 0.5715634226799011, -0.0020310888066887856, -0.1287517249584198, 0.6454176306724548, 0.1994665414094925, -0.22604258358478546, -0.07538913935422897, -0.6105412840843201, -0.09126564115285873, 0.2922399640083313, -0.33499613404273987, 0.233412981...
//insert home phone contact type cmDB = new SqlCommand("sp_InsertContactType", cnDB); cmDB.Parameters.Add("@person_id", System.Data.SqlDbType.Int); cmDB.Parameters["@person_id"].Value = id; cmDB.Parameters.Add("@contact_type", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["...
[ 0.15060128271579742, 0.10682021826505661, 0.47046276926994324, -0.17253488302230835, 0.4037195146083832, 0.30785229802131653, -0.05748670920729637, -0.6565049290657043, -0.12676818668842316, -0.515664279460907, -0.21397088468074799, 0.8341466784477234, -0.3459697663784027, -0.0618067272007...
phone contact type cmDB = new SqlCommand("sp_InsertContactType", cnDB); cmDB.Parameters.Add("@person_id", System.Data.SqlDbType.Int); cmDB.Parameters["@person_id"].Value = id; cmDB.Parameters.Add("@contact_type", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@contact_type"...
[ -0.05818137526512146, 0.1682206690311432, 0.6899195313453674, -0.20775718986988068, 0.19816112518310547, 0.26632601022720337, -0.16404034197330475, -0.3783508539199829, -0.10662233829498291, -0.5187441110610962, -0.10247846692800522, 0.5281801223754883, -0.5549873113632202, 0.0303356554359...
cmDB = new SqlCommand("sp_InsertContactType", cnDB); cmDB.Parameters.Add("@person_id", System.Data.SqlDbType.Int); cmDB.Parameters["@person_id"].Value = id; cmDB.Parameters.Add("@contact_type", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@contact_type"].Value = "Cell Phone"; ...
[ -0.29456260800361633, 0.12371913343667984, 0.7771342396736145, -0.09563948214054108, 0.15625342726707458, 0.30456075072288513, 0.0064878747798502445, -0.48546603322029114, -0.2881234586238861, -0.5087587237358093, -0.21008844673633575, 0.48873794078826904, -0.42982688546180725, 0.207240864...
cmDB.Parameters.Add("@person_id", System.Data.SqlDbType.Int); cmDB.Parameters["@person_id"].Value = id; cmDB.Parameters.Add("@contact_type", System.Data.SqlDbType.VarChar, 50); cmDB.Parameters["@contact_type"].Value = "Fax Number"; cmDB.Parameters.Add("@contact", System.Data.SqlDbType.Va...
[ -0.12950491905212402, -0.13448704779148102, 0.6195216178894043, -0.24081099033355713, 0.09403753280639648, 0.27374184131622314, 0.12148169428110123, -0.644688069820404, -0.25406670570373535, -0.4478759467601776, -0.2464100867509842, 0.38870078325271606, -0.4345199763774872, 0.1531939953565...
Exception(GetSqlExceptionMessage(sqlEx.Number)); } catch (Exception ex) { throw ex; } finally { if (cnDB.State == ConnectionState.Open) cnDB.Close(); } return inserted; } ``` Edit: I feel this code will be extremely hard to maintain later on. Can anyone help...
[ 0.1128065213561058, 0.14846520125865936, 0.3578647971153259, -0.14986039698123932, 0.1282636523246765, -0.214028999209404, 0.3957793414592743, -0.006306456867605448, -0.36637651920318604, -0.47034725546836853, -0.08681923151016235, 0.4309684932231903, -0.27990034222602844, 0.27797317504882...
updating a record after it has been added. Thanks in advance for any help First if you want to simplify maintaneance, I would look at using an ORM to do the mapping. I'd look at nHibernate, Linq2Sql, Entity Framework or one of the other billion or so out there. It will remove a lot of noise from above. Second suggest...
[ 0.35381653904914856, 0.004485798999667168, 0.3884059488773346, 0.3575560450553894, -0.20540167391300201, -0.25790655612945557, -0.021941421553492546, 0.2131723314523697, -0.2824127972126007, -0.7593067288398743, 0.3231922686100006, 0.5317323803901672, -0.23537546396255493, 0.04547559469938...
I would move all of that out, and define a DTO, which would have two properties: ``` public class PersonDTO { public Person Current; Public Person Previous; } ``` I think this cleans up a lot of the noise. I also like to handle the multiple phone numbers using a dictionary essentially we have: ``` public cl...
[ 0.09393343329429626, -0.13352812826633453, 0.0448138453066349, 0.1830771565437317, -0.022782428190112114, 0.05071327090263367, -0.027121439576148987, 0.05164505913853645, -0.15422840416431427, -0.6781637668609619, -0.038588996976614, 0.34971901774406433, -0.30514779686927795, 0.08547550439...
in mind is Internaitonalization if this applies. Now on my person I would have a Dictionary, this allows you then to break your four inserts into a single loop as you loop over the phone dictionary. I would use a simillar model if you have a billing or ship to address. If you don't go with an ORM, one way to help ad...
[ 0.45799756050109863, 0.04756610840559006, 0.2976822555065155, -0.13662157952785492, 0.08148545771837234, 0.22919243574142456, -0.12614154815673828, -0.3397904634475708, -0.1132696270942688, -0.568013608455658, 0.24970389902591705, 0.3270222246646881, -0.3553294539451599, 0.0346736386418342...
{ using (SqlCommand sqlCmd=CreateNewCommand()) { AddPersonParams(p,sqlCmd); sqlCmd.ExecuteNonQuery(); } } public void UpdatePerson(Person p) { using (SqlCommand sqlCmd=CreateNewCommand()) { AddPersonParams(p,sqlCmd); //We add the I...
[ -0.24661217629909515, 0.01876802369952202, 0.513588011264801, -0.06657974421977997, 0.04212493821978569, 0.32283270359039307, -0.04928969964385033, -0.34457358717918396, -0.1527732014656067, -0.36586663126945496, -0.15120872855186462, 0.4005894064903259, -0.1722237914800644, -0.10333645343...
we have it in updates but not in inserts sqlCmd.AddParameter("@PersonId",p.Id); sqlCmd.ExecuteNonQuery(); } } private void AddPersonParams(Person p, Sqlcommand sqlCmd) { //Do all the code to add Params which exists in both insert and updates } } ``` Now what you've d...
[ 0.2417372763156891, 0.12295673042535782, 0.5797227621078491, 0.1324148327112198, 0.25372394919395447, 0.0876067578792572, 0.2215186208486557, -0.6442685723304749, -0.3283456563949585, -0.4644906222820282, -0.22310255467891693, 0.5105459094047546, -0.22833089530467987, -0.020530853420495987...
Parameters. One more thing to insert your current and previous address, you are not being DRY. You could do this: ``` private void InserAddress(Address address, int Id, AddressType addType) { } ``` Now from your insert Person routine you would call this method twice: ``` InsertAddress(p.CurrentAddress,id,Current...
[ 0.049000319093465805, -0.01937924697995186, 0.31473052501678467, -0.031109338626265526, 0.24639645218849182, 0.11298295110464096, 0.005226006731390953, -0.3084658086299896, 0.02595999836921692, -0.5043715834617615, -0.051520660519599915, 0.9857527017593384, -0.2541937530040741, 0.154871702...
I have changed the Treeview.HideSelection = false; But how do I insure that when focus is lost that the selected item remains the original selected color? EDIT: I have a listview on a form that holds a list of process events. Alongside the Treeview on the same form is a series of selections that the user completes t...
[ 0.3241158425807953, -0.08152268081903458, 0.2731481194496155, 0.057668305933475494, -0.12948983907699585, 0.03913430497050285, 0.32766398787498474, -0.22525839507579803, -0.4196107089519501, -0.6452695727348328, -0.034301675856113434, 0.2994003891944885, -0.13696768879890442, 0.17027983069...
the same color blue. Any suggestions. Update: ``` public partial class myTreeView : TreeView { TreeNode tn = null; public myTreeView() { InitializeComponent(); } protected override void OnAfterSelect(TreeViewEventArgs e) { if (tn != null) { tn.BackColor =...
[ 0.08042418211698532, -0.3429343104362488, 0.4210633337497711, -0.332529753446579, 0.3485144078731537, 0.10228036344051361, 0.45088016986846924, -0.17419953644275665, -0.10927306115627289, -0.617308497428894, -0.5184333324432373, 0.7239344716072083, -0.3160781264305115, 0.22041477262973785,...
} tn = e.Node; base.OnAfterSelect(e); } protected override void OnBeforeSelect(TreeViewCancelEventArgs e) { e.Node.BackColor = Color.Green; e.Node.ForeColor = Color.White; base.OnBeforeSelect(e); } protected override void OnGotFocus(System.EventArgs e) { ...
[ -0.29176631569862366, -0.6053991913795471, 0.37677764892578125, -0.11583314836025238, 0.7122341990470886, -0.14078955352306366, 0.6842783689498901, -0.29357582330703735, -0.28108856081962585, -0.6590692400932312, -0.7322269678115845, 0.7990977764129639, -0.36761707067489624, 0.135499373078...
override void OnLostFocus(System.EventArgs e) { if (tn != null) { tn.BackColor = Color.Green; tn.ForeColor = Color.White; } // tn.BackColor = Color.Red; base.OnLostFocus(e); } } ``` Setting `ListView.HideSelection` to true means that when focus ...
[ 0.26697444915771484, -0.5287249684333801, 0.342003732919693, -0.2661496102809906, 0.633786141872406, -0.11547202616930008, 0.5059706568717957, -0.32059937715530396, -0.07695668190717697, -0.39778849482536316, -0.6184442639350891, 0.9341341257095337, -0.3360552489757538, 0.20865656435489655...
By setting `HideSelection` to false, the selected item will still have the color indicator showing which item is selected.
[ 0.5832192301750183, -0.322224885225296, 0.0033950142096728086, 0.11096753180027008, 0.2907416522502899, -0.09665506333112717, 0.6115925312042236, -0.1332465261220932, 0.2569350302219391, -0.3290390372276306, -0.3497534394264221, 0.5256831645965576, -0.05978922173380852, 0.10555170476436615...
Is there any way to do the following in HQL: ``` SELECT case when flag = true then SUM(col1) else SUM(col2) FROM myTable ``` I guess you can ([3.6](http://docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/queryhql.html#queryhql-expressions), [4.3](https://docs.jboss.org/hibernate/orm/4.3/devguide/en-US/...
[ -0.1453665941953659, 0.05435071140527725, 0.6890451312065125, -0.23955769836902618, 0.06715060770511627, -0.1250232756137848, 0.31019237637519836, -0.3030739724636078, -0.2826445400714874, -0.48314177989959717, -0.41707247495651245, 0.5884400010108948, -0.09901075065135956, -0.234914794564...
In my Android application, when I rotate the device (slide out the keyboard) then my `Activity` is restarted (`onCreate` is called). Now, this is probably how it's supposed to be, but I do a lot of initial setting up in the `onCreate` method, so I need either: 1. Put all the initial setting up in another function so i...
[ 0.48228514194488525, 0.030351608991622925, 0.7959975004196167, -0.30157509446144104, 0.11453521996736526, 0.23876887559890747, 0.20126385986804962, 0.0221712626516819, -0.43992850184440613, -0.6791176795959473, 0.04069441929459572, 0.8587536215782166, -0.31207653880119324, -0.3172621130943...
initialization you could consider creating a new class that extends `Application` and moving your initialization code into an overridden `onCreate` method within that class. ``` public class MyApplicationClass extends Application { @Override public void onCreate() { super.onCreate(); // TODO Put your appli...
[ 0.016232511028647423, -0.07402534037828445, 0.20773233473300934, -0.1566196233034134, 0.42671212553977966, 0.07132741063833237, 0.17833401262760162, -0.22281646728515625, 0.023248570039868355, -0.7215473651885986, -0.527259349822998, 0.4958311915397644, -0.4324372410774231, 0.0312555171549...
getters and setters. *NOTE: You'll need to specify the name of your new Application class in the manifest for it to be registered and used:* ``` <application android:name="com.you.yourapp.MyApplicationClass" ``` **Reacting to Configuration Changes** *[UPDATE: this is deprecated since API 13; [see the recommende...
[ 0.1047179102897644, -0.36123567819595337, 0.7930592894554138, 0.11548728495836258, 0.13240529596805573, -0.02558479830622673, 0.34634411334991455, -0.1746135950088501, -0.287076473236084, -0.48368313908576965, -0.2154916226863861, 0.8323348164558411, -0.4999626576900482, -0.188727527856826...
level 13) and newer](https://stackoverflow.com/a/9550231/2291): ``` <activity android:name=".MyActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/app_name"> ``` Then within the Activity override the `onConfigurationChanged` method and call `setContentView` to f...
[ -0.09618113189935684, -0.11834575980901718, 1.0187832117080688, -0.1389525830745697, 0.33583933115005493, -0.0057481820695102215, 0.286599338054657, -0.4150683581829071, -0.4139195382595062, -0.8820529580116272, -0.5034562349319458, 0.7214565277099609, -0.40491819381713867, -0.044498808681...
``` NSMutableArray *a1 = [[NSMutableArray alloc] init]; NSMutableArray *a2 = [NSMutableArray array]; TempObj *obj = [[TempObj alloc] init]; //assume this line is repeated for each obj [a1 addObject:obj]; [a1 addObject:obj2]; [a1 addObject:obj3]; [a1 addObject:obj4]; [obj release]; [obj2 release]; [obj3 release]; [obj...
[ -0.2844834327697754, -0.08519555628299713, 0.40967199206352234, -0.35797932744026184, -0.027358243241906166, 0.21618598699569702, 0.5840577483177185, -0.19848968088626862, -0.5327120423316956, -0.32912418246269226, -0.3800549805164337, 0.37102654576301575, -0.6140447854995728, -0.054143063...