Posts

Showing posts from July, 2015

symfony - Symfony2 Swap 2 objects primary key Doctrine -

i've got myself entity /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @var integer * * @orm\column(name="position", type="integer") * @orm\generatedvalue(strategy="identity") */ private $position; the id primary key i'll sort array position. want make functions swap 2 of items when sorting or move them , down. how can make constructor increment each new object create automatically? i've tried: /** * constructor */ public function __construct() { $this->position = $this->id+1; } but id assigned after persisting object each 1 has position set 1. need use life cycle callbacks? lifecycle callbacks work want have aware if modify entity after flushing database you're gonna have flush again save new information.

javascript - <span> html duplicate print out -

i new using span . trying print out information javascript script twice on same page. i can print information once when decide print information second time doesn't display it this 1 works <div id="layer4" class="auto-style10" style="position: absolute; width: 300px; height: 427px; z-index: 2; left: 1020px; top: 90px"> <span class="auto-style8"><h4>incident details</h4><br /> </span> <br /> &nbsp;<h6> report id : </h6> &nbsp; <span id="reportid"></span> <br /> &nbsp;<h6> description : </h6> &nbsp; <span id="description"></span><br /> &nbsp;<h6> category : </h6> &nbsp; <span id="category"></span> <br/> &nbsp;<h6> date , time : </h6> &nbsp; <span id="datetime"></span> <br /> ...

Why can't my Android app see the database file? -

i'm creating android app, , want make registration. have written file c.r.u.d database. when start app , try add somebody, can see popup message: "unfortunately , application has been stopped". here database controller code: package com.example.lingwista.lingwista; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; public class db_controller extends sqliteopenhelper { public db_controller(context context, string name, sqlitedatabase.cursorfactory factory, int version) { super(context, "lingwista.db", factory, version); } @override public void oncreate(sqlitedatabase db) { db.execsql("create table users( id integer primary key autoincrement, username text unique, password text);"); } @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { db.execsql(...

ruby on rails - How to Render Current User into Nav-Bar Button -

running: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux] rails 4.2.5 i want render current user name nav-bar button using dropdown-menu class. replace "account info" "hi "current_user". <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">account info <span class="caret"></span></a> <ul class="dropdown-menu"> <li> <%= link_to "edit profile", edit_user_registration_path, class: "fa fa-pencil-square-o" %></li> <li> <%= link_to "sign out", destroy_user_session_path, method: :delete, class: "fa fa-sign-out" %></li> </ul> <ul class = "nav pull-right"> </ul> <% els...

Evaluating polynomial using python -

i'm trying create own polynomial class. want make function can evaluate polynomial x given. so far have this, answers giving me aren't right , cant figure out why? polynomials inputted using list. example [2, 0, 1, -7, 13] 2x^4+x^2-7x+13 class polynomial: def __init__(self, coefficients): self.coeffs=coefficients def evaluate(self, x): sum = 0 in range(len(self.coeffs)-1,0,-1): sum+=self.coeffs[i]*(x**i) return sum the i value you're using isn't right both index , exponent. you're evaluating reversed-coefficeint polynomial, evaluation results polynomial([2,3,4]) right value polynomial([4,3,2]) . here's how i'd define evaluate : def evaluate(self, x): return sum(coef * x**exp exp, coef in enumerate(reversed(self.coeffs))) note if want polynomial objects callable (as in p1(4) in example in comment), should rename evaluate function __call__ .

javascript - keyCode or which not working when using selection:cleared in fabric js -

i using fabric js , created designer user can design objects , delete objects. but reason, user not able delete object because of event before:selection:cleared so, want detect key user pressed, did is canvas.on('before:selection:cleared', function(e) { console.log(e.keycode); console.log(e.which); if(typeof(canvas.getactiveobject()) !== 'undefined') { if(jq.isemptyobject(previous_object)){ }else{ previous_object.moveto(prev_pos); previous_object={}; prev_pos=''; } loadlayers(); } }); but returns undefined. there other solution detect key?

javascript - Why does AngularJS directive work with hardcoded values but fail with http request/response? -

angular newbie question: i have simple angularjs test application shows how controller , directive work together. controller sets hardcoded values ab , ac on scope , directive displays these values in html. works. here jsfiddle . code below. when run it, can see console output expected: js line #63: this.ab = null js line #64: this.ac = goodbye js line #63: this.ab = hello js line #63: this.ac = world however, when change hardcoded values ones retrieved test api, fails. console output follows: js line #63: this.ab = null js line #64: this.ac = goodbye js line #63: this.ab = undefined js line #63: this.ac = undefined the change made (seen here in new jsfiddle ) in controller's myfunc function: replaced hardcoded values following: response = $http.post('http://jsonplaceholder.typicode.com/posts', { 'xxxxx': 'yyyyyyy' } ) self.scopeab = response.id; self.scopeac = response.id; i have tested api's respon...

c# - HangFire Server Enable - Disable manually -

during development of hangfire application c# asp.net, , decided implement functionally admin can manage state of server, jobs. list item server enable disable state. using enable button click event admin can start job server fire , forget , recurrent job can performed. , disable button stop activities of job. retrieve current state of server i want retrieve current state of job server, can show server on or off. retrieve state , enable / disable state of jobs (only recurrent). if want manage server/job created hangfire, can use monitoringapi or jobstorage there statuses. sample codes : var _jobstorage = jobstorage.current; // how recurringjobs using (var connection = _jobstorage.getconnection()) { var storageconnection = connection jobstorageconnection; if (storageconnection != null) { var recurringjob = storageconnection.getrecurringjobs(); foreach(var job in recurringjob) { // stuff ...

python 2.7 - insert data in sqlite3 when array could be of different lengths -

coming off nltk ner problem, have persons , organizations, need store in sqlite3 db. obtained wisdom need create separate tables hold these sets. how can create table when len(persons) vary each id. can zero. normal use of: insert table_name values (?),(t[0]) return fail. thanks cl.'s comment, figured out best way think rows in two-column table, first column id int, , second column contains person_names. way, there no issue varying lengths of persons list. of course, link main table persons table, id field has reference (foreign keys) story_id (main table).

javascript - Mithril - how to populate drop down list of view from API -

i'm trying populate drop down box rendered mithril's view methods being called outside of module (not sure if terminology correct, outside of property contains view, model , controller). this chrome extension adds new field existing page , depending on user select, drop down box should refresh items pertaining selected item. can stage of getting new list of items, cannot drop down list redraw new objects. the following shows module gets inserted inside existing page: var itemslist = { model: function () { this.list = function (id) { var d = m.deferred() // calls chrome extension bg page retrieval of items. chromeext.getitems(pid, function (items) { // set default values when controller called. if (items.length === 0) { items = [ {name: 'none', value: 'none'} ] } d.resolve(items || []) }) return d.promise } }, controller: function () { this.model = new item...

how to work with on onResume() in Android? -

i have 2 activities .first time run application have open popup in activity 1 when first start application. after want go activity 2 , make changes there. again come activity 2 , don't want open popup. problem whenever comeback 1st activity popup open.how solve issues? here code. db = dbhelper.getreadabledatabase(); string query = "select * inspector activestatus= '1' , followflag ='1'"; cursor cursor = db.rawquery(query, null); if (cursor.movetofirst()) { { string strinspectorename = cursor.getstring(cursor.getcolumnindex("inspector_name")); string strinspectorid = cursor.getstring(cursor.getcolumnindex("inspector_id")); if(!strinspectorid.equals(str_loginuserid)) { inspector_arraylist.add(strinspectorename); log.e("post ", " total followup users !!!...

AE2A dynamic programming -

i have been trying solve problem: http://www.spoj.com/problems/ae2a/ . know idea behind this, i'm getting wa. can me this? code is: https://ideone.com/rksw1p for( int i=1; i<=n; i++) { for( int j=1; j<=sum; j++) { for( int k=1; k<=6 && k<j; k++) { a[i][j] += a[i-1][j-k]; } } } let numbers on top of die faces x1,x2,x3... then have find ways in x1+x2+x3+...+xn=sum 1<=xi<=6 now, solution of integral equation (sum-1)c(n-1). hence probability ((sum-1)c(n-1))/(6^n). answer [((sum-1)c(n-1))/(6^n)x100] hope helps..

AppleScript using framework -

this stupid question, however need code within app, i've been using uibutton while not enough, app have .framework files, can use scripting ? example if want click on button listed, there anyway that? 1 button 1 button the applescript framework not available on ios

Create custom glyphicon and add into bootstrap in Yii2 -

Image
new updates asset file dashboardasset created inside asset directory. have several asset files in directory. <?php namespace app\assets; use yii\web\assetbundle; /** * @author qiang xue <qiang.xue@gmail.com> * @since 2.0 */ class dashboardasset extends assetbundle { public $basepath = '@webroot'; public $baseurl = '@web'; public $css = [ 'css/dashboard.css', 'css/transport.css', ]; public $js = [ ]; public $depends = [ 'yii\web\yiiasset', 'yii\bootstrap\bootstrapasset', ]; } updated folder structure calling transport icon final appearance of menu you must define new asset bundle file new fonts. put fonts folder under web called fonts , create style file of including web fonts on file under css folder (please careful address of fonts on css file. it's must address them ../fonts/transport.ttf ). structure this: -| web/ --| ...

Can Akka.NET and Original Akka communicate Using Remoting? -

can akka.net , original akka communicate using remoting? in other words can akka used connect jvm , clr in system? this issue on akka.net github https://github.com/akkadotnet/akka.net/issues/132 describes several reasons why doesn't work: 1) use different serializers user messages, akka uses default java serializer, akka.net uses json.net. solved using e.g. google protobuf, serializers pluggable. 2) helios (akka.net transport) , netty (akka transport) not compatible on binary level, both use 4 byte length prefix frame messages (afaik, @aaronontheweb ?) guess won't play nice together. and perhaps more fundamentally: the big issue here this: java bigendian, .net littleendian - @ least, it's littleendian on windows systems. endianness in .net can vary platform platform, true mono too. it appears there not appetite solving issues: i'm wondering how useful full protocol compatibility is. issues point out aside, imagi...

javascript - res.json not working inside callback function -

i'm working on api endpoint. upon posting data endpoint /authenticate , use plaidclient.getauthuser function user's account information, , i'm trying use res.json return account data. after running this: accounts = json.stringify(res.accounts); console.log('accounts: ' + accounts); i able see array of dictionaries containing account information. however, when attempt use res.json({accounts: accounts}) , error: res.json({accounts: accounts}); ^ typeerror: undefined not function when try run res.send(accounts) in place of res.json, receive same error: res.send({accounts: accounts}); ^ typeerror: undefined not function here's code: var public_token = ""; var access_token = ""; var accounts = []; app.post('/authenticate', function (req, res) { console.log('post'); public_token = req.body.public_token; console.log(public_token); console.log('plaid: ' + app.client); ...

matplotlib - Python list and time -

i trying current time , store when run os command ( runs once second) can plot graph of time vs output of command. when try store current time in list using: (timelist empty list) timelist.append (datetime.datetime.time(datetime.datetime.now())) i this: [datetime.time(23, 57, 8, 86885), datetime.time(23, 57, 8, 87091), datetime.time(23, 57, 9, 90906), datetime.time(23, 57, 10, 95045), datetime.time(23, 57, 10, 95110), datetime.time(23, 57, 10, 95148), datetime.time(23, 57, 10, 95166), datetime.time(23, 57, 10, 95178)] so in 1 second, instead of 1 list item current time, 2, or 3 items). how capture time @ instant , store in list can use pyplot plot this? i using this, , works fine (python 3.3+): from datetime import datetime time_list = [] time_list.append(datetime.now()) if want save or send other application without converting types can think use timestamp rather: from datetime import datetime time_list = [] time_list.append(datetime.now().timestamp()) ...

How to size table by number of rows in SQL Server -

Image
i have table want size of number records based on byte in sql server: the answer related this question can suggest this: select s.name schemaname, t.name tablename, p.rows rowcounts, a.total_pages * 8 totalspacekb, a.used_pages * 8 usedspacekb, a.total_pages * 8 / p.rows eachrowtotalspacekb, a.used_pages * 8 / p.rows eachrowusedspacekb, a.total_pages * 8 / p.rows * (select * dbo.picturetable schoolcode=1001) querytotalspacekb, a.used_pages * 8 / p.rows * (select * dbo.picturetable schoolcode=1001) querytotalspacekb sys.tables t inner join sys.indexes on t.object_id = i.object_id inner join sys.partitions p on i.object_id = p.object_id , i.index_id = p.index_id inner join sys.allocation_units on p.partition_id = a.container_id left outer join sys.schemas s on t.schema_id = s.schema_id s.name = 'dbo' , t.name = 'picturetable'; edit can length of data in field using datalength...

image processing - Determining resolution -

i read this: today digital ip camera resolution defined horizontal (h) , vertical (v) number of pixels (i.e. 640 x 480) or total number of pixels in sensor (h x v = 336k pixels). how calculation of hxv=336k pixels? is h = 640 , v = 480? if yes doesn't calculation suppose 307200 =~ 307k?

c# 4.0 - How do I call a getter or setter in C# -

i understand how create getters , setters public myclass { public int myval { get; set; } // more stuff } but don't understand how call later on. public myotherclass { public myotherclass() { myclass localmyclass = new myclass(); localmyclass.???set??? = 42; // intelisense doesn't seem give obvious options after enter // period. } } how should set value of myval in localmyclass? localmyclass.myval = 42; getters , setters let treat values public properties. difference is, can whatever want inside functions getting , setting. examples: store other variables private int _myval, myotherval; public int myval { get; set { _myval = value; myotherval++; } } make numbers / return constants public int myval { { return 99; } set; } throw away setter private int _myval; public int myval { { return _myval; } set { ; } } in each of these cases, user feel it's public data member, , type ...

javascript - Execute event before its natural behaviour -

is there way execute javascript-event before it's natural behaviour? for example, using code below, if press / key on keyboard, character printed in input field, , after 2 seconds, alert showed. that's obviuos. but there way make alert showed before / printed? <input></input> <script> document.queryselector("input").focus(); addeventlistener("keydown", function (e) { if (e.keycode === 191) { myfunc(e); } }); function myfunc(e) { settimeout(function() { alert("hello!"); }, 2000); } </script> unified solution inputted characters on keypress event: addeventlistener("keypress", function(e) { var val = e.which || e.keycode; e.preventdefault(); myfunc(e.target, val); }); function myfunc(target, val) { settimeout(function() { alert("hello!"); target.value = string.fromcharcode(val); }, 2000); } try it.

c++ - Will including new IDs require recompile? -

globals.h #define id1 1 #define id2 2 factory.h item* makeitem(int id); will including new ids in globals.h require recompile of files use makeitem old ids? also how know changes require recompile or re-linking of dependents? any change globals.h require recompile of files #include globals.h or include header files include globals.h. if list of ids changes often, , lots of files depend on it, , project big, might become nuisance. one way around split globals.h different h-files, each h-file used relatively small part of project. then, change in 1 of them not require recompiling. if this, typically face challenge of keeping of ids unique. if defined in different header files, developer making change in 1 file may not know causing collision id defined in file. 1 solution follow documented convention, in every h-file ids defined has associated range of ids, , ranges not overlapping.

java - MongoDB / Morphia update operation for document with many fileds -

i have entity contains lets 20 different keys / local variable. in case want update doc , can use updateoperations in order perform query , have go filed filed , set new value new object.. if there way update current doc in db new fields lets say: public class item { @id @getter @setter private objectid id; @getter @setter private string itemid; @getter @setter private string itemtitle; .. .. } so lets have item stored, got new dto gui, of fields , rest null. want create generic update operation take non nullable values dto object , update in existing doc in db. is possible? i think so! i see 2 possible ways: alternative 1: can use reflection iterate every field in dto , put value copy of document recovered db. @ end of loop can update document. alternative 2: update desired fields. mongo can update subset of fields in update operation: update data java driver

spring - How can I manage dynamic model with AngularJS and springdata mongodb -

i have created project using angularjs + spring-data-mongodb + mongodb. i'd manage crud operations model change dynamically according concept of object inheritance. the frontend: if user selects "vehicle" form contain attributes of vehicle. if user selects vehicle type "car" form contain attributes of "vehicle" plus attributes of "car". if user selects vehicle type "motorcycle" form contain attributes of "vehicle" plus attributes of "motorcycle". angularjs form model: <div ng-controller="vehicleformctrl"> <input type="text" class="form-control" id="inputfielda" ng-model="vehicle.name"> <select class="form-control" ng-model="vehicletype" ng-change="selectvehicletype()" ng-options="k v (k, v) in vehicletypes"> </select> ... <input type="text" class="f...

datetime - Applescript: Convert date into something useful, then perform calculation -

i'm trying create applescript script take date in form: 02/20/99 then, subtract 5 days date, , return date this: 02/15/99 here's basic applescript have, but, obviously, i'm missing logic around converting date can manipulate (and returning readable humans). set itempath quoted form of posix path of thefile set datestring shell script "awk 'nr == 10 {print $3}' " & itempath & " -" set myduedate datestring - (5 * days) set thetask "pay amex bill" tell application "omnifocus" tell front document set thecontext first flattened context name = "office" set theproject first flattened context name = "bookkeeping - pms" tell theproject make new task properties {name:thetask, context:thecontext, due date:myduedate} end tell end tell thanks in advance! i think these lines should sufficient need: set datestring "02/20/99" set thisdate date...

c# - "Hyperlink.Click" event not being fired for DataGridHyperlinkColumn -

i have wpf form datagrid containing multiple datagridhyperlinkcolumn , hyperlink.click handler set up. gamesgrid.xaml: <usercontrol xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:steamwishlist" x:name="gamesgridcontrol" x:class="myprogram.gamesgrid" mc:ignorable="d" d:designheight="300" d:designwidth="300"> <grid> <datagrid x:name="datagrid" autogeneratecolumns="false" canusersortcolumns="false" selectionunit="cell" selectionmode="single" arerowdetailsfrozen="true...

facebook - How do I get the current User Id with GoViral ANE -

i using goviral ane integrating facebook, creating leaderboard display in game. i highlight current user's score, don't appear have access id returned via app_id/scores request. for example, data returned in following format: {"score":123,"user":{"name":"colin","id":"1234"}} the id portion looking match current user highlight score. i have tried goviral.goviral.getfbaccesstoken() wrong thing. have tried making call out current user's score, requires user id make call, little stumped on one. searching on google doesn't seem return useful results either. thank time. ah, seems don't need user id make call after all. the call attempting following: from facebook developer site: you can read score person playing game issuing http request /user_id/scores user access_token. with code: goviral.goviral.facebookgraphrequest( goviral.goviral.getfbaccesstoken() + "/scor...

Reset java certifications (on linux) due to Maven download issue -

i using ubuntu linux 15.10. few days ago cloned small git project using maven (i use version 3.3.3). after cloning wanted use mvn install command download dependencies error occurred. using same command -x parameter shows problem in detail: [error] plugin org.apache.maven.plugins:maven-resources-plugin:2.3 or 1 of dependencies not resolved: failed read artifact descriptor org.apache.maven.plugins:maven-resources-plugin:jar:2.3: not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.3 from/to central (https://repo.maven.apache.org/maven2): java.security.nosuchalgorithmexception: error constructing implementation (algorithm: default, provider: sunjsse, class: sun.security.ssl.sslcontextimpl$defaultsslcontext): invalid keystore format -> [help 1] org.apache.maven.plugin.pluginresolutionexception: plugin org.apache.maven.plugins:maven-resources-plugin:2.3 or 1 of dependencies not resolved: failed read artifact descriptor org.apache.maven.plugins:maven-reso...

php - I'm trying to change the value of a div with javascript -

<div id='right_side'> <div id='t' title='<?php echo $u; ?> friends'> <div id="f"> <h6> <?php echo $u; ?> friends </h6> </div> </div> <div id='users' onclick="chat();"> <?php echo $friend; ?> </div> javascript <script> function chat() { var chatbox = document.getelementbyid("chatbox"); var chatbox = document.getelementbyid("chatbox").value= "<?php echo $friend_username; ?>"; if(chatbox.style.display == "none"){ chatbox.style.display = "block"; $('#chatbox').attr("chatbox","<?php echo $friend_username; ?>"); } else { chatbox.style.display = "none"; chatbox.attr.value = "none"; } } </script> i want change div value user name of friend if cl...

Data File handling in classic c++ (much like C) -

i made following program. there mistake in bold part. value of count in output i'm getting zero. there no errors when compiled code. #include<iostream.h> #include<conio.h> #include<fstream.h> void main() { clrscr(); void count(); fstream file("story.txt",ios::in|ios::out); file<<"he playing in ground. she\nis playinbg dolls.\n"; file.close(); count(); getch(); } void count() { ifstream file("story.txt"); file.seekg(0);int count=0; while(!file.eof()) { char line[10]; **file.get(line,10,' '); cout<<line<<"\n"; if(line=="he") ++count;** } cout<<count; file.close(); } string comparison not done through == . merely compares address replace if(line=="he") with if(!strcmp(line, "he")) edit for case insensitive if(!strcmpi(line, "he")) ...

Use addition in database SQL -

can use addition in database? for example: have data inside database integer. has value of 5. is there query add 1 that? become 6. please me i'm beginner. this basic form of update statement: update the_table set the_column = the_column + 1 the_column = 5; note above update all rows the_colum has value 5. want change where clause different, e.g. selecting single row using condition on primary key column(s) of table. check manual of dbms details, e.g.: http://www.postgresql.org/docs/current/static/dml-update.html

javascript - trying to change the text of the button without editing the html code -

i'm trying change text of button without editing html code doesn't work here code: document.queryselector(".game-button").onclick = function knop(knop) { document.queryselector(".game-button").innerhtml = "reset spel"; } html: <button class="game-button">start spel</button> if may suggest: var gamebutton = document.queryselector(".game-button") gamebutton.onclick = function() { gamebutton.innerhtml = "reset spel"; } i've put gamebutton in variable referenced once. since function connected onclick event, naming function not needed. also, not passing or using arguments, there no need put between ().

Creating an auto logout timer of 30 minutes in PHP -

i need timer of 30 min auto logout quiz application coded in php. should forced one. if user doing activities.how implement that? php not work runtime application, doesn't have state. frontend via javascript or other means need send request server on interval check if user still authenticated. check using php if user expired or not, in case action using frontend logic. this way vague give definitive answer.

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

i'm trying follow this guide . i'm running both ubuntu 12.04.5 lts (gnu/linux 3.13.0-74-generic x86_64) on "real" hardware , 14.04.1 via virtualbox on mac. problem don't past step 1: hoffmann@angl99:~$ export ccprefix=/home/hoffmann/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- hoffmann@angl99:~$ ${ccprefix}gcc -v i'm getting following error: -bash: /home/hoffmann/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc: no such file or directory however, file i'm told missing there: hoffmann@angl99:~$ less /home/hoffmann/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc "/home/hoffmann/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc" may binary file. see anyway? this result of basic error/misconception. suggest solution? thanks! sebastian ok - i've worked out (with of person po...

php page called from Joomla menu unable to capture logged in user info -

we have application running in joomla . there menu option 'my data' - on clicking open php page in iframe . in target php want capture current logged in user details facing problem. we have used jfactory::getuser() not showing . although if specific id passed parameter getuser id's details coming . pfb code . can please us. in advance . /*******start of code*********/ define('_jexec', 1); define('ds', directory_separator); if (file_exists(dirname(__file__) . '/defines.php')) { include_once dirname(__file__) . '/defines.php'; } if (!defined('_jdefines')) { define('jpath_base', dirname(__file__)); require_once jpath_base.'/includes/defines.php'; } require_once jpath_base.'/includes/framework.php'; $app = jfactory::getapplication('site'); $app->initialise(); $user =& jfactory::getuser(); echo 'user name: ' . $user->username . '<br />'; echo ...

Windows Forms C# WMPLib Crashes while playing a mp3 file -

Image
i'm working on simple mp3 player. i'm using wmplib playing mp3 files. i'm displaying tracks in data grid view, double click plays selected track. program plays right song, once start scrolling or pressing buttons song stops playing. this method i'm using playing individual tracks: public static void playtrack(int t) { library l = new library(); wmplib.windowsmediaplayer song = new wmplib.windowsmediaplayer(); song.url = l.mylibrary[t].patch; song.controls.play(); } i call above method when datagridview1_cellcontentdoubleclick raised in separate class. do guys know why happening? do need use multi threading in order fix it? i thought program's ui "heavy" i'm using multiple nested panels in custom controls. i'm including print screen of running application. ok, found answer problem. needed declare library , wmplib field outside of method shown below: static library l; static wmplib.windowsmedi...

c# - Trackbar keeps stealing my focus -

it has been asked few times couldn't use of answers. problem everytime want change trackbars value keeps focused when i'm clicking on other parts of window. , when want use keys work in trackbarbox. what did try?: -i tried set causesvalidation / tabstop / topmost false / true -i tried use mouseleave / focusenter events set focus on form this.focus() -i tried put protected override bool isinputkey(keys keydata) { return true; } and/or protected override bool showwithoutactivation { { return true; } } into maincode here screenshot of programm understand problem: it's german doesn't matter. want press enter while i'm drawing line trackbar keeps focused , blocks it the usual way to override onkeydown event after setting keypreview = true : protected override void onkeydown(keyeventargs e) { base.onkeydown(e); // code here.. text = "testing: keycode" + e.keycode; } but can use previ...

javascript - Knockout.js: child a tags not working when parent li element has click binding -

i have menu each item toggles it's own submenu, here sample code. can see submenu item tag links out google.co.nz <ul id="menuholder"> <li data-bind="click: showmenu.bind($data, 1)"> main menu item <ul class="submenu" data-bind="visible: selected() == '1'"> <li> <a class="sub-item" href="http://google.co.nz"> submenu item </a> </li> </ul> </li> </ul> <script type="text/javascript"> var menumodel = function () { var self = this; self.selected = ko.observable(0); self.showmenu = function (data) { var s = self.selected(); if (s > 0 && data == s) self.selected(0); else self.selected(data); }; } ko.applybindings(new menumodel(), document.get...

c# - Getting the root element of xml file in linq -

i using linq. here document structure: <t totalword="2" creationdate="15.01.2016 02:33:37" ver="1"> <k kel_id="1000"> <kel>7</kel> <kel_gs>0</kel_gs> <kel_bs>0</kel_bs> <km>ron/int-0014</km> <kel_za>10.01.2016 02:28:05</kel_za> <k_det kel_nit="12" kel_res="4" kelsid="1" > <kel_ac>ac7</kel_ac> </k_det> </k> <k kel_id="1001"> <kel>whitte down</kel> <kel_gs>0</kel_gs> <kel_bs>0</kel_bs> <km>ron/int-0014</km> <kel_za>15.01.2016 02:33:37</kel_za> <k_det kel_nit="12" kel_res="4" kelsid="1"> <kel_ac>to gradually make smaller making taking parts away</kel_ac> ...

Is it possible to combine java 7 with java 8? -

i want use xuggler here: java xuggler leads fatal error work had downgrade version 7. have problem want write programm need have access java 8. can combine java 7 , java 8 in way 1 class using old java 7 , classes use java 8? so guess enduser have use java 8 @ end, not problem. you cannot achieve in same instance of jvm - use 2 java processes running different versions of jre sounds complete overkill use case.

Filtering icons from recylerview based on text in searchview android -

i have followed tutorial , have implemented recylerview searchview in app https://github.com/wrdlbrnft/searchable-recyclerview-demo . however, instead of having text in recylerview have icons representing 2 states user online , offline, want when user types in online in searchview want online icon show , simiarly when type offline want offline icon show up. to filter text, shown in example have done this; if (personstatus.contains(query)) { filteredmodellist.add(model); } this works text based results in recylerview, however, want filter based on icons in recylerview. the icon can either r.drawable.online or r.drawable.offline. have imageview called icon. what have tried far; if(query.tolowercase().equals("online") { filteredmodellist.add(model.geticon().getdrawable(r.drawable.online)); } this doesn't seem work, error on geticon, says cannot resolve method geticon. have method geticon shown in examp...

javafx - JafaFx Load FXML file Error Null Pointer Exception -

i have exception whith no difinition of error when trying load window button login. before worked fine, dont know why shoing error java.lang.nullpointerexception, there line in console , couldnt find whats wrong. hears files . <splitpane dividerpositions="0.5" maxheight="-infinity" maxwidth="-infinity" minheight="-infinity" minwidth="-infinity" orientation="vertical" prefheight="400.0" prefwidth="600.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.mainentredcontroller"> <items> <menubar> <menus> <menu mnemonicparsing="false" text="file"> <items> <menuitem mnemonicparsing="false" text="close" /> </items> </menu> <menu mnemonicparsing="false" text="edit...

Mail script with just JavaScript and HTML5 -

is possible create contact form sends answers email only html5 , javascript? , if is, how do it? i don't think it's possible javascript directly via mail function or because user's local machine can't assumed running mail server. there nothing send email from. i'm not sure how "standards compliant" is, can navigate (by using links or document.location ) mailto:user@example.com or begin composing email in user's standard email client, allowing them send email directly. though expose both , email address.

vb.net - visual basic - Calling information from one form to another -

form1 (login form): private sub login_btn_click(sender object, e eventargs) handles login_btn.click try dim connstr string = "" dim connection new mysqlconnection(connstr) dim reader mysqldatareader connection.open() dim query string query = "select * table username='" & txtusername.text & "' , password='" & txtpassword.text & "' " command = new mysqlcommand(query, connection) reader = command.executereader dim count integer count = 0 while reader.read count = count + 1 end while if count = 1 query = "select * table username= '" & txtusername.text & " '" dim username string username = reader("username") messagebox.show( " " & username ) messagebox.show("username , pas...

html - How do I make space between <nav> and <section> -

i'm looking space between <nav> tag , <section> tag. @ minute in browser flush each other. want have space between them, i'm not sure how. here simple code - html <!doctype hmtl> <html> <head> <meta charset="utf-8"> <title>about me</title> <srcipt></srcipt> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <header> <h1>about me</h1> </header> <nav> <ul> <a href="index.hmtl">who am</a> - <a href="from.hmtl">where from</a> - <a href="study.hmtl">what studying</a> - <a href="more.html">race flux</a> - <a href="gear.html">my gear</a> </ul> </nav> <section> ...