Monday, 19 August 2013

A passage from a news article..what does this mean?

A passage from a news article..what does this mean?

I found this sentence. I don't understand this.
This is the link.
http://thediplomat.com/flashpoints-blog/2013/08/12/can-india-blockade-china/
Fourth, and finally, the debate over how to respond to China is valuable
because, in being sparked by the decision to raise a mountain corps, it
has been couched as a trade-off, and therefore brings the question of
priorities to the forefront.
What does this mean in the context of this article...The meaning is very
ambiguous.

How to configure wso2 servers logging the same level of detail as console output in wso2carbon.log file

How to configure wso2 servers logging the same level of detail as console
output in wso2carbon.log file

When we run the bin/wso2server.sh file in a terminal, we get nice verbose
logging output in the same terminal which is very useful for debugging.
But the output in the repository/log/wso2carbon.log file is minimal. I
have checked all the other files in the repository/log/ directory and none
have the same level of verbosity as the console output.
I tried settings under Home > Configure > Logging after logging in to the
management console of wso2 application server. Specifically I set the
settings for "Configure Log4J Appenders" for CARBON_LOGFILE to be the same
as for CARBON_CONSOLE but this did not have desired effect. The web
application level info and debug messages are shown on the terminal from
where we started the wso2 application server but this is not shown in the
wso2carbon.log file.
How do we get the same level of detail i.e. verbose output like we get in
the terminal into the repository/log/wso2carbon.log file?

Sunday, 18 August 2013

how to stream a response over HTTP with netty

how to stream a response over HTTP with netty

I'm using Netty 3.6.6 and I'd like to send a large response back to the
caller. I can't copy the response body into a ChannelBuffer as in some
cases it will be very large.
I'm migrating a server from CXF to Netty, previously, I could just use the
OutputStream provided by CXF to write the data.
I originally tried to just send the response without content, and then
continued to write data to the Channel in a series of 8k buffers. This
failed as the client seemed to get the original response and see no data
and complain. I tried setting the response as chunked, but this didnt seem
to make a difference, nor did setting the chunked header, the client
always saw an empty stream.
I saw the file server example for 3.6.6, and that's similar to what I want
to do, except the data will not be a file. I saw the ChunkedStream &
NioStream, which seemed close to what I need, except they take
InputStream/ReadableByteChannel whereas I have an OutputStream; I could
try using the PipedInput & OutputStreams, but that seems like it would
introduce an unfortunate bottleneck.
I'm sure there's a way to stream a lot of data back to the client in
response to a request, but I'm just not seeing how to do it unless I have
a file.

New to Powershell, unfamiliar with scripts. Renaming files in a batch with a counter

New to Powershell, unfamiliar with scripts. Renaming files in a batch with
a counter

I found several answers on this site about renaming files in Powershell so
I'm sorry if this is a repeat. I've spent a good 5 hours on google and
various websites trying to figure this out. I really did try to explain
well.I am not a programmer just someone that is meticulous about their
filing. I have 14,000 picture sorted into files by year and month but
taken with multiple cameras and I want the file name to reflect the date
taken. For example October 16, 1998 pictures are in a folder called 1998
subfolder 10 October subfolder 19981016. I want the all the pictures to be
named 19981016_0001 19981016_0002 etc. I tried multiple suggestions but it
hasn't worked. Probably due to my lack of programmer knowledge haha. Could
someone help me out and give me dummy instructions? I can get to the point
where it list the folder I want to change but I'm unable to actually
change it. All of my pictures are .jpg. I tried to attach a screenshot of
what I did but unfortunately I can't since I'm too new here. Thanks in
advance!
I created a temp file of copies in case I messed it up. I started by
typing cd "C:\Documents and Settings\Brooke LastName\Desktop\Temp" then
after successfully getting my file to load I used a formula I found on
this forum.
ls *jpg | Foreach {$i=1} {Rename-Item _ -NewName
("$($.19981016){0:00000000#} .jpg" -f $i++) -whatif}
The error I got said
Unexpected token ' .19981016' in expression or statement.
At line:1 char:12 + $.19981016 <<<<
The error repeated several times
I found several formulas on the web but most created files that would
number with parenthesis for example vacation (1).jpg I want a four digit
counter after an underscore at the end of my date. ie 19981016_0001

Isend/Irecv doesn`t work but Send/Recv does

Isend/Irecv doesn`t work but Send/Recv does

When I use Send/Recv my code works but when I replace Send/Recv with
Isend/Irecv it yields segmentation fault. But before going anywhere else I
wanted to verify whether the following snippet seems alrite or not.
The rest of the code should be fine as Send/Recv works; but I have pasted
here as its long.
DO I=1,52
REQ(I)=MPI_REQUEST_NULL
ENDDO
IF (TASKID.NE.0) THEN
NT=TASKID
CALL
MPI_ISEND(RCC(IIST:IIEND,JJST:JJEND,KKST:KKEND),SIZE(RCC),MPI_DOUBLE_PRECISION,0,8,MPI_COMM_WORLD,REQ(NT),IERR)
ENDIF
IF (TASKID.EQ.0) THEN
DO NT = 1,26
CALL
MPI_IRECV(CC(RSPANX(NT):RSPANXE(NT),RSPANY(NT):RSPANYE(NT),RSPANZ(NT):RSPANZE(NT)),SIZECC(NT),MPI_DOUBLE_PRECISION,NT,8,MPI_COMM_WORLD,REQ(NT+26),IERR)
ENDDO
ENDIF
CALL MPI_WAITALL(52,REQ,ISTAT,IERR)

echo part of a json code

echo part of a json code

I'm using imgur API to upload an image and then I'd like to echo the link
of the image. Here is the code:
<?php
$client_id = 'xxxxxxxxxxx';
$file = file_get_contents("http://mywebsite.com/image.jpeg");
$url = 'https://api.imgur.com/3/image.json';
$headers = array("Authorization: Client-ID $client_id");
$pvars = array('image' => base64_encode($file));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL=> $url,
CURLOPT_TIMEOUT => 30,
CURLOPT_POST => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $pvars
));
$json_returned = curl_exec($curl); // blank response
echo $json_returned;
curl_close ($curl);
?>
The json_returned is something like this:
{"data":{"id":"93MubeE","title":null,"description":null,"datetime":1376842908,"type":"image\/jpeg","animated":false,"width":2197,"height":1463,"size":70884,"views":0,"bandwidth":0,"favorite":false,"nsfw":null,"section":null,"deletehash":"bk5k8HrAeH8aOtW","link":"http:\/\/i.imgur.com\/93MubeE.jpg"},"success":true,"status":200}
How can I echo image's url only? Thank you!

DragNDropListView Custom List view setItemChecked not working

DragNDropListView Custom List view setItemChecked not working

I have found a library on github https://github.com/terlici/DragNDropList
which implements listView among other things.
One particular issue is that setItemChecked doesn't update the UI. I have
checked all the usual gotchas like calling notifyDataSetChanged and
CHOICE_MODE_MULTIPLE
Is there any known quirk with android where setItemChecked doesn't work
properly with classes that implement listView?