I am trying to find out if there is a more optimal way for creating a list of an object's sub object's properties. (Apologies for the crude wording, I am not really much of an OO expert)
I have an object "event" that has a collection of "artists", each artist having an "artist_name". On my HTML output, I want a plain list of artist names delimited by a comma.
PHP's implode() seems to be the best way to create a comma delimited list of values. I am currently iterating through the object and push values in a temporary array "artistlist" so I can use implode().
That is the shortest I could come up with. Is there a way to do this more elegant?
$artistlist = array();
foreach ($event->artists as $artist)
{
$artistlist[] = $artist->artist_name;
}
echo implode(', ', $artistlist);
Let's say I have a C program, and I run it from bash:
$ ./a.out 123 *
The program would output all the command line arguments,
but it will show these instead:
Argument 1: 123
Argument 2: a.out
What can I do in my program to fix this?
Hi,
I am trying to write a C++ Console based application which collects and populates each characters typed in the console to a std::vector asynchronously without blocking the user
Can anyone help me in how to populate each char entered in std::vector .
John
E.g.
input: ['A', 'Z', 'F', 'D', ...]
output: [0, 25, 5, 3, ...]
In C I'd just subtract the char from 'A', but I don't seem to be able to do this in java.
I'm debugging my Android application using the AVD (Android Virtual Device). When I try to enter text in a text field, my characters are being interpreted as Japanese (or Chinese?) in the IME.
I don't know how I got into this mode or how to get out of it (I just want to enter alphabetic keys)?
Here's a screen shot:
http://u.go2.me/3cn
sorry for the vague subject, the issue is such:
I create an event with invitees in google calendar; on the receiving side an email arrives as multipart, which, in its text/html block, has the following text (quoted-prinatble encoded)
Wed Jun 9 1pm =96 2p=
m
I googled for the =96 and can't find anything. (the charset or this block is windows-1252, BTW)
thanks a lot!
In the following AccessVBA code, I am trying to write a record to a memo field called "Recipient_Display":
oRec1.Fields("RECIPIENT_DISPLAY") = Left(sRecipientDisplayNames, Len(sRecipientDisplayNames) - 2)
When the string contains 2036 characters, the write completes. Above this number I get the following error:
Run-time error'-2147217887(80040e21)':
Could not update; currently locked by another session on this machine.
What is the significance of this number 2036 and is there a property I can adjust that will allow the above update to take place?
In a linguistic project of mine I need to use symbols not contained in Unicode. I can draw the font, but would like to avoid overwriting characters defined by the standard. Are there any standard solutions for such cases? As reserved ranges etc. I'd need common Unicode-aware software to handle it seamlessly.
As I understand it, the limitation of 255 characters in a file path is a Windows limitation. What is the reasoning for this? If so, has this been resolved in Windows 7?
In our continuous integration practices, we often have deeply nested project structures and it would be extremely useful to be able to go beyond 255 characters. Right now we are somewhat forced to structure our projects in such a way as to not hit this artificial ceiling.
I'm having an encoding issue, and I'm not sure where to look for the problem.
I have this Ajax.Request function (prototype library) sending data to a Groovy/Grails encoder
var myAjax = new Ajax.Request(url, {method:'post', encoding:'UTF-8', contentType:'application/x-www-form-urlencoded', parameters:{'content':new_content}, onSuccess:success, onFailure:failure});
The data is coming in with an unexpected %A0 at the beginning:
I have this simple controller that just echos the content back:
def titlechange = {
def content = URLDecoder.decode(params['content'])
printf("Content: %s; DecodedContent = %s\n", params['content'], content)
response.characterEncoding='UTF-8'
render content
}
the debug print statement shows:
Content: %A0Hello%2C%20world%21; DecodedContent = †Hello, world!
Where is that %A0 coming from?
My grails configuration has this:
// The default codec used to encode data with ${}
grails.views.default.codec="none" // none, html, base64
grails.views.gsp.encoding="UTF-8"
grails.converters.encoding="UTF-8
Is the issue on the grails side or on the JavaScript side?
Currently I am using this implementation to hide user input during password entry:
void setEcho(bool enable) {
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(hStdin, &mode);
if(enable) {
mode |= ENABLE_ECHO_INPUT;
} else {
mode &= ~ENABLE_ECHO_INPUT;
}
SetConsoleMode(hStdin, mode);
}
The user needs to be able to have positive feed back that text entry is being made. What techniques are available in a Win32 environment using C++?
Hello,
I have a statement:
I have a string such as
content = "* test *"
I want to search and replace it with so when I am done the string contains this:
content = "(*) test (*)"
My code is:
content = Regex.Replace(content, "*", "(*)");
But this causes an error in C# because it thinks that the * is part of the Regular Expressions Syntax.
How can I modify this code so it changes all asterisks in my string to (*) instead without causing a runtime error?
Thanks.
Currently I using the following code to get my JSON output from MySQL.
<?php
$session = mysql_connect('localhost','name','pass');
mysql_select_db('dbname', $session);
$result= mysql_query('SELECT message FROM posts', $session);
$somethings = array();
while ($row = mysql_fetch_assoc($result)) {
$somethings[] = $row;
}
?>
<script type="text/javascript">
var somethings= <?php echo json_encode($somethings); ?>;
</script>
And the output is:
<script type="text/javascript">
var somethings= [{"message":"Welcome to Yo~ :)"},{"message":"Try iPhone post!"},{"message":"????"}];
</script>
Here is the question, how can I change my output into format like :
<script type="text/javascript">
userAge = new Array('21','36','20'),
userMid = new Array('liuple','anhu','jacksen');
</script>
Which I'll be using later with following code :
var html = '
<table class="map-overlay">
<tr>
<td class="user">' +
'<a class="username" href="/' + **userMid[index]** + '" target="_blank"><img alt="" src="' +
getAvatar(signImgList[index], '72x72') +
'"></a><br>
<a class="username" href="/' + **userMid[index]** + '" target="_blank">' +
userNameList[index] +
'</a><br>
<span class="info">' + **userSex[index]** + ' ' + **userAge[index]** + '?<br>
' +
cityList[index] +
'</span>' +
'</td>
<td class="content">' + picString
+ somethings[index] + '<br>
<span class="time">' +
timeList[index] + picTips +
'</span></td>
</tr>
</table>
';
Thanks for helping and reading!
Hi all,
I am trying to access google maps' forward geocoding service from my iphone app.
When i try to make an NSURL from a string with a pipe in it I just get a nil pointer.
NSURL *searchURL = [NSURL URLWithString:@"http://maps.google.com/maps/api/geocode/json?address=6th+and+pine&bounds=37.331689,-122.030731|37.331689,-122.030731&sensor=false"];
I dont see any other way in the google api to send bounds coordinates with out a pipe.
Any ideas about how I can do this?
I have a series of buttons that have suit symbols on them. Currently I provide these suit symbols as bitmaps. In preparation for iPhone 4 I'd like to use text instead. However Interface Builder rescales the button to account for whitespace underneath the symbol so I can't get the image to fill the button completely.
Any hints on getting Interface Builder to behave?
It's a TMemo, not that that should make any difference.
Googling suggests that I can use Canvas->TextWidth() but those are Delphi examples and BCB doesn't seem to offer this property.
I really want something analogous to memo->Font->Height for width.
I realize that not all fonts are fixed width, so a good estimate will do.
All that I need is to take the width of a TMemo in pixels and make a reasonable guess at how many characters of the current font it will hold.
Of course, if I really want to be lazy, I can just google for the average height/width ratio, since height is known. Remember, an approximation is good enough for me if it is tricky to get exact.
http://www.plainlanguagenetwork.org/type/utbo211.htm says, " A width to height ratio of 3:5 (0.6) is recommended for most applications"
I have an array of values being made available, but unfortunately some of the variable names include a space. I cannot work out how to simply output these in the page. I know I'm not explaining this well (I'm the JSP designer, not the Java coder) so hopefully this example will illustrate what I'm trying to do:
<c:out value="${x}"/>
outputs to the page (artificially wrapped) as:
{width=96.0, orderedheight=160.0, instructions=TEST ONLY. This is a test.,
productId=10132, publication type=ns, name=John}
I can output the name by using
<c:out value="${x.name}"/>
no problems. The issue is when I try to get the "publication type"... because it has a space, I can't seem to get <c:out> to display it.
I have tried:
<!-- error parsing custom action attribute: -->
<c:out value="${x.publication type}"/>
<!-- error occurred while evaluating custom action attribute: -->
<c:out value="${x.publication+type}"/>
<!-- error occurred while parsing custom action attribute: -->
<c:out value="${x.'publication type'}"/>
<!-- error occurred while parsing custom action attribute: -->
<c:out value="${x.publication%20type}"/>
I know the real solution is to get the variable names formatted correctly (ie: without spaces) but I can't get the code updated for quite a while. Can this be done? Any help greatly appreciated.
Hi there,
I am in need of reorganizing a large CSV file. The first column, which is currently a 6 digit number needs to be split up, using comma's as the field separator.
For example, I need this:
022250,10:50 AM,274,22,50
022255,11:55 AM,275,22,55
turned into this:
0,2,2,2,5,0,10:50 AM,274,22,50
0,2,2,2,5,5,11:55 AM,275,22,55
Let me know what you think!
Thanks!
I'm adding hotkeys to a web application in order to enable keyboard shortcuts for our CSRs to use, to reduce injury and increase calls-per-hour. I'm using an ASP.net UserControl to inject javascript into the page and it's working great.
I want the control to "just work", so that when hotkeys are assigned, using a declarative syntax, if the hotkeyed letter exists in the link text, it will be highlighted automatically, so the developer doesn't have to do anything, and also to maintain consistency in visual cues.
Here's the code to assign hotkeys, if it matters:
<uc:HotKeysControl ID="theHotkeys" runat="server" Visible="true">
<uc:HotKey ControlName="AccStatus$btnInvoiceEverBill" KeyCode="ctrl+v" />
<uc:HotKey ControlName="AccStatus$btnRefund" KeyCode="ctrl+u" />
<uc:HotKey ControlName="thirdControl" KeyCode="ctrl+p" />
</uc:HotKeysControl>
I want something like:
<a href="whatever" name="thirdControl">Make a <span class=hotkey">P</span>ayment</a>
...but I'm not married to the idea of injecting a <span/> in there if there's a better way.
How can I do this in CSS or JQuery? Is there a way to pass in a letter to a CSS style and have it change the color of the text displayed? Should I generate javascript to highlight the text when the page loads?
What would/did you do in this situation?
I have a txt file on the server which contains 10 lines of text. The text file is rewritten sometimes, and I get new lines using "\r\n". My problem shows when I want to load the lines in javascript variables. I do it like this, but this work only for numbers or for the last line of the file, because its not using the breakline tag: var x = '<?php echo $file[0]; ?>';
Ive tried to alert(x) but it`s not working.... (working only if I read the last line)
Any idead ?