painting a Long Text at LABELFIELD? - blackberry

I have a long text for LabelField. But LabelField doesn't show all. I dont know how to fix it, what should I do?
I am using default labelfield.
manager
.add(new LabelField(
"IP kameranıza hemen bağlanmak için\n Ana Menüdeki \"Kameralarım\""
+ "butonuna tıklayınız. Açılan sayfadaki menüden \n\"Yeni Ekle\"yi seçip "
+ "kameranızın modelini, IP numarasını, port numarasını varsa kullanıcı adı ve şifresini "
+ "girip kayediniz. Eğer video server kullanıyorsanız \"Server Numarası\" "
+ "alanına izlemek istediğiniz kameranın numarasını(1,2,3 vb.) giriniz. "
+ "Normal bir IP kamera kullanıyorsanız \"Server Numarası\" alanını boş bırakınız. "
+ "Kamera listesinden istediğiniz kamerayı seçip menüden \"Izle\" seçeneğini "
+ "seçerek kameranızı izlemeye başlayabilirsiniz.Tam Ekran izlemek için "
+ "telefonunuzu yatay konumda tutunuz. Kameranızın PTZ özelliği varsa "
+ "ekranda görünen butonları kullanabilirsiniz.",
DrawStyle.HCENTER | USE_ALL_HEIGHT)

You want to use a TextField instead of a LabelField

Related

how to get youtuber video information in youtube api v3..?

i am working on a youtube based api website and want to get the complete information of a video.
i am doing this as
<?php $JSON_Data = json_decode(file_get_contents("https://gdata.youtube.com/feeds/api/videos/9Xhat18gkLw?v=2&alt=json")); ?>
and getting data using this method
channel is:<?php echo $JSON_Data->entry->author[0]->name->{'$t'}."<br>"; ?>description is:<?php echo $JSON_Data->entry->{'media$description'}->$t."<br>"; ?>published time:<?php echo $JSON_Data->entry->published->{'$t'}."<br>"; ?>duration time:<?php echo $JSON_Data->{'yt$duration'}->seconds."<br>"; ?>image link:<?php echo $JSON_Data->{'media$thumbnail'}[2]->url."<br>"; ?>title is:<?php echo $JSON_Data->entry->title->{'$t'}."<br>"; ?>
but i am successful in getting a few information like title, channel name and published time
channel is:Naatsworld
description is:
published time:2011-08-27T01:32:36.000Z
duration time:
image link:
title is:Owais Raza Qadri - Main So Jaon Ya Mustafa Kehte Kehte (Full Video Naat Album)!!!
i also want to get video duration, description and image link
please help me how to do this
See if this helps you lot :
<script type="text/javascript">
function youtubeFeedCallback(data) {
document.writeln('<img src="' + data.entry["media$group"]["media$thumbnail"][0].url + '" width="' + data.entry["media$group"]["media$thumbnail"][0].width + '" height="' + data.entry["media$group"]["media$thumbnail"][0].height + '" alt="Default Thumbnail" align="right"/>');
document.writeln('<b>Title:</b> ' + data.entry["title"].$t + '<br/>');
document.writeln('<b>Author:</b> ' + data.entry["author"][0].name.$t + '<br/>');
document.writeln('<b>Published:</b> ' + new Date(data.entry["published"].$t.substr(0, 4), data.entry["published"].$t.substr(5, 2) - 1, data.entry["published"].$t.substr(8, 2)).toLocaleDateString() + '<br/>');
document.writeln('<b>Duration:</b> ' + Math.floor(data.entry["media$group"]["yt$duration"].seconds / 60) + ':' + (data.entry["media$group"]["yt$duration"].seconds % 60) + ' (' + data.entry["media$group"]["yt$duration"].seconds + ' seconds)<br/>');
document.writeln('<b>Rating:</b> ' + new Number(data.entry["gd$rating"].average).toFixed(1) + ' out of ' + data.entry["gd$rating"].max + '; ' + data.entry["gd$rating"].numRaters + ' rating(s)' + '<br/>');
document.writeln('<b>Statistics:</b> ' + data.entry["yt$statistics"].favoriteCount + ' favorite(s); ' + data.entry["yt$statistics"].viewCount + ' view(s)' + '<br/>');
document.writeln('<br/>' + data.entry["media$group"]["media$description"].$t.replace(/\n/g, '<br/>') + '<br/>');
document.writeln('<br/>Watch on YouTube');
}
</script>
View demo

How to avoid Restart Bluetooth Printer after print?

I have developed windows mobile 6.1 application which search nearby Bluetooth devices and send files.Also I did print functionality to print document on Bluetooth printer.
First time print functionality is working perfectly fine but when I print the document again, then I need to restart the printer and then after it will print.
Is there any solution to avoid restart printer??
Below is my print code from reference of https://32feet.codeplex.com/discussions/355451
private void btPrint_Click(object sender, EventArgs e)
{
// Activate BT
BluetoothRadio.PrimaryRadio.Mode = RadioMode.Connectable;
System.Threading.Thread.Sleep(1000);
// Connect
BluetoothAddress btAddress;
btAddress = BluetoothAddress.Parse("0022583165F7");
BluetoothClient btClient = new BluetoothClient();
try
{
btClient.Connect(new BluetoothEndPoint(btAddress, BluetoothService.SerialPort));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
// Send data
string CPCLStr1 =
"! 0 200 200 210 1" + Environment.NewLine +
"ML 25" + Environment.NewLine +
"TEXT 7 0 10 20" + Environment.NewLine +
"Just" + Environment.NewLine +
"Testing" + Environment.NewLine +
"ENDML" + Environment.NewLine +
"FORM" + Environment.NewLine +
"PRINT" + Environment.NewLine;
// Convert CPCL String to byte array
byte[] CPCLbytes1 = ASCIIEncoding.ASCII.GetBytes(CPCLStr1);
NetworkStream ns = btClient.GetStream();
ns.Write(CPCLbytes1, 0, CPCLbytes1.Length);
btClient.Close();
}
Although you close the client stream, the printer seems to wait some time before it resets it's session.
Try to send a <EOF> or <EOT> byte at the end.
Acording to CPCL reference guide there is no simple reset command as with ESC/p for example ({esc}#).
Doing a device reset after every print seems an overkill.
EDIT: SDK sample for sendFile:
Byte[] cpclLabel = Encoding.Default.GetBytes("! 0 200 200 406 1\r\n" + "ON-FEED IGNORE\r\n"
+ "BOX 20 20 380 380 8\r\n"
+ "T 0 6 137 177 TEST\r\n"
+ "PRINT\r\n");
The above runs fine on my RW420 without the need to reset between prints.

Detecting memory leak in cocos2dx project for WP8

I want to locate few memory leaks in my cocos2dx application for windows phone 8. IDE is Visual studio express 2012. I saw this link for app profiling. But as written on the page, "Only the Execution option is available for Direct3D apps". I am not able to figure out the option for memory profiling as cocos2dx uses directx in windows phone. How should I detect memory leak?
You can detect the application memory usage by following code.
Add the following code in App.xaml.cs
public partial class App : Application
{
private static Timer timer = null;
public static void BeginRecording()
{
if (System.Diagnostics.Debugger.IsAttached)
{
// start a timer to report memory conditions every 2 seconds
timer = new Timer(state =>
{
// every 2 seconds do something
string report =
DateTime.Now.ToLongTimeString() + " memory conditions: " +
Environment.NewLine +
"\tApplicationCurrentMemoryUsage: " +
getExactValue(DeviceStatus.ApplicationCurrentMemoryUsage) + " MB" +
Environment.NewLine +
"\tApplicationPeakMemoryUsage: " +
getExactValue(DeviceStatus.ApplicationPeakMemoryUsage) + " MB" +
Environment.NewLine +
"\tApplicationMemoryUsageLimit: " +
getActualValue(DeviceStatus.ApplicationMemoryUsageLimit) + " MB" +
Environment.NewLine +
"\tDeviceTotalMemory: " + getActualValue(DeviceStatus.DeviceTotalMemory) + " MB" + Environment.NewLine +
"\tApplicationWorkingSetLimit: " +
getActualValue(Convert.ToInt64(DeviceExtendedProperties.GetValue("ApplicationWorkingSetLimit"))) + " MB" +
Environment.NewLine;
// write to IsoStore or debug conolse
Debug.WriteLine(report);
},
null,
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(2));
}
}
public static decimal getExactValue(long stats)
{
return Math.Round(((decimal)(stats) / (decimal)(1048576.00)), 2);
}
public static int getActualValue(long stats)
{
return ((int)Math.Ceiling(getExactValue(stats)));
}
now call the BeginRecording() function in application_launching.
this will give you the exact memory stats after every 2 seconds and you can identify the memory leaks.

alert message displaying while refresh the browser using pageregisterstartupscript

I am displaying alert message for un authenticated user but if refresh the browser the again alert is displaying.
ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language=JavaScript>" + Environment.NewLine + "alert(\"" + msg + "\")" + Environment.NewLine + ";</script>");
If(user.IsAuthenticated)
{
//do something
}
else
{
ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language=JavaScript>" + Environment.NewLine + "alert(\"" + msg + "\")" + Environment.NewLine + ";</script>");
}
depending on what technology you use if you just want to show the message the first time you load the page it works differently, I'm sorry if I'm prejudice if I say that I guess it's a WebForms application but then it should be something like
if(!IsPostBack)
{
ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language=JavaScript>" + Environment.NewLine + "alert(\"" + msg + "\")" + Environment.NewLine + ";</script>");
}

Google Analytics & Blackberry UserAgent

I'm using this code to get the blackberry info on google analytics
private static String getUserAgent()
{
String userAgent = "Blackberry" + DeviceInfo.getDeviceName() + "/" +
getOsVersion() + " Profile/" + System.getProperty(
"microedition.profiles" ) + " Configuration/" + System.getProperty(
"microedition.configuration" ) + " VendorID/" +
Branding.getVendorId();
return userAgent;
}
And then using it here :
conn.setRequestProperty("User-Agent", userAgent);
The problem is that it doesn't recognize the terminal like a mobile phone , but it takes difference in browser .
Browser:
Navegador Visitas % Visitas
1. Blackberry8900 36 100,00%
Any idea if google analytics have some params to know that is a mobile phone ? or if i'm using a badformated useraggent.
Thanks for your answers.

Resources