Monday, 15 February 2010

Combine pairs to groups [PHP / Arrays] -


I have added items to the PHP array Example:

  & lt ;? Php $ element = array ('tiger' = & gt; lion ',' car '= & gt;' bike ',' lion '= & gt;' zoo ',' truck '= & gt;' plane '); ? & Gt;  

Now I want to combine these objects so that all the items connected in any way go to one group. Continuing the example given above:

  & lt ;? Array ('car', 'bike'), 2 = & gt; array ('tiger', 'lion', 'zoo'), 1 = & gt; array (' Do you know how to get it?  

I'm looking for a function Which does this.

  & lt;? $ $ Element = array ('tiger '= & Gt;' lion ',' car '= & gt;' bike ',' lion '=> gt; zoo' 'truck' = 'gt;' plane '); $ groups = array; Forex currency ($ element = $ $ such as value $ & gt; $ val) {$ appended = false; foreach ($ group & $ group) {i F ($ group [0] == $ key) {array_unshift ($ (group $ $) = $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ Array (3) [$ 0] => String (3) "Zoo" [1]   
 

returns:

  array (3) {[0] => = & gt; string (4) "lion" [2] => string (5) "tiger"} [1] = & gt; & Amp; array (2) {[0] => string (4) "bike" [1] => string (3) "car"} [2] = & gt; array (2) {[0] = & Gt; String (5) "plane" [1] = & gt; String (5) "Truck"}}  

objective c - Cocoa move to parent from a subclassed instance -


I have a subclassed NSTextField to limit the maximum length (1 character only). Now, once the user enters this character, I want to take Focus to the next NSTTXTV. This is the place where I need some help. How can I apply the application "Take the focus to the next field"? I think I need to call the original view from the subclassed NSTextField, like something:

  [[parent] next KYV];  

But how do I do this?

about how [[auto window] makefrent responder: [self's next review] ] ?


osx - Why does Mac OS sometimes launch the wrong binary when I click on a .app -


I created this application which contains several binary files (let's say X, Y and Z). I have one. Plist file which specifies that the X should be launched when the app is opened. Everything works well at 99.9% time, but occasionally, it launches another binary (Y or Z).

This usually happens after some crashes in my application, so I guess it's a Mac OS system that detects that something went wrong in binary and try to make a different effort Please.

This is very bad for me because my application becomes unusable as long as I do not uninstall it and restore it.

If these additional binaries have just been launched to do some work in your app, then any There is also no reason that if you are not already storing them in the resource folder inside the app bundle for the main binary in your app bundle for your app bundle, then you can try to give them a place in the macode folder where Main binary i think is that Whatever the mechanism is launching a separate binary instead of the main one, they will hide enough.


c# 3.0 - C# 3.0 Tuple Equivalents (for poor men) -


I find myself occasionally in C # 3.0, searching for ways to emulate Tupl's concept . Over time, I have implemented many "poor people", some of them are here:

Original Object Array :

  Object [] Bad Tupale = New Object [] {EF, Bar, Falcon}; // Original object array  

more strongly typed , hello ...

  KeyWellPear & amp; type; Type A; Key val peer; Type B, Type C & gt; & Gt; PoorTuple;  

Applying a class which can be used to guess the type (raised from)

  public stable Class tuple {public stationary tubal & lt; T1, T2 & gt; & Lt; T1 foo, t2 times & gt; {New Tupal & lt; T1, T2 & gt; (Af, bar); }} // later: var data = tubel. Cret ("foo", 42);  

Question:

  1. Any other methods (or language of choice which lacks data structure) in C # 3.0 for a poor man's tubal

  2. What is the best method to get a tube in C # 3.0 - if anyone has a library recommendation then welcome it is.

  3. At what point (yes, generalization for me) does it mean to make a specific type instead of something like a list or a tuple? (Search of thumb rules)

You can create anonymous types Exclude useful names, do the same as Tuples:

  Child items with my items = myObjects. Select (x = & gt; new {name = x.Name, count = x.Children.Count ()});  

Isolating picture attachment from email with php -


I am using the following php script and to receive the email later to handle different pieces Put in the variable From stdin $ fd = fopen ("php: // stdin", "r") / p>

  #! / Usr / bin / php -q & lt ;? Read php //; $ Email = ""; While (! FIF ($ FD)) {$ email = Fread ($ fd, 1024); } Fclose ($ fd); // handle email $ line = explosion ("\ n", $ email); // empty wars $ = ""; $ Theme = ""; $ Header = ""; $ Message = ""; $ Partition head = true; ($ I = 0; $ i & lt; Count ($ rows); $ i ++) {if ($ splittingheaders) {// This header is $ header = $ Lines [$ i] "\ N"; // See for special headers (preg_match ("/ ^ subject: (. *) /", $ Lines [$ i], $ matches)) {$ subject = $ matches [1]; } If (preg_match ("/ ^ to: (. *) /", $ Rows [$ i], $ matches) {$ from = $ matches [1]; }} And {// not the title, but the message $ message. = $ Rows [$ i]. "\ N"; } If (trim ($ rows [$ i]) == "") {// blank line, header section $ splittingheaders = false has expired; }}  

Where I start to accept a photo attachment and separate it in a variable, I can process it but I need it.

I will use MimeMailParse () then you can just say

 $ Parser = new MimeMailParser (); $ Parser-> setStream (STDIN); // handle image $ path = '/ tmp /'; $ Filename = ''; $ Attachment = $ parser-> gettip (); Foreign Currency ($ attachments as $ attachments) {if (preg_match ('/ ^ image /', $ attachment-> content_type, $ match)) {$ pathinfo = pathinfo ($ attachment-> file name); $ Filename = $ pathinfo ['filename']; If ($ fp = fopen ($ path. $ Filename, 'w')) {while ($ byte = $ enclosure-> read ()) {fill ($ fp, $ bytes); } Fclose ($ fp); }}} 

asp.net - How to turn on line number tooltip while scrolling infragistics ultrawebgrid -


I once saw this feature in action, but I do not know how to turn it on. While dragging the scrollbar, the grid can show the tooltip with the current line number (or line id) it helps you to stop scrolling in the right place. I'm assuming that some property will change on this, but I can not find it. Maybe it's also dependent on scroll mode?

Update: You can see an example of tooltip in the image below. The scrollbar is dragging (up or down) The number of tooltip is the number of lines (you can not see it in this picture, on the left in the grid) this is the same grid which I am using now. Either way this tooltip was stopped by the very old construction of our product. And no one knows how to turn it back: (I'm pretty sure this is a feature of ultra webbread, there is nothing that requires extra coding.

We have now found that you have version 6.3, P>

Then try this code:

  Web Grid. I have met once a while, I think the Virtual Sketch The scrolling is not added as a feature.  

DisplayLayout.XmlLoadOnDemandType = XmlLoadOnDemandType.Virtual;

As you scroll down, it will automatically Put the tooltip on the grid. Take a look for the running spec ... (and remember to select the virtual option)

Here's hope!

Rob G


new operator - How to have line breaks in XML attributes? -


I have a feature: Description and I want to put it in the following with new lines:

This is the content description section.
Download Instructions:
Content is downloading content.
Hotline Support:
This is hotline for content.

How do I create a new line for it in XML?

Actually you want to enter the CRLF:

CR code: & Amp; # 13; LF code: & amp; # 10;

& lt; Myelement description = "line1 and amp; # 13; and # 10; line 2 & amp; # 13; & amp; # 10; line3" />