Posts

c# - Monodroid - Set Custom font -

i using monodroid make app , can't figure out how make custom font. below code textview text = findviewbyid<textview>(resource.id.tvchange); typeface tf = typeface.createfromasset(assets,"fonts/gt.otf"); text.settypeface(tf); there no getassets() in monodroid have no idea if typeface correct, , text.settypeface(tf); expects 2 arguements, second don't know. thanks i found out problem here code below typeface tf = typeface.createfromasset(application.context.assets, "fonts/gt.otf"); textview explodevin = findviewbyid<textview>(resource.id.tvexvin); explodevin.settypeface(tf,typefacestyle.normal);

c# - ASP NET MVC array in controller to client side array -

my question how ( if possible ) array string[] a; pass view through viewbag , how can obtain javascript array of strings. i want use because set of data db , want in view make chart , need javascript array. it's easy "render" array javascript object, using string.join or similar: @{ viewbag.a = new int[] { 1, 2, 3 }; viewbag.b = new string[] { "a", "b", }; } <script type='text/javascript'> // number array var = [ @(string.join(", ", (int[])viewbag.a)) ]; console.log(a); // [1, 2, 3] // string array -- use html.raw var b = [@html.raw("'" + string.join("', '", (string[])viewbag.b) + "'")]; console.log(b); </script>

emacs - Shell prompt repeating when using ssh in ansi-term -

when use ssh login ubuntu 12.04 machine ansi-term session in emacs prompt displays incorrectly: 0;ubuntu@jumplin: ~ubuntu@jumplin:~$ this should following: ubuntu@jumplin:~$ i've tried few of suggestions in relation utf-8 , colour support don't seem working (colour works fine in ansi-term): strange characters in ansi-term in emacs i think might have unsupported ansi escape code or that, i'm not sure - value of ps1 terminal session is: \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ any advice appreciated :) seem bit lost when strange characters show in terminal sessions. \[\e]0;\u@\h: \w\a\] in prompt configure xterm(?)'s title bar. though ansi colorization supported ansi-term , escape sequences manipulate title bar not. why see prompt repeated twice - first section supposed go title bar. so either remove first sequence ps1 or similar suggested in bash prompt howto : function proml { case $term in xterm*) lo...

bash - Extracting a word from the middle of a sentence -

i have log file this: 2013-07-10 21:40:54 [info] janus_mesca joined game 2013-07-10 21:40:54 [info] fenlig joined game 2013-07-10 21:41:21 [info] bigredhoodie joined game i'm trying print whatever appears in between "[info]" , "joined". with attempts i've been able remove 2 words themselves. tail -500 $rfile | grep "info.*joined game" | \ sed -e 's/\[info\]\(.*\)joined/\1/' can help? pure grep version lookahead/lookbehind. p.s. option -p might not available everywhere, thought clever. tail test.log | grep -po '(?<=\[info\] ).*(?= joined .*)'

Convert an image into digits with PHP? -

Image
i trying figure out how can convert color image numbers. for example, if have image 1 shown in figure (b) , how can output figure (a) in text file? i took in here mehdi karamosly mentioned in answer , modified little bit simipiler , made simple html output can modify outputs liking. might want add more data checking make sure file/real image if looking add security. i've checked out on computer , works , work need modification(s). function graycolor($img){ list($width, $height) = getimagesize($img); $mime = pathinfo($img, pathinfo_extension); switch($mime){#use appropriate function depending on image type case 'jpg': case 'jpeg': $im = imagecreatefromjpeg($img); break; case 'png': $im = imagecreatefrompng($img); break; case 'gif': $im = imagecreatefromgif($img); break; default: #invalid type ...

cmusphinx - Exception loading pocketsphinx_jni while running PocketSphinxDemo on Android device -

i've been trying pocketsphinx demo android running on device couple days now. whenever try run demo, however, error in logcat: fatal exception: main java.lang.exceptionininitializererror @ java.lang.class.newinstanceimpl(native method) then bunch of more errors, important last 1 is @ edu.cmu.pocketsphinx.demo.pocketsphinxdemo.<clinit>(pocketsphinxdemo.java.18) line 18 in pocketsphinxdemo.java is system.loadlibrary("pocketsphinx_jni"); when go pocketsphinx_jni folder, located in /pocketsphinxandroiddemo/obj/local/armeabi/objs-debug, appears empty. running ubuntu, if @ relevant. there should in folder? causing error? sort of answer appreciated. when go pocketsphinx_jni folder, located in /pocketsphinxandroiddemo/obj/local/armeabi/objs-debug, appears empty. system.loadlibrary doesn't load folder, loads library. libpocketsphinx_jni.so library built ndk-build during build process. objs-debug/pocketsphinx_jni temporary fo...

jquery - If validation condition is met, then run main chat code after clicking button -

how can make main chat code only run if validation passed (i.e. fields not contain default values or empty) after user clicks on sendmessage button? right main chat code runs anyway whether validation passed or not. // main chat code $(function () { var iwannachat = $.connection.mychathub; iwannachat.client.addmessage = function (message) { $('#listmessages').append('<li>' + message + '</li>'); }; $("#sendmessage").click(function () { iwannachat.server.send($('#ideabody').val()); }); $.connection.hub.start(); }); // handling default values , validation $(function () { $('#ideatitle, #ideabody').each(function () { $.data(this, 'default', this.value); }).focus(function () { if (!$.data(this, 'edited')) { this.value = ""; } }).change(function () { $.data(this, 'edited', this.value != ...