text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
String getColumnName(int col) {} } ``` Have you implemented the other methods for `TableModel`? If so, how does your implementation look? Maybe you should post your table model code to let us inspect it? BTW: My main error when implementing `TableModel` was to override `getRowCount()` and `getColumnCount()` to `retur...
[ -0.3581104278564453, -0.05331840366125107, 0.4577692747116089, -0.17707209289073944, -0.09825841337442398, -0.17314644157886505, 0.22127345204353333, -0.015887832269072533, -0.11777002364397049, -0.5205865502357483, -0.08746112138032913, 0.5039230585098267, -0.4736343324184418, -0.07000931...
optimize your model you should consider returning a fixed value for `getColumnCount()` if you have data that has the same number of columns every time. Then you can call the `fireTabeDataChanged()` which just loads the new data instead of completely building up the table and data (`fireTableStructureChanged()`) every t...
[ -0.08134012669324875, -0.30390703678131104, 0.5984688401222229, -0.030917800962924957, 0.18715524673461914, -0.014718309044837952, -0.03483046591281891, -0.5097066760063171, -0.3172004520893097, -0.4448252022266388, 0.0634806826710701, 0.9352503418922424, -0.34438908100128174, -0.398212939...
been searching for a quick example of sorting a IQueryable (Using Linq To SQL) using a Aggregate value. I basically need to calculate a few derived values (Percentage difference between two values etc) and sort the results by this. i.e. return rows.OrderBy(Function(s) CalcValue(s.Visitors, s.Clicks)) I want to call...
[ 0.0711308941245079, -0.06552261859178543, 0.45944592356681824, 0.27976706624031067, -0.33301106095314026, 0.17118050158023834, -0.2132991999387741, -0.29004645347595215, -0.30382323265075684, -0.3988162577152252, 0.13604338467121124, 0.3138689696788788, -0.37428539991378784, 0.346120059490...
Return yCPC - xCPC End Function End Class ``` LINQ to SQL doesn't like me using IComparer My solution: ``` Dim stats = rows.OrderBy(Function(s) If(s.Visitors > 0, s.Clicks / s.Visitors, 0)) ``` This also catches any divide by zero exceptions
[ -0.17640529572963715, -0.16358688473701477, 0.7483526468276978, 0.028759468346834183, 0.12871712446212769, -0.2710759937763214, -0.0006605494418181479, -0.07654590159654617, -0.15787605941295624, -0.3291109800338745, -0.07299522310495377, 0.37093493342399597, -0.4238457977771759, 0.4298032...
Im trying to access a web service from a remote computer. I managed to access the web service from the browser. But Im getting HTTP 403 when I try to call the web service from the application. Any idea why? A [403](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4) response indicates that the host or so...
[ 0.21015697717666626, 0.24688898026943207, 0.5260050892829895, 0.023570174351334572, -0.02648153342306614, -0.08044382929801941, 0.5174404382705688, -0.15601132810115814, -0.27864018082618713, -0.5452174544334412, -0.2792598009109497, 0.30565422773361206, -0.46180152893066406, 0.37031200528...
banned/disabled * The user-agent or some other header in your request is causing the service to reject the connection. Perhaps a missing header?
[ 0.5968968272209167, -0.11631334573030472, 0.02334362082183361, 0.09587285667657852, -0.10305576771497726, -0.041148219257593155, 0.3561546802520752, 0.11576344072818756, -0.5700295567512512, -0.256595641374588, -0.3345414400100708, 0.10420569032430649, -0.4254312515258789, 0.40416806936264...
I have a button on a website that creates a directory and copys a file. I developed it using Visual Studio 2008, ASP.Net 3.5. I am running Vista as my OS. The website uses identiy impersonation. The functionality doesn't work ("Access to Path XYZ is denied") when: * I run the website via IE hitting the local webserve...
[ 0.11172565072774887, 0.10680775344371796, 0.5972050428390503, -0.1349598467350006, -0.07008634507656097, -0.20360738039016724, 0.3340546488761902, -0.19371572136878967, -0.08852867782115936, -0.9070167541503906, 0.0020789599511772394, 0.6817376017570496, -0.3644022047519684, -0.02279003150...
website onto another webserver (also vista/IIS7) * I modify FireFox to accept integrated authentication, then access via FireFox and localhost I've never seen this behavior before, previously File.Copy type commands only cared that the rights on the folder being copied to were valid etc... (I have Everyone having full...
[ 0.48609477281570435, 0.10602006316184998, 0.5804566740989685, 0.17016220092773438, -0.004541847854852676, -0.633002519607544, 0.5169525742530823, 0.030901599675416946, -0.1974993497133255, -0.8716638088226318, -0.16958336532115936, 0.5052586793899536, -0.3479471206665039, -0.03303694725036...
my own machine? Seems very odd, any help would be appreciated. **EDIT**: I've added "Everyone" to all of the relvant directories and give that user Full Control, so there shouldn't be any permission issues? OK I have tracked down the solution to this issue given these symptoms. I'm not 100% sure why this works (partic...
[ 0.42198291420936584, 0.1415010392665863, 0.4535897970199585, -0.058600179851055145, 0.023197272792458534, -0.00009841179416980594, 0.5348150730133057, -0.033914774656295776, -0.2587663233280182, -0.8903518915176392, -0.251343697309494, 0.7092010974884033, -0.21770831942558289, -0.094152286...
you to use the website locally. Why you need to do this in IE when connecting locally and not in FireFox or IE when connecting to another machine is something I don't know. But it does seem to be a viable workaround.
[ 0.28260722756385803, 0.16175420582294464, 0.1433373987674713, 0.11643877625465393, -0.18514379858970642, -0.2537752091884613, 0.23500436544418335, 0.40836814045906067, -0.16606518626213074, -1.0636463165283203, 0.03668447956442833, 0.515739381313324, -0.0940147116780281, 0.0271262545138597...
Is it possible to inherit from both ViewPage and ViewPage<T>?? Or do I have to implement both. Currently this is what I have for ViewPage. Do i need to repeat myself and do the same for ViewPage<T>?? ``` public class BaseViewPage : ViewPage { public bool LoggedIn { get {
[ 0.4644413888454437, -0.10498786717653275, 0.2917919158935547, -0.10815614461898804, 0.14833931624889374, -0.3710634410381317, 0.12425412237644196, -0.13152047991752625, -0.04760025069117546, -0.5839947462081909, -0.03138982877135277, 0.7425727248191833, -0.23169761896133423, 0.185007452964...
if (ViewContext.Controller is BaseController) return ((BaseController)ViewContext.Controller).LoggedOn; else return false; } } } ``` Create both versions: ``` public class BaseViewPage : ViewPage {
[ 0.029626844450831413, -0.4544403553009033, 0.6031636595726013, 0.15127183496952057, 0.1728217601776123, -0.10084895044565201, 0.10549654811620712, -0.16793067753314972, -0.3150242567062378, -0.7184932231903076, -0.2357841581106186, 0.48905709385871887, -0.39851880073547363, 0.2536031603813...
// put your custom code here } public class BaseViewPage<TModel> : BaseViewPage where TModel : class { // code borrowed from MVC source private ViewDataDictionary<TModel> _viewData; [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] pub...
[ 0.35176950693130493, -0.3558395802974701, 0.49299582839012146, 0.004136876203119755, 0.13091722130775452, 0.2183598130941391, 0.3714219927787781, -0.4945163428783417, -0.3183535635471344, -0.7337000370025635, -0.21765944361686707, 0.4870774745941162, -0.1399131417274475, 0.1468239873647689...
return _viewData; } set { SetViewData(value); } } protected override void SetViewData(ViewDataDictionary viewData) { _viewData = new ViewDataDictionary<TModel>(viewData); base.SetViewData(_viewData); } } ``` then ``` public class MyCustomView : BaseV...
[ 0.25766271352767944, -0.3138686418533325, 0.7610621452331543, -0.22284311056137085, 0.273627907037735, -0.01540432870388031, 0.34200966358184814, -0.3567425608634949, -0.05666916072368622, -0.5814189910888672, -0.5377872586250305, 0.7416428923606873, -0.36313727498054504, 0.121478267014026...
I have a static library \*.lib created using MSVC on windows. The size of library is say 70KB. Then I have an application which links this library. But now the size of the final executable (\*.exe) is 29KB, less than the library. What i want to know is : 1. Since the library is statically linked, I was thinking it sho...
[ 0.006614523008465767, 0.06933460384607315, 0.31930339336395264, -0.038984961807727814, -0.10623855888843536, 0.07420151680707932, 0.06336157023906708, 0.00369167304597795, -0.3759666085243225, -0.7202500700950623, -0.10904308408498764, 0.36952438950538635, -0.4032876491546631, 0.2740982770...
library on linux (\*.a/\*.la file) relate with size of linux executable (\*.out) ? -AD There is additional bookkeeping information in the `.lib` file that is not needed for the final executable. This information helps the linker find the code to actually link. Also, debug information may be stored in the `.lib` file b...
[ 0.1627429872751236, 0.03411417827010155, 0.19187115132808685, 0.25816968083381653, 0.12173137813806534, -0.20146849751472473, -0.04645610228180885, 0.10450832545757294, -0.2254754900932312, -0.7251789569854736, -0.20780698955059052, 0.3259599506855011, -0.31535109877586365, 0.2384419590234...
I am creating a pdf document using C# code in my process. I need to protect the docuemnt with some standard password like "123456" or some account number. I need to do this without any reference dlls like pdf writer. I am generating the PDF file using SQL Reporting services reports. Is there are easiest way. > I am...
[ 0.22720855474472046, 0.14699502289295197, 0.3078499436378479, 0.3590644896030426, -0.2586057186126709, -0.26087161898612976, 0.06974051147699356, -0.39883434772491455, -0.04369939863681793, -0.34399840235710144, -0.09592845290899277, 0.6594359874725342, -0.22424425184726715, 0.020218735560...
encrypting your pdf files with the free and open source [itextsharp](http://itextsharp.sourceforge.net/) library is quite easy: ``` using (Stream input = new FileStream("test.pdf", FileMode.Open, FileAccess.Read, FileShare.Read)) using (Stream output = new FileStream("test_encrypted.pdf", FileMode.Create, FileAccess.W...
[ 0.06017255038022995, -0.07569073140621185, 0.6217425465583801, 0.23806585371494293, -0.1812855452299118, -0.3668116629123688, 0.13593652844429016, -0.3034016788005829, -0.13050977885723114, -0.8762237429618835, -0.5419239401817322, 0.7893542647361755, -0.20170161128044128, 0.17215777933597...
I'm using ADO.NET EF in an MVC application. I'm considering putting the ObjectContext inside HttpContext.Current so that all logic in the same request can access to it without having to open/destroy each time. However, I'm really sure if it's a good way to manage ObjectContext instances. I have 2 questions regarding th...
[ 0.22980090975761414, -0.1374494582414627, 0.4067714512348175, -0.086827851831913, -0.27651554346084595, -0.15279556810855865, 0.03367827460169792, -0.40291377902030945, -0.19962731003761292, -0.6397648453712463, 0.21268095076084137, 0.4209677577018738, -0.3793955445289612, 0.35152554512023...
do you think ObjectContext should be managed in ASP.NET MVC to both avoid lots of opening/disposing and prevent race conditions? I agree with Todd - use DI/IoC cotnainer (Unity, Windsor) with per-thread (or custom per-request) lifetime. Ad 2, as I remember, in Linq to SQL, DataContext object was considered a lightweig...
[ -0.06066068634390831, -0.059392400085926056, 0.2841647267341614, 0.20740702748298645, -0.20018455386161804, -0.5080638527870178, -0.05908771976828575, -0.06063694506883621, -0.18121133744716644, -0.5058261752128601, 0.035335052758455276, 0.4590705931186676, -0.2636820375919342, -0.04267287...
I have a client and server program (both in Obj-C) and I am transferring files between two devices using the programs. The transferring is working fine, but I would like to display to the user what transfer rate they are getting. So I know the total size of the file, and how much of the file has been transferred, is ...
[ 0.2480909824371338, 0.16693396866321564, 0.47612252831459045, 0.29125335812568665, 0.20220676064491272, -0.0011251297546550632, -0.08740570396184921, 0.27603933215141296, -0.38270503282546997, -0.7645378112792969, 0.07951853424310684, 0.5336679220199585, 0.14090058207511902, 0.358925640583...
time". Then, all you need to do to calculate transfer speed at any point during the transfer is to look at the system time again and use it as the "current time" to calculate the total time spent so far: ``` transfer_speed = bytes_transferred / ( current_time - start_time) ``` You probably want to use second or mill...
[ -0.09143180400133133, -0.0043313829228281975, 0.5932213068008423, 0.055007144808769226, 0.16070154309272766, 0.009755885228514671, 0.04647006466984749, -0.1611110121011734, -0.471786230802536, -0.9778051972389221, -0.042720306664705276, 0.4364212155342102, 0.08847794681787491, 0.2635825276...
the transfer rate by using: ``` double speed = bytesTransferred / ([NSDate timeIntervalSinceReferenceDate] - start); ```
[ 0.00894985068589449, -0.18337734043598175, 0.41329261660575867, 0.19954609870910645, 0.1607491821050644, 0.22412289679050446, 0.010408763773739338, -0.20747268199920654, -0.18241137266159058, -0.6586143374443054, -0.21462900936603546, 0.44738492369651794, 0.04608026519417763, 0.35755079984...
I fail to understand why this code won't compile ``` ExecutorService executor = new ScheduledThreadPoolExecutor(threads); class DocFeeder implements Callable<Boolean> {....} ... List<DocFeeder> list = new LinkedList<DocFeeder>(); list.add(new DocFeeder(1)); ... executor.invokeAll(list); ``` The error msg is: ``...
[ -0.2521970272064209, -0.19869713485240936, 0.4949834644794464, -0.21576112508773804, -0.06515567749738693, -0.19992627203464508, 0.4261839985847473, -0.40389472246170044, -0.13026078045368195, -0.4215606451034546, -0.08551577478647232, 0.47012436389923096, -0.6287117004394531, 0.3764120340...
`Collection<Callable<T>>`. Consider what would happen with this method: ``` public void addSomething(Collection<Callable<Boolean>> collection) { collection.add(new SomeCallable<Boolean>()); } ``` That's legal - but it's clearly bad if you can call `addSomething` with a `List<DocFeeder>` as it will try to add a n...
[ 0.3431900143623352, -0.03332045301795006, 0.30476874113082886, -0.27158305048942566, -0.06529022008180618, -0.23544462025165558, 0.16008606553077698, -0.6458628177642822, -0.41885507106781006, -0.41329848766326904, -0.1949824094772339, 0.4770105481147766, -0.5932320952415466, 0.22691419720...
Apologies for the long post, but I wonder if I could get some more eyeballs on this before I submit a bug report to Sun. JVM: 6u11 O/S: Windows XP SP3 Hardware: AMD Athlon 64 X2 4600+ @ 2.41GHz, with 3.25 GB RAM. I believe I have encountered a fault in the JVM where no thread is given a monitor. In the followin...
[ 0.15368390083312988, 0.5707929730415344, 0.4640934467315674, -0.035775814205408096, -0.004749846179038286, -0.022017812356352806, 0.3180253803730011, 0.2827535569667816, -0.29661908745765686, -0.6168516278266907, -0.2534223198890686, 0.6271547675132751, -0.07346571236848831, 0.291650444269...
promise the thread dump is complete for every thread which refers to monitor `<0x12a8f9f8>`. The dump was obtained using Java VisualVM, three times over a period of 16 hours, and shown to be consistent each time (these threads were unchanged). Does anyone disagree with my assessment that the JVM is failing to deliver ...
[ 0.4388757050037384, -0.2020658701658249, 0.4794512391090393, 0.032151300460100174, 0.332806259393692, -0.14618173241615295, 0.6686245799064636, -0.3516026437282562, 0.049497608095407486, -0.5384781956672668, -0.03007552959024906, 0.6022125482559204, -0.19805456697940826, -0.159094884991645...
locked <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender) at com.companyremoved.ioc.IsolatedObject.waitWithinMessage(IsolatedObject.java:352) - locked <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender) at com.companyremoved.system.coms.ComsSender.waitForAvailablePipe(ComsSender.java:219) ...
[ -0.21537145972251892, 0.13411377370357513, -0.0366789810359478, -0.031924087554216385, 0.03484763205051422, 0.5023030638694763, 0.5310266017913818, -0.41892150044441223, -0.5699279308319092, -0.3726637661457062, -0.3485344648361206, 0.2471589595079422, -0.4072558879852295, 0.28073975443840...
Locked ownable synchronizers: - None "ScbPipe Writer" daemon prio=6 tid=0x4fff0c00 nid=0xf14 waiting for monitor entry [0x0594f000..0x0594fc14] java.lang.Thread.State: BLOCKED (on object monitor) at com.companyremoved.ioc.IsolatedObject.deliver(IsolatedObject.java:293) - waiting to lock <0x12a8f9f8> (a ...
[ -0.4666067659854889, 0.3860451877117157, 0.20115382969379425, 0.08892218768596649, 0.04409734904766083, 0.14896762371063232, 0.4560082256793976, -0.34286734461784363, -0.25053611397743225, -0.34505555033683777, -0.11885944753885269, 0.2830658555030823, -0.23420490324497223, 0.0904297605156...
waiting for monitor entry [0x059ef000..0x059efb94] java.lang.Thread.State: BLOCKED (on object monitor) at com.companyremoved.ioc.IsolatedObject.deliver(IsolatedObject.java:293) - waiting to lock <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender) at com.companyremoved.ioc.IsolatedObject.iocMessage...
[ -0.13729190826416016, -0.28487157821655273, 0.5289803147315979, 0.05490488559007645, 0.23450875282287598, 0.2754402756690979, 0.38082677125930786, -0.04144684225320816, -0.4901755154132843, -0.48743677139282227, -0.19683657586574554, 0.21735358238220215, -0.54563307762146, 0.22036425769329...
at com.companyremoved.ioc.IsolatedObject.deliver(IsolatedObject.java:293) - waiting to lock <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender) at com.companyremoved.ioc.IsolatedObject.iocMessage(IsolatedObject.java:265) at com.companyremoved.ioc.IocTarget.iocMessage(IocTarget.java:138) at com.co...
[ -0.4083016514778137, -0.019389111548662186, 0.1032947301864624, 0.020722899585962296, 0.12356259673833847, 0.14935678243637085, 0.5691120028495789, -0.19604963064193726, -0.47125953435897827, -0.4344222843647003, -0.38201668858528137, 0.2459782212972641, -0.620094358921051, 0.1786629259586...
at com.companyremoved.ioc.IsolatedObject.iocMessage(IsolatedObject.java:265) at com.companyremoved.ioc.IocTarget.iocMessage(IocTarget.java:138) at com.companyremoved.ioc.IocBinding.iocMessage(IocBinding.java:105) at com.companyremoved.system.coms.ComsSender$Messages.removePipe(ComsSender.java:302) at co...
[ -0.1471947282552719, 0.33527541160583496, 0.26797598600387573, -0.24008342623710632, 0.045147135853767395, 0.33433109521865845, 0.6542829275131226, -0.33506155014038086, -0.5487790703773499, -0.7353441119194031, -0.219436913728714, 0.366167277097702, -0.3723641037940979, 0.0376312099397182...
with agree that a JVM fault is clearly indicated, as do the programmers at jProfiler (ej-technologies).
[ 0.2732658088207245, 0.39573267102241516, 0.12032178789377213, -0.059206485748291016, -0.3901880085468292, -0.22613093256950378, 0.20749276876449585, -0.1702873557806015, -0.06460922956466675, -0.14556489884853363, -0.24754105508327484, 0.49546486139297485, 0.31257307529449463, 0.0631321892...
I have a job to enter survey results (in paper form) to excel. I've never written any macro in Office :( Here I what I basically need: 1. I have predefined columns (|A|B|...|AG|AH|) 2. All surveys are grouped into groups. All surveys from same group have few (like predefined) same columns. It's always same columns th...
[ -0.059996481984853745, 0.37364643812179565, 0.41944679617881775, -0.19668351113796234, -0.16677261888980865, 0.41440269351005554, -0.03270070627331734, -0.31630659103393555, -0.19742169976234436, -0.5465203523635864, 0.0847880095243454, 0.19967636466026306, -0.24360522627830505, -0.2962217...
1, |D| = 5, |F| = 7, |G| = 5, and automatically start entering next row. Anything that will give me a clue how to write this macro in more than welcome Huge thanks for reading this... EDIT1: I suppose question is not clear enough... I need macro that will read my keyboard input ( '1575' ) and write integers '1' '5'...
[ -0.16475750505924225, -0.0405607596039772, 0.7409390807151794, -0.2807951867580414, 0.07655254006385803, 0.13973216712474823, -0.13758137822151184, -0.20504134893417358, -0.23584730923175812, -0.8404805660247803, -0.05777119845151901, 0.800885796546936, -0.18946632742881775, -0.24996352195...
the time... It seems to me you need a small userform with just a textbox, a range to show the order of data entry, say: Group A | E | D | F | G And a little code to go with the form, say: ``` Dim LastCol As Integer Dim CurRow As Integer Private Sub UpdateCells() Dim Col As Variant Dim ColumnOrder As Range 'Range t...
[ -0.33233460783958435, -0.2626953721046448, 1.0295181274414062, -0.18021032214164734, -0.2102108895778656, -0.1372048258781433, 0.07426812499761581, -0.5051475763320923, -0.21419626474380493, -0.29887235164642334, -0.4368029236793518, 0.5013752579689026, -0.3013353645801544, 0.0554286204278...
As MSForms.ReturnInteger, ByVal Shift As Integer) If KeyCode = 13 Then UpdateCells End If End Sub Private Sub UserForm_Initialize() CurRow = ActiveCell.Row End Sub ``` Edit Re Comment In Excel, the last row can be a bit tricky in that Excel does not update the range after deletions until the workbook is saved. ...
[ -0.06767208874225616, 0.011526179499924183, 0.9885240197181702, -0.1668306291103363, 0.081746906042099, -0.07585310935974121, 0.3097189664840698, -0.5231861472129822, -0.13649417459964752, -0.5206267833709717, -0.511787474155426, 0.5097615122795105, -0.21615993976593018, -0.029849022626876...
What good-practice-indicating idioms do you look for in a sequence of method invocations, as depicted on sequence diagrams? Look for the telltale central controller. A well-factored system will tend to have an even allocation of responsibilities among the classes. A poorly factored system instead tends to have a sequen...
[ 0.237204909324646, -0.03890174999833107, -0.13636545836925507, 0.569434404373169, -0.27557605504989624, -0.23540763556957245, 0.2475467175245285, 0.27931416034698486, -0.26416048407554626, -0.5850074291229248, -0.20828470587730408, -0.06648121774196625, -0.19852516055107117, 0.007093143183...
Requirements: * Must be able to use C strings as well as C++ strings * Fast * No maps * No templates * No direct lookup, i.e. index might be out of bounds. * Index is not consecutive * Enums and strings contained in one header file * Only instantiate what you use. This is what I have come up with so far: ``` - test....
[ 0.11609244346618652, -0.12481538951396942, 0.106032595038414, 0.11055179685354233, -0.07991482317447662, -0.46757426857948303, 0.08697538077831268, -0.531438946723938, -0.12015502154827118, -0.8765900135040283, -0.15401683747768402, 0.6517817974090576, -0.37158238887786865, -0.098850645124...
const char *pStr; }; // Status enum State_t { Running = 1, Jumping = 6, Singing = 12 }; struct State_s { static const Mapper_s *GetpMap(void) { static Mapper_s Map[] = { { Running, "Running" }, { Jumping, "Jumping" }, { Singing, "Singing" },
[ -0.15599550306797028, -0.4208325743675232, 0.11385435611009598, -0.15922167897224426, 0.1782223880290985, 0.408881813287735, 0.725401759147644, -0.10459265112876892, -0.23849532008171082, -0.36465510725975037, -0.44795671105384827, 0.46402060985565186, -0.19162622094154358, -0.050030596554...
{ 0, 0} }; return Map; }; }; - test.cc - // This is a generic function const char *MapEnum2Str(int Idx, const Mapper_s *pMap) { int i; static const char UnknownStr[] = "Unknown"; for (i = 0; pMap[i].pStr != 0; i++) { if (Idx == pMap[i].Idx) {
[ -0.13796637952327728, -0.1905413269996643, 0.4749375581741333, 0.03613597899675369, 0.22029957175254822, 0.08449007570743561, 0.21732637286186218, -0.4584141969680786, -0.17761586606502533, -0.5398394465446472, -0.1850915551185608, 0.19429917633533478, -0.372342973947525, 0.286456078290939...
return pMap[i].pStr; } } return UnknownStr; } int main() { cout << "State: " << MapEnum2Str(State, State_s::GetpMap()) << endl; return 0; } ``` Any suggestions on how to improve this ? I feel that the header file looks slightly cluttered... Here is what I settled on. Using this technique all...
[ 0.143111914396286, 0.012319912202656269, 0.47940078377723694, 0.09200330823659897, 0.2752901613712311, -0.20656853914260864, 0.31657674908638, -0.6078882217407227, -0.314126193523407, -0.40063944458961487, -0.07470355927944183, 0.5158365964889526, -0.35090625286102295, 0.15774312615394592,...
pStr. This approach does not work in C. file: e2str.hh ``` struct Mapper_s { int Idx; const char *pStr; }; #define ENUM2STR_BEGIN(x) struct x { static const Mapper_s *GetpMap(void) { static const Enum2StrMap_s Map[] = #define ENUM2STR_END return Map; }; } const char *MapEnum2Str(int Idx, const Mapper...
[ -0.07131484895944595, -0.28343304991722107, 0.5145877599716187, 0.13195978105068207, 0.04577226564288139, 0.10259781032800674, 0.6003059148788452, -0.2951423227787018, -0.4699956476688385, -0.7397353649139404, -0.6321955323219299, 0.41844335198402405, -0.35151851177215576, -0.3479768037796...
{ 0, 0} }; ENUM2STR_END; ``` file: test.cc ``` #include "mapper.hh" int main() { cout << "State: " << MapEnum2Str(State, State_s::GetpMap()) << endl; return 0; } ```
[ -0.07091787457466125, 0.007327706087380648, 0.40847423672676086, -0.060927193611860275, 0.4147461950778961, -0.16742007434368134, 0.3273795545101166, -0.21685756742954254, -0.17143432796001434, -0.6490303874015808, -0.4699811339378357, 0.3046984076499939, -0.24343490600585938, 0.3833474218...
My master page has a contentplaceholder in the head tag. Because I want my page's title to represent the function of the current page and because I want the title to be translated in the user's language I have added a title tag in the page's head's contentplaceholder. All jolly and good except that now there appears a...
[ 0.3471420109272003, -0.037243280559778214, 0.7605643272399902, 0.4076922535896301, 0.03311743587255478, -0.31657493114471436, 0.08715487271547318, -0.03514403849840164, -0.25495848059654236, -0.5564143657684326, 0.11126933246850967, 0.2911483347415924, -0.12557776272296906, 0.1351374983787...
the head, put a runat="server" attribute inside it and then set it's visibility to false: ``` <title visible="false" runat="server"><%-- hack to turn the auto title off --%></title> ```
[ -0.11466120183467865, 0.133738711476326, 0.7150721549987793, 0.01748896762728691, 0.2161567211151123, -0.15428884327411652, 0.10081794112920761, 0.023386800661683083, 0.2570275068283081, -0.29572367668151855, -0.15818919241428375, 0.5947113633155823, -0.10461365431547165, 0.427789747714996...
I have an application written in Delphi 7 which does not require an admin privilages to run. For some reason I am able to save files to c:\windows and c:\windows\system32 from within the application even though the application **has not requested UAC elevation**. I am logged in as an admin with **UAC turned on** and ...
[ 0.4851461350917816, 0.26772570610046387, 0.40647637844085693, -0.1430882215499878, 0.19035610556602478, -0.21486018598079681, 0.519756019115448, 0.29308223724365234, -0.06854242831468582, -1.0398876667022705, -0.13362084329128265, 0.8117742538452148, -0.15496008098125458, 0.307000756263732...
as expected. Any ideas what is going on? Th application is using Ole Structured Storage to save and includes the following manifest, if that helps. ``` <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity type="win...
[ 0.095061294734478, 0.035943761467933655, 0.39538323879241943, 0.11419045180082321, 0.21799656748771667, 0.06004158779978752, -0.006082961801439524, -0.10431671887636185, -0.32182249426841736, -0.8140704035758972, -0.059228163212537766, 0.5566458702087402, -0.12785883247852325, -0.042340353...
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
[ -0.08241323381662369, 0.03385473042726517, 0.2749372124671936, -0.027055947110056877, -0.004383211489766836, -0.00897147785872221, 0.6562774777412415, -0.35031846165657043, -0.011774690821766853, -0.37593936920166016, -0.20486940443515778, 0.3792048990726471, 0.20842032134532928, 0.2838230...
</requestedPrivileges> </security> </trustInfo> </assembly> ``` Edit: To be clear my application does not save anything to these locations by default. I am choosing these locations via the standard file save dialog. **Update** I have found out why my application was being treated as legacy despite ...
[ 0.4987669289112091, 0.08914021402597427, 0.17508389055728912, 0.06818068027496338, 0.44187620282173157, -0.16963814198970795, 0.3326943814754486, 0.10790091007947922, -0.45996737480163574, -0.6903147101402283, -0.09369160234928131, 0.25180983543395996, -0.1051071286201477, 0.31070864200592...
is well now. Thanks for all the help This is a feature of UAC to make old applications compatible with Vista. It redirects any request to write to a system folder that the user lacks permission to a local folder. They are stored under "AppData\Local\VirtualStore" folder under the current user's profile. There is a gr...
[ 0.08826589584350586, 0.22467249631881714, 0.6765235066413879, -0.04961676150560379, 0.39602014422416687, -0.3955513536930084, 0.5241377353668213, -0.10555875301361084, -0.17739111185073853, -0.7763740420341492, -0.007971472106873989, 0.6936241984367371, -0.08834663033485413, 0.468538939952...
provider a Vista manifest to decorate your application as Vista-compatible, this virtualization setting won't affect your application (as in your Wordpad example) Mark Russinovich has a great article on this: [Inside Windows Vista User Account Control](http://technet.microsoft.com/en-us/magazine/cc138019.aspx)
[ 0.35688093304634094, -0.02733638323843479, 0.25961413979530334, -0.029370907694101334, 0.06609371304512024, -0.10193042457103729, 0.10589282959699631, 0.20945657789707184, -0.1573726385831833, -0.5980717539787292, -0.33779463171958923, 0.30842190980911255, -0.23924753069877625, -0.01195442...
Silly question, but I'm unable to figure out.. I tried the following in Ruby: ``` irb(main):020:0> JSON.load('[1,2,3]').class => Array ``` This seems to work. While neither ``` JSON.load('1').class ``` nor this ``` JSON.load('{1}').class ``` works. Any ideas? I'd ask the guys who programmed the library. AFAI...
[ 0.08040579408407211, 0.12812840938568115, -0.08495381474494934, 0.03795260936021805, -0.025258855894207954, -0.16741664707660675, 0.25705966353416443, -0.10842073708772659, -0.20772682130336761, -0.3115987479686737, -0.13107216358184814, 0.6098414063453674, -0.49830424785614014, -0.0370377...
I have a PHP file, Test.php, and it has two functions: ``` <?php echo displayInfo(); echo displayDetails(); ?> ``` JavaScript: ``` <html> ... <script type="text/javascript"> $.ajax({ type:'POST', url: 'display.php', data:'id='+id , success: f...
[ 0.38420429825782776, 0.19812342524528503, 0.43223968148231506, -0.17319178581237793, -0.12066468596458435, 0.19662189483642578, 0.20944692194461823, -0.31805241107940674, 0.2710939645767212, -0.5212352871894836, 0.23851901292800903, 0.25513261556625366, -0.09212169051170349, 0.104642912745...
$("#response").html(data); } }); </script> ... <div id="response"> </div> </html> ``` It returns the response from jQuery. The response shows as `<a href=Another.php?>Link</a>`. When I click the Another.php link in `test.php`, it loads in another window. But I need it to load the ...
[ 0.30405452847480774, -0.11276903748512268, 0.5679421424865723, -0.13388031721115112, -0.5441895723342896, 0.15563546121120453, 0.300911545753479, -0.5360738635063171, 0.02909134142100811, -0.5671180486679077, -0.14590787887573242, 0.4860251247882843, -0.14355182647705078, 0.111330471932888...
`<div> </div>` elements? How can I tackle this problem? If I understand correctly, you'd like for the `a` link to cancel navigation, but fire the AJAX function? In that case: ``` $("#mylink").click(function() { $.ajax({ type: "POST", url: "another.php", data: {id: "somedata"}, function(data) { $("#respon...
[ 0.0013316558906808496, 0.020178811624646187, 0.5025149583816528, -0.008753298781812191, -0.15827412903308868, -0.0405179038643837, 0.380704790353775, -0.20333701372146606, -0.0375494621694088, -0.6004164218902588, -0.047091517597436905, 0.5587942600250244, -0.3726235628128052, -0.077861316...
I've upgraded a [.vdproj MSI generator project built into VS2008] System.Configuration.Install.Installer with a `ServiceProcessInstaller` and a `ServiceInstaller` from Visual Studio 2005 to 2008. There are no customisations of consequence to the installer class (i.e., not trying to start or stop services or register ch...
[ 0.21224214136600494, -0.08706291764974594, 0.49599599838256836, -0.4370840787887573, -0.08507426828145981, -0.01043721754103899, 0.4403216540813446, 0.04158126190304756, -0.09839828312397003, -0.7934549450874329, -0.05997879058122635, 0.7321634292602539, -0.251667320728302, 0.1629879474639...
that the user can pick either: a) an install location that's the same or b) an install location that's different what are the minimal code changes would one sensibly make to ensure that the old service gets uninstalled and the new one gets installed? Or is there something other than a code change required to r...
[ 0.4207412004470825, 0.016476867720484734, 0.1033879816532135, 0.15085573494434357, 0.29530569911003113, 0.10284466296434402, 0.3975997567176819, -0.33453354239463806, -0.13708896934986115, -0.3170439600944519, -0.11410965025424957, 0.7000565528869629, -0.2676960527896881, 0.041013531386852...
have in the new one.) I generated a new installer in VS 2008 and it fares no better. For now, my workaround is to stop updating the `Version` and `ProductCode`, forcing the user to manually uninstall when they are told they already have a version installed. Addendum thanks to [divo's](https://stackoverflow.com/users...
[ 0.580457866191864, 0.1892111450433731, 0.44407060742378235, -0.17249852418899536, 0.09252887219190598, -0.33174601197242737, 0.39282193779945374, -0.2611047327518463, -0.10726342350244522, -0.48856523633003235, -0.1770637184381485, 0.808657705783844, -0.1660432666540146, 0.2008210569620132...
answer your question [How do I eliminate "The specified service already exists" when I install new versions of my software?](https://stackoverflow.com/questions/451573/how-do-i-eliminate-the-specified-service-already-exists-when-i-install-new-versio/617385)
[ 0.36860203742980957, -0.09080827236175537, 0.06589191406965256, 0.32362100481987, 0.33595433831214905, -0.30730679631233215, 0.06739456951618195, -0.2441856563091278, -0.2444794476032257, -0.32683393359184265, -0.08871018141508102, 0.4248049557209015, -0.25264492630958557, 0.06052546575665...
What I would like to do is add dynamically HTML input fields in one page, and each one of them correspond to an element of a struts array property. Let's say I have a number of identical fields in an HTML page: > < input type="file" name="myfile" /> and when the form is submitted, I want each field to correspond to a...
[ 0.3640880584716797, -0.1670370101928711, 0.6002108454704285, -0.06170692667365074, -0.46467041969299316, 0.008311384357511997, 0.1733700931072235, -0.3219485878944397, -0.229213684797287, -0.7752709984779358, 0.15507498383522034, 0.5420956611633301, -0.5278757214546204, -0.1060973852872848...
Otherwise, an array element is mapped to an input element or html:text element instance, intuitively. So, to make my question more specific, why can't I upload with struts an array of files? OK, here is a "would work for me" solution: First of all, in your html/jsp file the name attribute should be indexed: > File 1:...
[ 0.20063792169094086, -0.20841863751411438, 0.40173617005348206, 0.14564067125320435, -0.3081545829772949, -0.1491769403219223, 0.151536226272583, -0.7747305035591125, -0.13510818779468536, -0.5089882612228394, 0.28498178720474243, 0.6657978892326355, -0.34758588671684265, -0.35334554314613...
check the length of the array against the number of elements actually submitted, i.e. check for null array elements. I think this provides a good baseline for adjusting it to your needs. As I said in the final edit of my question, for a < html:text > or < input type="text" > element you would need neither an indexed pr...
[ 0.397247314453125, -0.12192410230636597, 0.189235121011734, -0.057206179946660995, -0.32104361057281494, -0.23595686256885529, 0.041982293128967285, -0.3222235143184662, -0.361268013715744, -0.5866757035255432, 0.2698787748813629, 0.42438504099845886, -0.2156737893819809, -0.03970894217491...
class.
[ -0.14031410217285156, -0.061591736972332, 0.1970747709274292, 0.23996996879577637, 0.16072900593280792, -0.030123164877295494, 0.26015838980674744, 0.3078117370605469, -0.25533729791641235, -0.2821454703807831, -0.22259463369846344, 0.24438507854938507, 0.3611188232898712, -0.0612066611647...
I have a KTextEdit, filled with some text. When I put lots of text, the KTextEdit will be scrolled automatically to the end (obviously). My question is: how can I scroll to the start (viz to the first line of the KTextEdit) ?!? Looks like you use ``` QTextCursor cursor = edit->textCursor(); cursor.setPosition(0);...
[ -0.09808971732854843, 0.11195462942123413, 0.743486225605011, 0.023025747388601303, -0.2080141305923462, 0.03494357690215111, 0.23071321845054626, -0.1500004231929779, 0.061416588723659515, -0.8143231868743896, -0.27674466371536255, 0.2233346849679947, -0.21179355680942535, 0.1494591981172...
Stackoverflow User [Luke](https://stackoverflow.com/users/17602/luke) wrote in [this answer](https://stackoverflow.com/questions/138761/web-applications-desktop-applications#171113): > The boundaries between desktop and web > applications have really blurred. > Whilst once upon a time the nature of > developing for...
[ -0.15554913878440857, 0.2864205241203308, 0.7151318788528442, -0.2402404397726059, 0.07042528688907623, -0.024936094880104065, 0.13829711079597473, -0.15069681406021118, -0.35941484570503235, -0.36058273911476135, -0.1396157592535019, 0.46149519085884094, -0.011724065989255905, 0.000028603...
a feature that many web applications miss. It could be that some feature aren't even necessary or are compensated in some other way. Maybe there are features which can't be implemented in (a classic) web application? * Support for Big Files. * Integration with the client OS. * Support for special Input/Ouput Devices. *...
[ 0.05496572330594063, -0.200240820646286, 0.1843012571334839, 0.381889283657074, -0.032150980085134506, -0.17368580400943756, 0.24949875473976135, 0.25172191858291626, -0.3373293876647949, -0.918290913105011, -0.4607660174369812, 0.6139793992042542, -0.15649886429309845, -0.0992343649268150...
I have an application that uses a cron like job to update a set of data. The update process happens once a minute and doesn't last long. A servlet exposes this data set to the users. My problem is that during the update process, the servlet requests should block and wait for the process to complete. In bottom line I ...
[ 0.2941076457500458, -0.06910493224859238, 0.3583672344684601, -0.0314369797706604, -0.12949135899543762, -0.011500660330057144, 0.13996420800685883, -0.02677246928215027, -0.054633136838674545, -0.6339253187179565, 0.019539160653948784, 0.6422954201698303, -0.4142531454563141, 0.3094086050...
for it to complete. One getData call shouldn't block subsequent calls of the same function. The updateData function has higher priority than the getData, i.e. when updateData is to run, it has to wait for all calls of getData to complete, but new calls shouldn't be allowed to start. What synchronization mechanism shou...
[ 0.07760762423276901, -0.004424691665917635, 0.2727918326854706, 0.012115311808884144, -0.22322990000247955, -0.43389132618904114, 0.4688943028450012, -0.5343901515007019, -0.22590765357017517, -0.5590193867683411, 0.056309774518013, 0.5816643238067627, -0.2339676171541214, 0.00248370785266...
the notifyAll() waking all waiting threads. It does, however, give priority to write lock requests.
[ -0.07374729216098785, -0.45893245935440063, 0.4663233757019043, -0.08937110751867294, 0.2750231921672821, -0.3290831744670868, 0.39383766055107117, -0.49337273836135864, -0.33855220675468445, -0.450045645236969, -0.43540534377098083, 0.2142478972673416, -0.38531118631362915, -0.02834734506...
I using the Win32 API and C/C++. I have a HFONT and want to use it to create a new HFONT. The new font should use the exact same font metrics except that it should be bold. Something like: ``` HFONT CreateBoldFont(HFONT hFont) { LOGFONT lf; GetLogicalFont(hFont, &lf); lf.lfWeight = FW_BOLD; return Crea...
[ 0.347774475812912, 0.126500204205513, 0.9431927800178528, -0.33603283762931824, 0.08970874547958374, 0.18608491122722626, 0.09929416328668594, -0.46410873532295227, 0.03523649647831917, -0.8527067303657532, -0.08131889998912811, 0.7130690217018127, -0.3820185959339142, -0.17456132173538208...
&lf ); ```
[ -0.12233103066682816, 0.29167693853378296, 0.5446413159370422, -0.5952275395393372, -0.21209517121315002, 0.21007050573825836, 0.3398818373680115, -0.19540610909461975, -0.21119996905326843, -0.4866197109222412, -0.6144046783447266, 0.618621289730072, -0.37487807869911194, 0.16993181407451...
I am trying to modify the below program to ensure each msg is converted to utf-8 using Encode::decode(), but I am unsure of how and where to place this to make it work. ``` #!/usr/bin/perl use warnings; use strict; use Mail::Box::Manager; open (MYFILE, '>>data.txt'); binmode(MYFILE, ':encoding(UTF-8)'); my $file = s...
[ 0.10663340240716934, 0.11764733493328094, 0.5675092339515686, -0.5022972226142883, 0.13974817097187042, 0.18735282123088837, 0.6156898736953735, -0.19590139389038086, -0.12659986317157745, -0.8510928750038147, -0.5257575511932373, 0.4915902018547058, -0.7282528281211853, 0.3918432593345642...
join( ', ', map { $_->format } $msg->to ); my $from = join( ', ', map { $_->format } $msg->from ); my $date = localtime( $msg->timestamp ); my $subject = $msg->subject; my $body = $msg->decoded->string; # Strip all quoted text $body =~ s/^>.*$//msg; print MYFILE <<...
[ 0.3589218854904175, -0.10462749749422073, 0.986545205116272, 0.1445324718952179, 0.12696872651576996, -0.05724593997001648, 0.06284414231777191, -0.34428003430366516, -0.1982988864183426, -0.7763547897338867, -0.40942156314849854, 0.25147518515586853, -0.2316000759601593, 0.248195320367813...
used by the > Array.ForEach method and the > List.ForEach method to perform an > action on each element of the array or > list. Except that, you can use it as a generic delegate that takes 1-3 parameters without returning any value.
[ 0.13210836052894592, -0.3758780360221863, 0.04209967330098152, 0.21885377168655396, -0.07771006971597672, -0.04621532931923866, 0.10247734189033508, -0.36743244528770447, 0.033457785844802856, -0.36023813486099243, -0.08368030935525894, 0.41621336340904236, -0.440753310918808, 0.0355587899...
**UPDATE** I have combined various answers from here into a 'definitive' answer on a [new question](https://stackoverflow.com/questions/1747235/weak-event-handler-model-for-use-with-lambdas/1747236#1747236). **Original question** In my code I have an event publisher, which exists for the whole lifetime of the appli...
[ -0.3123190104961395, -0.041297849267721176, 0.5152629613876343, 0.07441267371177673, -0.0038900752551853657, -0.2928203344345093, 0.0857863500714302, -0.09998028725385666, -0.15336045622825623, -0.5343937873840332, -0.20227551460266113, 0.3805535137653351, -0.2514437139034271, 0.1344834715...
{ publisher.EnabledChanged += (s, e) => subscriber.Enabled = e.Value; } //(Non-lambda version, if you're not comfortable with lambdas) public static void Link(Publisher publisher, Control subscriber) { publisher.EnabledChanged += delegate(object sender, ValueEventArgs<boo...
[ -0.13473667204380035, -0.38703352212905884, 0.8896675705909729, 0.09473776817321777, 0.1349126249551773, -0.01597690023481846, 0.16317373514175415, -0.07553437352180481, -0.3534580171108246, -0.6058841943740845, -0.37719032168388367, 0.4721356928348541, -0.6444826722145081, 0.0796014219522...
subscriber.Enabled = e.Value; }; } } ``` It worked fine, until we started using it on smaller machines, when I started getting the occasional: ``` System.ComponentModel.Win32Exception Not enough storage is available to process this command ``` As it turns out, there is one place in the code where ...
[ 0.08425169438123703, -0.42706298828125, 0.5103850960731506, 0.30510443449020386, 0.07534287124872208, -0.15541419386863708, 0.17015507817268372, 0.10889382660388947, -0.36201369762420654, -0.4843887984752655, -0.14975711703300476, 0.6160661578178406, -0.5178648829460144, 0.3922406136989593...
live for the lifetime of the application. I've fiddled around a while with [Dustin Campbell's WeakEventHandler](http://diditwith.net/CommentView,guid,aacdb8ae-7baa-4423-a953-c18c1c7940ab.aspx#commentstart), but it *doesn't work with anonymous delegates* (not for me anyway). Is there anyway out of this problem? I real...
[ 0.7747972011566162, 0.0003928552323486656, 0.4162617325782776, 0.14212675392627716, 0.07536777853965759, -0.10955055803060532, 0.6821997761726379, -0.3428204655647278, -0.021377548575401306, -0.7647458910942078, -0.004773904103785753, 0.6091659069061279, -0.13537266850471497, 0.07932624965...
equivalent to the WeakEventHandler which avoids me having to remember to explicitly UnLink/Dispose, that would be cool...) **EDIT** I must admit that I worked around this problem by "recycling" the controls in question. However the workaround has come back to haunt me as the 'key' I was using is apparently non-unique ...
[ -0.3533329665660858, -0.0962115153670311, 0.26859238743782043, 0.16252049803733826, -0.26443496346473694, -0.5595769882202148, 0.3552981913089752, -0.3555876910686493, -0.3732246160507202, -0.4704289138317108, -0.18200567364692688, 0.4330528676509857, -0.2872382402420044, 0.008877187035977...
Dustin Campbell). It occurs to me that what I'm looking for may be semantically impossible - closures are designed to 'hang around even after I'm gone'. I've found another workaround, so I'll stick with that, pending a [voice from the gods](http://blogs.msdn.com/ericlippert/). I know that this question is ancient, ...
[ 0.05920080840587616, 0.36878928542137146, 0.28143176436424255, 0.13176928460597992, 0.07590394467115402, -0.15535590052604675, 0.395955353975296, 0.195241317152977, -0.33046096563339233, 0.0038743088953197002, -0.45666053891181946, 0.21194429695606232, 0.021291697397828102, 0.4748084545135...
that a) in 99% of cases I'd need something like this his original solution would be safer, and b) in those few cases where I have to (note: have to, not "want to because lambdas are so much prettier and concise") it's possible to make it work if you get a little clever. Your example seems like exactly the kind of one...
[ 0.2428463101387024, -0.03492732346057892, 0.2811548709869385, 0.22290657460689545, 0.41247156262397766, -0.45894673466682434, 0.2551058530807495, -0.03681817650794983, -0.039981864392757416, -0.2806449234485626, -0.17060838639736176, 0.7230353355407715, -0.5895318388938904, 0.0617278739809...
references the subscriber only through weak // references,so its existance doesn't interfere with garbage collection var subscriber_weak_ref = new WeakReference(subscriber); // this instance variable will stay in memory as long as the anonymous // method holds a reference to it we dec...
[ -0.04232904314994812, -0.16282781958580017, 0.8840383291244507, -0.0714448019862175, -0.1062852218747139, -0.11595867574214935, 0.4744910001754761, -0.04383771866559982, -0.16576910018920898, -0.41546395421028137, -0.09749846160411835, 0.20494337379932404, -0.5142791271209717, 0.3864830434...
// variable otherwise) EventHandler<ValueEventArgs<bool>> handler = null; // when the handler is created it will grab references to the local // variables used within, keeping them in memory after the function // scope ends handler = delegate(object sender, ValueEventArgs<boo...
[ 0.051038242876529694, -0.7023184299468994, 0.4086274802684784, -0.17216934263706207, 0.04793297499418259, -0.2575904428958893, 0.34757140278816223, -0.3558492958545685, 0.009659083560109138, -0.3924519121646881, -0.33041098713874817, 0.4162312150001526, -0.6493059992790222, 0.2346984297037...
if (subscriber_strong_ref != null) subscriber_strong_ref.Enabled = e.Value; else { // unsubscribing the delegate from within itself is risky, but // because only one instance exists and nobody else has a
[ 0.12775257229804993, -0.11149205267429352, 0.13542182743549347, 0.06145653501152992, 0.2253536880016327, -0.2487761676311493, 0.734057605266571, -0.50799161195755, -0.060148466378450394, -0.4395477771759033, -0.362400621175766, 0.2511306703090668, -0.43835270404815674, 0.25814539194107056,...
// reference to it we can do this ((Publisher)sender).EnabledChanged -= handler; // by assigning the original instance variable pointer to null // we make sure that nothing else references the anonymous
[ 0.011562395840883255, -0.11387909948825836, 0.5400698184967041, 0.23114430904388428, 0.09520038217306137, -0.12199663370847702, 0.2010442465543747, 0.2352471649646759, -0.09997960925102234, -0.09543427079916, 0.1058444231748581, 0.29706165194511414, -0.732164740562439, 0.1523672491312027, ...
// method and it can be collected. After this, the weak // reference and the handler pointer itselfwill be eligible for // collection as well. handler = null; } };
[ 0.15316161513328552, -0.3768402934074402, 0.100823312997818, 0.05347635969519615, -0.06387990713119507, -0.0817900076508522, 0.24211037158966064, -0.36319291591644287, 0.05101371183991432, -0.04240082576870918, -0.2431754469871521, 0.3971378803253174, -0.4089759886264801, 0.201741367578506...
publisher.EnabledChanged += handler; } } ``` The WPF Weak Event pattern is rumored to come with a lot of overhead, so in this particular situation I wouldn't use it. Furthermore, referencing the core WPF library in a WinForm app seems a little heavy as well.
[ 0.031992726027965546, 0.033530719578266144, 0.25415846705436707, 0.020955730229616165, -0.2403869777917862, -0.5427636504173279, 0.16390345990657806, -0.0016061433125287294, -0.0979122593998909, -0.5924764275550842, -0.11077841371297836, 0.6995575428009033, -0.4941457211971283, 0.195769920...
So I've got a form in my Rails app which uses a custom FormBuilder to give me some custom field tags ``` <% form_for :staff_member, @staff_member, :builder => MyFormBuilder do |f| %> [...] <%= render :partial => "staff_members/forms/personal_details", :locals => {:f => f, :skill_groups => @skill_groups, :staff_mem...
[ 0.05467900261282921, -0.01355532743036747, 0.5225098729133606, -0.05896340683102608, -0.1817937046289444, -0.2207038849592209, 0.30452343821525574, -0.2204740047454834, 0.027944155037403107, -0.968106210231781, -0.10650552809238434, 0.3081963062286377, -0.08626542240381241, 0.0533535778522...
then the form breaks, as the FormBuilder object I used in the form\_for is no longer available. Is there any way for me to use my custom FormBuilder object inside a partial used for an AJAX callback? Use `fields_for` inside your partial. It performs a similar task but without wrapping the form tags. See the [API docs](...
[ 0.44394150376319885, -0.22400787472724915, 0.4305001497268677, -0.11752748489379883, -0.022236231714487076, -0.12499938905239105, 0.5705515146255493, -0.23684628307819366, -0.12853406369686127, -0.5167797803878784, -0.11029442399740219, 0.5149644017219543, -0.26042866706848145, 0.126700043...
I have to read invoice ascii files that are structured in a really convoluted way, for example: ``` 55651108 3090617.10.0806:46:32101639Example Company Construction Company Example Road. 9 9524 Example City ``` There's actually additional stuff in there, but I don't want to confuse ...
[ 0.06712101399898529, 0.3840997815132141, 0.3043777644634247, -0.0296468585729599, 0.15556666254997253, 0.22889302670955658, 0.11267095059156418, 0.11872093379497528, -0.2891850769519806, -0.7444267868995667, -0.05968242138624191, 0.47203096747398376, -0.1517890989780426, 0.3223012089729309...
whitespaces between "Example Company" and "Construction Company" are of variable length The field "Example Company" could have whitespaces of variable length too however, for instance "Microsoft Corporation Redmond". Same with the other fields. So there's no clear way to extract data from the latter part. But that's n...
[ 0.17214573919773102, 0.3080124855041504, 0.03230562061071396, 0.2283935397863388, -0.22418248653411865, 0.24822625517845154, -0.2928534746170044, 0.042297594249248505, -0.0419958233833313, -0.38711410760879517, -0.14519591629505157, 0.2416716367006302, -0.2836461067199707, 0.18378192186355...
xml templates that describe the input, the entity names, and their valuetypes. I would parse the invoice files according to the templates. "If the input was somewhat structured and well defined, how would you guard against future changes in its structure. How would you design and implement a reader?" You must define t...
[ 0.30680757761001587, 0.029773348942399025, 0.1956774890422821, 0.06332225352525711, -0.25368618965148926, -0.22417078912258148, -0.23082907497882843, -0.19780677556991577, -0.09433232247829437, -0.6058490872383118, -0.05037010461091995, 0.5860407948493958, -0.36711713671684265, -0.14827181...
self.offset= None class Record( object ): def __init__( self, fieldList ): self.fields= fieldList self.fieldMap= {} offset= 0 for f in self.fields: f.offset= offset offset += f.size self.fieldMap[f.name]= f def parse( self,
[ -0.31132230162620544, 0.04196585714817047, 0.1385924220085144, -0.34346115589141846, 0.023108653724193573, 0.3667318522930145, 0.07371792942285538, -0.364536851644516, -0.0660349652171135, -0.3959713578224182, 0.023220228031277657, 0.8116294145584106, -0.4182848632335663, -0.17435336112976...
aLine ): self.buffer= aLine def get( self, aField ): fld= self.fieldMap[aField] return self.buffer[ fld.offset:fld.offset+fld.size+1 ] def __getattr__( self, aField ): return self.get(aField) ``` Now you can define records ``` myRecord= Record( Field('aField',8), Fie...
[ 0.17372995615005493, 0.039801616221666336, 0.21472226083278656, -0.15367284417152405, 0.3765287399291992, 0.29235297441482544, -0.03808068484067917, -0.6384555101394653, -0.3591616749763489, -0.7248854041099548, -0.14580592513084412, 0.735512375831604, -0.11133044958114624, 0.0759843885898...
is a matter of subclassing Field to define the various types (dates, amounts, etc.)
[ 0.5756750702857971, 0.38290369510650635, 0.03241150826215744, 0.35112637281417847, 0.226162850856781, 0.13204403221607208, -0.15431685745716095, 0.015273034572601318, -0.4600338935852051, -0.4340916574001312, -0.07550662010908127, -0.20110519230365753, 0.19747331738471985, 0.58965998888015...
Given the following class ``` public class Foo { public int FooId { get; set; } public string FooName { get; set; } public override bool Equals(object obj) { Foo fooItem = obj as Foo; if (fooItem == null) { return false; } return fooItem.FooId
[ -0.263316810131073, 0.14523226022720337, 0.3823659420013428, -0.31159162521362305, 0.011363858357071877, -0.02141307108104229, 0.4759797751903534, -0.3667130768299103, 0.10472958534955978, -0.30933064222335815, -0.36424776911735535, 0.48028603196144104, -0.5575249195098877, 0.1909657865762...
== this.FooId; } public override int GetHashCode() { // Which is preferred? return base.GetHashCode(); //return this.FooId.GetHashCode(); } } ``` I have overridden the `Equals` method because `Foo` represent a row for the `Foo`s table. Which is the preferred method for overr...
[ -0.19192509353160858, 0.27760475873947144, 0.5704222321510315, -0.18490011990070343, 0.047275152057409286, -0.11041664332151413, 0.3741803765296936, -0.3948737680912018, 0.003411687444895506, -0.3081488311290741, -0.281052827835083, 0.5590099096298218, -0.4591899812221527, 0.24541358649730...
is used (in the absence of a custom `IEqualityComparer<T>`) to group items into buckets. If the hash-code for two items does not match, they may *never* be considered equal ([Equals](https://learn.microsoft.com/en-us/dotnet/api/system.object.equals?view=netframework-4.8) will simply never be called). The [GetHashCode(...
[ -0.14621266722679138, 0.012377092614769936, 0.32598361372947693, -0.07770834863185883, -0.10743127018213272, 0.08891070634126663, 0.14597634971141815, -0.5013938546180725, -0.213628351688385, -0.3311980366706848, -0.011921082623302937, 0.39336270093917847, -0.4612768292427063, 0.0955734997...
like "`return FooId;`" is a suitable `GetHashCode()` implementation. If you are testing multiple properties, it is common to combine them using code like below, to reduce diagonal collisions (i.e. so that `new Foo(3,5)` has a different hash-code to `new Foo(5,3)`): In modern frameworks, the `HashCode` type has methods...
[ 0.0505635067820549, 0.11100742965936661, -0.03988971933722496, -0.24942462146282196, -0.11146894842386246, -0.3043748438358307, 0.2644715905189514, -0.5070950388908386, -0.21257074177265167, -0.5962568521499634, -0.1657189577817917, 0.2974378764629364, -0.44301891326904297, -0.080055102705...