Posts

Showing posts from March, 2013

.htaccess rewrite with file path as parameter -

i have following working: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d ### rewrite url ### # basic rewrite pages in admin area rewriterule ^admin/([a-z/]*)$ /private/admin/index.php?path=$1 [l,qsa] so url someting like: admin/overview/overview making overview/overview path. working fine add parameter used id (for deleting / editing). added following rule: rewriterule ^admin/([a-z/]*)/([a-za-z0-9]*)$ /private/admin/index.php?path=$1&id=$2 [l,qsa] this not working: admin/overview/overview/34 behind admin/ seen path including 34 . when tried: rewriterule ^admin/([a-z/]*)-([a-za-z0-9]*)$ /private/admin/index.php?path=$1&id=$2 [l,qsa] making url admin/overview/overview-34 , still didn't work. tried place line on different locations (before , after rewriterule ^admin/([a-z/]*)$ /private/admin/index.php?path=$1 [l,qsa] ) i hope can me problem or give me alternative way of doing this. this should work :

ruby on rails - Constructing a 1-many relationship with custom string foreign keys in PGSQL ActiveRecord -

i have following tables (showing relevant fields): lots history_id histories initial_date updated_date r_doc_date l_doc_date datasheet_finalized_date users username so rebuilding exisiting application dealt rather large amount of bureaucracy, , needs keep track of 5 separate dates (as shown in histories table). problem having don't know how best model in activerecord, historically it's been done having histories tables represented so: histories initial_date updated_date r_doc_date l_doc_date datasheet_finalized_date username where 1 of 5 date fields ever filled @ 1 time...which in opinion terrible way go modeling this... so want build unique queryable connection between every date in histories table , specific relevant user. possible use every timestamp in histories table foreign key query specific user? i think there's simpler approach you're trying accomplish. sounds want able query each lot , find 'relevant user&

mysql - Mysqldump creates a dump with a broken encoding -

when i'm trying make full dump of database follows: mysql --default-character-set=utf8 -uuser -p database -r output.sql it creates utf-8 file international data (chineese,spanish,russian) corrupted follows(it's russian part of dump): (1,'Ð<9e> наÑ<81>') however, when try dump 1 table, works fine: mysql --default-character-set=utf8 -uuser -p database table_name -r output.sql i don't quite understand causes issue possible variables set utf-8: show variables "collation_database"; +--------------------+-----------------+ | variable_name | value | +--------------------+-----------------+ | collation_database | utf8_general_ci | +--------------------+-----------------+ show variables "character_set_database"; +------------------------+-------+ | variable_name | value | +------------------------+-------+ | character_set_database | utf8 | +------------------------+-------+ all tables have same

google cardboard - Getting Exception on Surface Change -

got below stacktrace part of crash report. it looks problem specific 1 type of device oneplusone. pointers helpful. anyone if want test app on device vr photo viewer stacktrace: java.lang.illegalargumentexception: bitmap recycled @ android.opengl.glutils.teximage2d(glutils.java:112) @ org.rajawali3d.materials.textures.asingletexture.add(asingletexture.java:186) @ org.rajawali3d.materials.textures.texturemanager.taskadd(texturemanager.java:110) @ org.rajawali3d.materials.textures.texturemanager.taskreload(texturemanager.java:209) @ org.rajawali3d.renderer.rajawalirenderer.onrendersurfacesizechanged(rajawalirenderer.java:362) @ org.rajawali3d.vr.renderer.rajawalivrrenderer.onsurfacechanged(rajawalivrrenderer.java:88) @ com.google.vrtoolkit.cardboard.cardboardviewjavaimpl$stereorendererhelper.onsurfacechanged(cardboardviewjavaimpl.java:931) @ com.google.vrtoolkit.cardboard.cardboardviewjavaimpl$rendererhelper.onsurfacechanged(cardboardviewjavaimpl.java:716) @ android.opengl.gl

angularjs - get previous scope in ng-repeat -

is there better way 1 previous scope ng-repeat inside directive? view <div ng-repeat="item in items track $index"> <div my-directive> item {{ $index }} </div> </div> directive .directive('mydirective', function(){ return { restrict : 'a', link : function(scope){ //get scope of previous item var previousscopetext = scope.$parent.items[scope.$index - 1].val(); } }; }); the purpose faster , not pass trough parent. any ideas?

Posting a JSON object to a REST API using PHP -

i have found couple of helpful links on stackoverflow haven't helped me complete task because complete beginner in trying write php or use curl etc. send json post using php posting json data api using curl i have been using postman in chrome test api calls want put demo system on apache web server. does have example of php webform posting json object rest api? here example of want send: <?php $url = "https://api.url/api/v1//accounts/create"; $jdata = json_encode($data); $data = [{ "status": "active", "username": ["uname"], "password": ["pword"], "attributes": { "forenames": ["fname"], "surname": ["lname"], "emailaddress": ["email"] }, }] ?> any advice fantastic. said, new curl , php, unfamiliar array approach mentioned in other articles , ["info"] elements should

MIPS Compiler local variables -

i'm writing tinyc compiler translates mips assembly. i'm stuck question how implement local variable handling. following example makes hard think of proper solution: int* funca() { int = 3; return &a; } int main() { return *(funca()); } normally create local variable on stack. in case 'int a' created on stack. problem in end want return address of 'a' , not value &a. in moment leave 'funca()' reset stack old state , pointer return in end not valid anymore , show later nirvana. my first attempt handle registers, &-operator translate this: .globl funca funca: addiu $sp, $sp, -4 # save return address sw $ra, ($sp) addiu $sp, $sp, -4 # save reg use further processing sw $s0, ($sp) addiu $t0, $zero, 3 # $t0 = , add 3 la $s0, ($t0) la $t0, ($s0) sw $t1, ($t0) # crashes here la $v0, ($t1) # put result in $v0 lw $s0, ($sp) addiu

angularjs - Fading modals in Angular -

i using excellent sexy bootstrap modal angular , have encountered problem. i opening new modal after sexy full-screen modal closes. however, residue of sexy modal - background - remains until new modal closes. there way hook event sexy modal fires when modal finishes closing? don't want set timer, bit dirty... any ideas appreciated.

javascript - grunt csscomb not processing all scss files -

i've tried set grunt csscomb task, i'm not sure if i'm getting globbing pattern right: csscomb: { dynamic_mappings: { expand: true, cwd: 'app/', src: '**/*.scss', dest: 'app/assets/tempcomb' }, options: { config: 'csscomb.json' } }, here folder architecture: app ├── assets │   ├── css │   │   ├── imports │   │   │   ├── helpers │   │   │   │   └── _helpers.scss │   │   │   ├── layout │   │   │   │   ├── _fonts.scss │   │   │   │   ├── _grid.scss │   │   │   │   └── _reset.scss │   │   │   └── modules │   │   │   ├── _dev.scss │   │   │   ├── _indicators.scss │   │   │   ├── _modal.scss │   │   │   ├── _nav.scss │   │   │   └── _ref.scss │   │   ├── main.scss │   │   └── pages │   │   ├── bibliography.scss │   │   ├── cover.scss │   │   ├── example.scss │   │   ├── examples │   │   │   ├── _bar-graph.scss │   │   │   ├── _modal-transitio

java - Spring Boot + Tomcat ignoring server.port property? -

i'm trying spring boot application , running small configuration changes, can't seem port listen correctly. seems server.xml tomcat instance loads overwrites application.properties file specifies. application.properties: logging.level.app = trace logging.file = /tmp/my-server.log server.port = 8081 when deploy /usr/local/tomcat/webapps, can access server, on port 8080. seems ignore server.port property. believe server picking properties file correctly since logging correctly goes /tmp/my-server.log the end goal have server listen on port of choice when running in amazon elastic beanstalk. can update ports on load balancer, if server listen on it's pre-configured port, won't matter. thanks ahead of time help! osx yosemite, tomcat 8.0.24, spring boot v1.2.4 spring boot properties server.port take effect if use embedded tomcat. is, if start application executing main method springapplication.run() in or creating executable jar , starting jav

xml - Android ImageView causing whitespace at the bottom -

my code below causing whitespace @ bottom of image. wanted image cover entire screen, somehow isn't. <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity"> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:src="@drawable/ohm" android:layout_width="match_parent" android:layout_height="match_parent" android:scaletype="centercrop" android:adjustviewbounds="true"/> <imageview android:id="@+id/logo" android:src="@drawable/test2" android:layout_width="70dp" androi

linux - why doesn't watch work when piping the output of fortune into cowsay -

cowsay silly linux tool displaying cow saying given text in terminal. $ cowsay hello fortune silly linux displaying "random" quote in terminal. $ fortune both of these commands can repeatedly ran in terminal using watch e.g. $ watch cowsay hello $ watch fortune additionally these 2 commands can combined cow says "random" quotes. piping output of fortune cowsay. $ fortune | cowsay however combination of use of watch , piping output of fortune cowsay doesn't anything.... i.e. hangs until process ended $ watch fortune | cowsay does know why? with watch fortune | cowsay piping output of watch fortune cowsay . want watch value of fortune piped cowsay should quote watch whole command execute as watch 'fortune | cowsay'

gnat - Building Ada Web Server fails -

i trying build aws gpl 2015, error: $ make setup build gprbind xoscons.bexch gnatbind xoscons.ali gnatgcc -c b__xoscons.adb gnatgcc xoscons.o -o xoscons setup os specific definitions can not generate system tags. test disabled aws.gpr:76:04: package "install" forbidden in aggregate projects gprbuild: "tools/tools.gpr" processing failed makefile:183: recipe target 'build-native' failed make: *** [build-native] error 4 i using gnat: $ gnat --version gnat 4.9.2 copyright 1996-2014, free software foundation, inc. that version of aws requires 'gprinstall', should compile gnat gpl 2015 needed tools.

html - php eamil not sending the data -

hey there have small problem when send email revive <br> see , <form> not sending anything. thank in advance php <?php if (!isset($_post['submit'])){ $companyname = $_post['company name:']; $companynumber = $_post['company number:']; $ypozition = $_post['your pozition:']; $f_name = $_post['first name:']; $l_name = $_post['last name:']; $m_name = $_post['middle name:']; $mail = $_post['email address:']; $phone = $_post['phone number:']; $postcode = $_post['post code:']; $snumber = $_post['street number:']; $sname = $_post['street name:']; $advert = $_post['advert from:']; $comm = $_post['comments:']; $to = 'rlafrem@gmail.com'; $from = '$companyname'; $subject = '$f_name'; $message = "<br>$companyname<br><br>$companynumber<br><br>$ypozition<br><br>$f_n

javascript - div fade-in when window is scrolled a certain distance from the top -

i have following script in <head> tag animates div when window 150px bottom. not sure how alter animates when distance top. <script> $(window).scroll(function() { if($(window).scrolltop() + $(window).height() == $(document).height()-150){ isshown = true; $('.footer-btn').fadein(500); }else{ $('.footer-btn').fadeout(500); } }); </script> here's jquery script use in site set animation top. change value of offset() control fade-in activation position. jquery(document).ready(function($) { // browser window scroll position (in pixels) button appear // adjust number select when button appears on scroll-down var offset = 200, // duration of animation (in ms) scroll_top_duration = 700, // bind button link $animation = $('.animation'); // display or hide button $(window).scroll(function() { ($(this).scrolltop() > offset) ? $animation.addclass('visible

Can't find Visual Studio Code on windows 8.1 not in start screen -

just installed visual studio code, , noticed can't find searching in start screen. the default installation location in %appdata%, default isn't indexed windows. what's solution this? i've read adding %appdata% indexing can slow down considerably because of sheer number of files there. i experienced same thing on windows 10, , learned: i found it's in: c:\users\ username \appdata\local\code\ appversion \code.exe where username username on computer, , appversion version of code installed (example, folder app-0.5.0 in c:\users\user1\appdata\local\code\app-0.5.0\code.exe i right-clicked on code.exe , chose "pin start" , can launch vs code start menu. what's stranger (to me), code installed user directory of user account i'm not logged @ moment. have user1 , user2. i'm logged in user1. code installed in user2's appdata directory!

javascript - In AngularJS, after clicking a button, how to retrieve one of the two Json files and put it in $scope variable? -

for example, there 2 json files: json file #1: [{colorname:blue},{colorname:blue}] json file #2: [{colorname:red},{colorname:red}] in controller, there variable $scope.color in html, there 2 buttons, 1 called "colorblue". other 1 called "colorred". what want is: when clicking button "colorblue", $scope.color variable equals json file #1; when clicking button "colorred", $scope.color variable equals json file #2. thanks in advance! you can bind function button click event. function called in $scope : function main($scope) { var file1 = [{ colorname: "blue" }, { colorname: "blue" }]; var file2 = [{ colorname: "red" }, { colorname: "red" }]; $scope.color = null; $scope.file = function(a) { switch (a) { case 1: $scope.color = file1; break; case 2: $scope.color = file2; break;

java - How to store RSA Private Key on android app -

i did @ post: cannot generate rsa private key on android did not work me. my idea encrypt access token using rsa encryption , store private key on device. have encrypted token using rsa lost best place store key is. tried storing using keystore, not know enough debug why not working. keep getting error: java.security.unrecoverablekeyexception: no match. my keys match, again, no idea whats wrong not know enough this. using setentry , storing private key in weird , wonderful ways im sure, if worked not have been same key when returned. what best way store private key , where??? i no security expert advice on appreciated if should rather use aes? my code below, using 1 activity. package com.example.rsatest; import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.security.key; import java.security.keypair; import java.security.keypairgenerator; import java.security.keystore; import java.security.keystore.loadstoreparameter; import

How to delete a node from XML using XML::Simple in perl -

i need delete node xml using xml::simple my xml like: <install> <version > <number>6.0</number> <build>1014445</build> <path>path</path> <kind>native</kind> </version> <version > <number>6.1</number> <build>1025654</build> <path>path</path> <kind>native</kind> </version> </install> i need delete node matching particular number under version, need delete node number=6.0. updated xml like:- <install> <version > <number>6.1</number> <build>1025654</build> <path>path</path> <kind>native</kind> </version> </install> pardon me if question duplicated, new perl. this solution using xml::twig . said in comment, xml::simple module not choice unless have no choice xml::twig uses subset of xpath, expression used find required version element different 1 in xml::libxml

javascript - ng-submit doesnt send data, why? -

http://yeoman.io/codelab/write-app.html i following yeoman tutorial. doesnt work same. it doesnt add new todo in $scope.todos , couldnt find why. you can find code here: http://www.beratuslu.com/share/mytodo.rar what noticed is, after clicked submit button comes in $scope.addtodo function empty value. value not coming form, instead inside of mainctrl so, kind of there no link between form , mainctrl. whats wrong? thank you.. index.html <!doctype html> <html class="no-js"> <head> <meta charset="utf-8"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <!-- place favicon.ico , apple-touch-icon.png in root directory --> <!-- build:css(.) styles/vendor.css --> <!-- bower:css --> <!-- endbower --> <!-- endbuild --> <!-- build:css(.tmp) s

javascript - Embed API -> Multiple Dimensions through Datatable -

can me debugging code? want have multiple dimensions in google chart data google analytics. have line chart x-axis: date , 2 data (unique users & app version). have code: gapi.analytics.ready(function() { /** * authorize user if user has granted access. * if no access has been created, render authorize button inside * element id "embed-api-auth-container". */ gapi.analytics.auth.authorize({ container: 'embed-api-auth-container', clientid: 'xxx' }); /** * create new viewselector instance rendered inside of * element id "view-selector-container". */ var viewselector = new gapi.analytics.viewselector({ container: 'view-selector-container' }); // render view selector page. viewselector.execute(); /** * reports. */ var report = new gapi.analytics.report.data({ query: { ids: 'ga:104696078', metrics

arm - Boot Linux in Normal World -

i exploring trustzone (the arm security extension) on i.mx53 quick starting board. succeeded make bare-metal system : secure world image , normal world image. load 2 images in ram u-boot , boot secure world who initializes monitor system , gives hand normal world image. i want use same system. time instead of using normal world basic image, use linux kernel image . did configurations found in i.mx53 reference manual , i.mx53 security reference manual when in secure world. configurations : configure csu : csl0-31 0x00ff_00ff configure tzic (interrupts) tzic_intsec0-3 0xffff_ffff , tzic_priority0-31 0x1f1f_1f1f , tzic_intctrl 0x8001_0001 configure secure configuration register : ns=0 irq=0 fiq=0 ea=0 fw=1 aw=1 => 0x30 when give hand linux kernel, boot process starts, here part of output : regulator: core version 0.5 net: registered protocol family 16 i.mx iram pool: 128 kb@0xec840000 failed release iram partition cpu i.mx0 revision 0.0

Get Python type of Django's model field? -

how can corresponding python type of django model's field class ? from django.db import models class mymodel(models.model): value = models.decimalfield() type(mymodel._meta.get_field('value')) # <class 'django.db.models.fields.decimalfield'> i'm looking how can corresponding python type field's value - decimal.decimal in case. any idea ? p.s. i've attempted work around field's default attribute, won't work in cases field has no default value defined. i don't think can decide actual python type programmatically there. part of due python's dynamic type. if @ doc converting values python objects , there no hard predefined type field: can write custom field returns object in different types depending on database value. doc of model fields specifies python type corresponds each field type, can "statically". but why need know python types in advance in order serialize them? serialize modules sup

python - Aggregate by count, keep all columns in Pandas -

here example pandas dataframe: x = pd.dataframe({"id": [10, 10, 20, 10, 50, 50], "name": ["a", "a", "b", "a", "c", "c"]}) i show want do, using data.table in r: x = data.table(id = c(10,10,20,10,50,50), name = c("a", "a", "b", "a", "c", "c")) x[, .n, = list(name, id)] which outputs: name id n 1: 10 3 2: b 20 1 3: c 50 2 i can similar pandas, can't keep id column: x["name"].value_counts() returns: a 3 c 2 b 1 dtype: int64 try length of each sub-group identified ['id', 'name'] , , return group key index. x.groupby(['id', 'name'], as_index=true).agg(len) id name 10 3 20 b 1 50 c 2 dtype: int64

c# - Entity Framework - Using Navigation Properties over Joins -

i'm working entity framework on legacy database no relationships. our queries written linq joins. are there advantages (and maybe disadvantages) adding associations in model , writing our queries navigation properties? had no luck far finding straightforward answer question , want know if it's worth effort. i believe there no benefit performance wise if query generated navigation properties similar join query. i listed believe pros , cons of navigation properties compared joins : pro queries lot shorter , more readable because mappings of keys hidden object relationships automatically provided results hierarchical , not flattened con creating query include-statements can take longer (see 8.2.2 in interesting link performance considerations entity framework 4, 5, , 6 ) actually, you've answered question. of course, queries using navigation properties more convenient, queries join s. concerning include s - overusing of include analogue of

html - Create a border on a triangle -

i apply border on arrow (not div) after each list element. white , not visible in fiddle. https://jsfiddle.net/smks/faadd5r5/ html: <div class="content"> <div class="steps-container"> <ol class="steps"> <li class="step step1 current"> <div class="step-content"> <div class="step-number step-number-first">1</div> <span class="step-details">step 1</span> </div> </li> <li class="step step2 "> <div class="step-content"> <div class="step-number">2</div> <span class="step-details">step 2</span> </div> </li> <li class="step step3 "> <div class="step-content">

Grails synchronize execution of service method -

i trying add files (blog)post domain object. file uploader allows send multiple ajax requests 1 each file in parallel. how can best take care of synchronization on server side? to avoid: could not synchronize database state session org.hibernate.staleobjectstateexception: row updated or deleted transaction (or unsaved-value mapping incorrect): i doing in grails service with: static scope = "session" this didn't needed.

groovy - Why are my Elasticsearch shards sporadically failing when running queries against my alias filter? -

i running elasticsearch v.1.6 setup 2 nodes, , index 5 shards. index, have added alias contains reference index, groovy script filter helps avoiding documents invalid start , end dates. alias looks this: "myindex" : { "aliases": { "myindex_alias": { "filter" : { "script":{ "script": "\r\n entrydate = doc['availability.start'].date.getmillis(); \r\n exitdate = doc['availability.end'].date.getmillis(); \r\n rightnow = datemidnight.now().getmillis(); \r\n\r\n if (entrydate < rightnow && exitdate > rightnow)\r\n { \r\n return true; \r\n } \r\n return false;", "lang":"groovy"}}}}} when pe

Python list write to CSV without the square brackets -

i have main function: def main(): subprocess.call("cls", shell=true) iplist,hostlist,manflist,masterlist,temp = [],[],[],[],[] iplist,hostlist,manflist, = getips(),gethosts(),getmanfs() entries = len(hostlist) = 0 in xrange(i, entries): temp = [[hostlist[i]],[manflist[i]],[iplist[i]]] masterlist.append(temp) open("output.csv", "wb") f: writer = csv.writer(f, delimiter=',') writer.writerows(masterlist) my current output writes csv objective remove square brackets. i tried using .join() method understand takes single lists , not nested lists. how can achieve given i'm using 3 dimensional list? note, intend add more columns of data in future. edit: my current output 1 row similar to: ['name1,'] ['brand,'] ['1.1.1.1,'] i be: name1, brand, 1.1.1.1, try remove bracket values in temp while creating masterlist , because ne

sql - Checkboxes with PHP & SQLExpress Server 2008 -

i have local application reads data local sql server, works select queries , outputting text in table i'm having difficulty outputting checkbox status either checked or unchecked :( see code: <?php while( $row2 = sqlsrv_fetch_array( $stmt2, sqlsrv_fetch_assoc) ) { echo "<tr>"; echo "<td>" . "<input class=form-control id=input-readonly type=text name=supcode value=" . $row2['column1'] . " readonly></td>"; echo "<td><input type=checkbox" . if ($row2['checkbox_column1'] ==1) echo "checked='checked'>" . "</td>"; echo "</tr>"; } sqlsrv_free_stmt( $stmt2); ?> the checkbox_column1 column bit datatype any guidance appreciated, thank you! you aren't closing input if checkbox column empty. concatation noted won't work if . try updating to:

php - Why does Wordpress add_menu not work when seperated from Initial plugin page? -

so i'm working on very basic plugin wordpress. copied following internet menu item plugin named menu.php <?php /* plugin name: test plugin description: test plugin demonstrate wordpress functionality author: simon lissack version: 0.1 */ defined( 'abspath' ) or die( 'no script kiddies please!' ); add_action('admin_menu', 'test_plugin_setup_menu'); function test_plugin_setup_menu(){ add_menu_page( 'test plugin page', 'test plugin', 'manage_options', 'test-plugin', 'test_init' ); } function test_init(){ echo "<h1>hello world!</h1>"; } ?> this works expected it's stand alone plugin. have different plugin <?php /* plugin name: plugin description: blah blah author: me version: 0.1 */ defined( 'abspath' ) or die( 'no script kiddies please!' ); fun fun database work on register_activation_hook ?> the problem i'd have in 1 plugin not

jquery - How to pass context to method in a callback from event handler? -

i've written event handlers in jquery this: $('.some-class').click(function() { alert('bla'); }); i learnt better avoid using anonymous functions in callback, i'm trying way: var function somemethod = function() { alert('bla'); }; $('.some-class').click(somemethod); how can pass reference element clicked on somemethod ? use this : var somemethod = function() { console.log(this); // => <button class="some-class">ok</button> console.log($(this).text()); // => ok }; $('.some-class').click(somemethod); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button class="some-class">ok</button>

CMake trouble with Boost 1.58 on Debian Wheezy -

debian wheezy comes boost 1.49, need use newer version (>=1.50). standard way ? i've installed boost 1.58 /usr/local, set boost_root /usr/local, cmake can't find it, old 1.49 in /usr. can ? i have similar situation on ubuntu 14.04 - default boost 1.54 installed , own built boost 1.56. i have cmakelists.txt configured following way: list (append cmake_library_path "/usr/local/lib") # make sure there boost library files list (append cmake_include_path "/usr/local/include") # make sure there boost directory find_package (boost 1.56 components "system" "filesystem" required) include_directories(${boost_include_dirs}) link_directories(${boost_library_dirs}) target_link_libraries(${your_app} ${boost_library_dirs})

Login during splashscreen with Xamarin iOS/Android using MvvmCross -

when xamarin app starts, try automatically login user based on stored credentials. the login works, during startup splash-screen disappears second or 2 showing black screen. when disable auto-login feature, splash-screen smoothly transfers next view. here code: public async void start(object hint = null) { _securestorageservice = mvx.resolve<isecurestorageservice>(); clearparametercacheuponstart(); setpushtokenrequirement(); var loginservice = mvx.resolve<iloginservice>(); var stopwatch = stopwatch.startnew(); debug.writeline("start loginservice"); if (hasusernameandpassword() && await loginservice.tryloginwithstoredcredentials()) { showviewmodel<dashboardviewmodel>(); } else { showviewmodel<loginviewmodel>(true); } stopwatch.stop(); debug.writeline("finished loginservice: {0}ms&qu

jquery - Keyup event for textarea -

i using virtual keyboard plugin http://mottie.github.io/keyboard/ . here, in mottie textarea want fire keypress event, can use physical keyboard enter text in seleted laguage. i tried this $('textarea[name=notes]').keypress(function (e) {}); and also $("div.ui-keyboard-preview-wrapper").find('textarea[name=notes]').keypress(function (e) {}); i tried $(".ui-keyboard-preview").keypress(function (e) {}); but, not triggering event. there anyway this? try input event below code snippets. track changes in textarea field. older version of ie propertychange event can used track changes. sample code snippets: $(document).on('input propertychange', "textarea[name='notes']", function () { alert("text updated"); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <textarea name="notes" rows="4"

c# - ASP.Net form throwing SQL exception -

when trying save , store data in local sql database, sql exception thrown, "a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: named pipes provider, error: 40 - not open connection sql server)" initially thought wrong way had made new data connection. after making new table 3 times, problem persisted. tried re-install sql modules of visual studio, did not yield +ve result. no data can read from/stored table. please help. public partial class signup : system.web.ui.page { sqlconnection conn = new sqlconnection("data source=(localdb)\v11.0;initial catalog=kidzquiz;integrated security=true"); sqlcommand cmd; sqldataadapter da; dataset ds; protected void signupclick(object s, eventargs e) { //if (checkduplicate() != 0) //signup_error.text = "

operating system - How do I get OS properties in java program? -

Image
hi need details operating system physical memory , cpu usage , other details. cannot pay amount available apis. can use free apis or can write own api. i need details in below image. in above picture have following values total cached available free like values need. have searched lot , got hint. got first value total physical memory value using below code. public class mbeanserverdemo { public mbeanserverdemo() { super(); } public static void main(string... a) throws exception { mbeanserver mbeanserver = managementfactory.getplatformmbeanserver(); object attribute = mbeanserver.getattribute(new objectname("java.lang", "type", "operatingsystem"), "totalphysicalmemorysize"); long l = long.parselong(attribute.tostring()); system.out.println("total memory: " + (l / (1024*1024))); } } the below output above program total memory: 3293 please me .

c# - How to save favorite routes in constantly changing bus schedules -

i'm designing bus scheduling app wp8.. right have parser downloads data bus company's website , saves server json can downloaded , deserialized wp8 app. how can allow users save favorite routes when schedules changes every few weeks ? or maybe there's more correct or more effective way store whole schedules ?

css vertical-align not working -

Image
please vertically align tittle. seems not working properly. <html> <body> <head> <style type="text/css"> html * { margin: 0px; padding: 0px;} .title { width: 50%; display:inline-block; vertical-align:middle; text-align: center; font-weight: bold; font-size: larger; border: solid; border-width: thin; } .btn{ color:white; background-color:#8cc152; margin: 0px !important; width: auto; display: inline-block; padding: 6px 12px; margin-bottom: 0px; font-size: 14px; font-weight: 400; line-height: 1.42857; text-align: center; white-space: nowrap; vertical-align: middle; cursor: pointer; -moz-user-select: none; background-image: none; border: 1px solid transparent; } .btn:hover{ background-color:#a0d468; } .btn-next{ border-radius: 4px; border-top-left-radius: 0px; border-bottom-left-radius: 0px; float:right; } .btn

components - set manually id for row of table by JTable in joomla -

i have table field user_id (unique). want set manually set it.but when set it,jtable not insert data. $data array is: $data['user_id']=500; $data['name']='test'; $data['lastname']='test'; and code in model is: $table = $this->gettable(); if ($table->save($data) === true) { return $table->user_id;} and table file is: class userprotableuser extends jtable { public function __construct(&$db) { parent::__construct('#__userpro_users', 'user_id', $db); } } try this: $table->bind($data); $table->save();

html - Custom Ribbon Button not Executing by Selenium Webdriver -

i writing 1 automation script in unable click on custom ribbon mscrm2011 button below html structure <li id="contact|norelationship|form|mscrm.form.contact.maintab.exportdata" class="ms-cui-group" unselectable="on"> <span class="ms-cui-groupcontainer" unselectable="on"> <span class="ms-cui-groupbody" unselectable="on"> <span id="contact|norelationship|form|mscrm.form.contact.maintab.exportdata-largemedium" class="ms-cui-layout" unselectable="on"> <span id="contact|norelationship|form|mscrm.form.contact.maintab.exportdata-largemedium-0" class="ms-cui-section" unselectable="on"> <span id="contact|norelationship|form|mscrm.form.contact.maintab.exportdata-largemedium-1" class="ms-cui-section" unselectable="on"> <span id="contact|norelationship|form|mscrm.form.contact.maintab.exportda

c# - .NET TypeScript parser to AST -

i'm looking typescript parser produces ast (abstract syntax tree) typescript code, code created visual studio. i think visual studio must have such parser since uses code intelligence. i know can compile ts js , use jint produce ast, it's no me. need strict relation between ast nodes , original lines in ts source. is there way put hands on vs / windows dll ast, or maybe there library providing such functionality? i've done research , found incomplete , limited. there microsoft typescript compiler written in typescript, how use c#? fast enough parse edited code in real-time? for sake of clarification: need parser written in c# or in c++ c# bindings. or... ok, written in language, accessible level of c# code. i'm afraid i'll have write own parser, don't want reinvent wheel. the point want visualize code. not want code executed c#. want see structure , has accurate, no missing elements. most parsers / compilers i've seen had thousands loc writ

escaping - How to escape a JSON string containing newline characters using JavaScript? -

i have form json string in value having new line character. has escaped , posted using ajax call. can 1 suggest way escape string javascript. not using jquery. take json , .stringify() it. use .replace() method , replace occurrences of \n \\n . edit: as far know of, there no well-known js libraries escaping special characters in string. but, chain .replace() method , replace of special characters this: var myjsonstring = json.stringify(myjson); var myescapedjsonstring = myjsonstring.replace(/\\n/g, "\\n") .replace(/\\'/g, "\\'") .replace(/\\"/g, '\\"') .replace(/\\&/g, "\\&") .replace(/\\r/g, "\\r") .replace(/\\t/g, "\\t") .replace(/\\b/g, "\\b")