Posts

Showing posts from April, 2014

Animation in famo.us with changing opacity of surface -

i new famo.us. interested in creating animation surface/object in continuous motion , opacity keeps changing( ranging 0->1 , back). have able continuously rotate surface , change opacity 1 0 once. stuck here not sure how proceed forward. can suggest me ideas ? there couple ways can go doing this. depends on exact effect trying achieve. here example using modifier , opacityfrom method achieve never ending sine effect. var engine = require('famous/core/engine'); var surface = require('famous/core/surface'); var rendernode = require('famous/core/rendernode'); var modifier = require('famous/core/modifier'); var context = engine.createcontext(); surface = new surface({ size:[200,200], properties:{ backgroundcolor:'green' } }) surface.node = new rendernode(); surface.mod = new modifier({origin:[0.5,0.5]}); var starttime = date.now(); var period = 1000; surface.mod.opacityfrom(function(){ currenttime = dat

javascript - Accessing fields in JSON object -

this question has answer here: access / process (nested) objects, arrays or json 15 answers in json object trying access "name" field within "pos" i have tried obj.tokens.pos.parent; obj[0].pos.parent; how can access parent field of object? the object looks like [ { "tokens": [ { "text": "call", "normalised": "call", "end": true, "start": true, "pos": { "name": "infinitive verb", "example": "eat", "parent": "verb", "tense": "present", "tag": "vbp" }, "pos_reason": "lexicon", "analysis": { "word": "call", "next": null, "last": n

c# - Splitting up WebApi project and FrontEnd project in Solution -

i have solution mobile application i'm building - far consists of 2 projects: 1) webapi api / dal / sql etc 2) web single-page front-end the web project makes calls webapi project. plan create project windows 8 application, wp8 app, etc. this has worked alright while developing, has become quite complicated cors, deployments, etc (web served different endpoint webapi - 2 azure web sites). question - when architecting solution that's backed rest-ish api, when wise/unwise split solution multiple projects? i split api , front-end separate projects few reasons: front-end dependencies (jquery, knockout, angular....) make api heavier necessary. sifting through code "other" project type can slow down development. source control can bit confusing when committing across 2 functionally separate projects within 1 project. if change both api , site within 1 commit, want revert 1 of them older point in time (or promote them separately) become heada

c - How to declare a variable of struct that declared inside another struct? -

i have struct declared follow: struct { struct b { int d; } c; }; how declare variable of b outside a ? in c++ can use a::b x; . but, in c required specifies struct keyword before struct name. c has flat layout; when declare struct within struct, former being put global namespace. so, in example, struct b .

javascript - How to use addClass() to prepend the class in the element's class list -

i hav div in html <button id="abc" class="btn btn-primary btn-block"></button> i need add class 'alert-danger' on mouseover. used following code $(document).on("mouseover","#abc",function() { $(this).addclass("alert-danger"); }); this works fine , appends class @ end of class list below <button id="abc" class="btn btn-primary btn-block alert-danger"></button> but problem 'btn' , 'alert-danger' classes have common css rules. 'btn' takes priority (as first in list) , disables rules of 'alert-danger'.so button should 'alert-danger' class first in classlist. <button id="abc" class="alert-danger btn btn-primary btn-block"></button> // requirement how modify addclass() in order prepend class instead of appending it. an alternative requirement. you can mark

Trouble with Python. Translate Toolkit on windows -

i need use po2csv utility translate toolkit on windows. i make next step: download , install python 2.7 in c:\python27\ folder adding path=c:\python27\;c:\python27\scripts\;othet_folders... , pythonpath=c:\python27\lib;c:\python27\dlls;c:\python27\lib\lib-tk in system enviroment variable. reboot pc. download "translate toolkit 1.11.0" run command my_downloads\translate-1.11.0\translate-1.11.0\python setup.py install after trying use po2csv: python po2csv python: can't open file 'po2csv': [errno 2] no such file or directory c:\python27\scripts>python po2csv traceback (most recent call last): file "po2csv", line 22, in <module> translate.convert import po2csv importerror: cannot import name po2csv c:\python27\lib\site-packages\translate\convert>python po2csv.py traceback (most recent call last): file "po2csv.py", line 27, in <module> translate.storage import po importerror: cannot import name po what doin

javascript - Go back to previous page if same domain -

i need create button go previous page if last page visited in same domain , have check page was. example if user come google, button have redirect homepage, if come www.domain.com/product button have redirect page, if come www.domain.com/static button have redirect homepage. i tried php , $_server http referer , if protocol http woks fine, doesn't work https, redirects homepage. looks variable doesn't exists! how can solve problem? javascript , history obj can help? thanks use session variable track current page , check @ next page, i.e.: if (isset($_session['page_url'])) { // visitor has seen page in domain $previous_page = $_session['page_url']; } else { // visitor comes outside, use home page $previous_page = 'http://domain.com'; } // keep url of current page $_session['current_url'] = $_server['request_uri'];

javascript - What does it mean to add a prototype to a function? -

this question has answer here: how javascript .prototype work? 19 answers given: var x = function () { }; x.prototype = { abc: 25 }; can explain me means. done inside function without .prototype? var x = function () { // here ? }; prototypes how class model works in javascript - you've created class x has property abc defaults 25 : var obj = new x(); alert(obj.abc); // 25 the function x class constructor, called when new instance of class created , can initialize it. , means of course can set abc property there: var x = function() { this.abc = 25; }; var obj = new x(); alert(obj.abc); // 25 this supposedly less efficient approach however: you have manipulate each object created rather setting property on prototype once , forever. the property stored on each object , consumes memory each time, opposed being stored once on

osx - Catching Logoff (not power off) event on MAC using objective C -

can tell me how can catch user logoff event? able catch poweroff event using nsworkspacewillpoweroffnotification notification. not showing difference in logoff , power off events. want catch log off , power off separately. able catch same on windows. first, have make sure app not participating in sudden termination . if is, can killed @ logout without opportunity react. now, when user logs out, app kaequitapplication ( 'quit' ) apple event. have same effect invocation of -[nsapplication terminate:] . can implement application delegate method -applicationshouldterminate: notified of request quit , control app's response it. in delegate method, can use code examine quit event , learn reason quit request: nsappleeventmanager* m = [nsappleeventmanager sharedappleeventmanager]; nsappleeventdescriptor* desc = [m currentappleevent]; switch ([[desc attributedescriptorforkeyword:kaequitreason] int32value]) { case kaelogout: case

c# - How to prevent a windows form from disappearing on a modal appear? -

as part of powerpoint add-in, show user windows form information color (like rgb values), can copy , paste within modal color (shape -> right click -> fill color -> more fill colors). the problem form loses focus, minimizes, , unable access when color modal open. is there way solve problem?

c++ - Communication between a server thread and a man-machine interface (MMI) -

Image
i need advice on program i'm coding right now. let me first present is. design i'm designing man-machine interface (mmi). in mmi, there 2 core elements: the mainwindow : this mainwindow base of everything. important : here, launch in thread server receives data client. data important next element. supervision this window contains qtablewidget , goal show in pseudo-real time data received on server in thread of mainwindow. the problem the server in thread owned mainwindow receive structure every 10 ms. how can send these data supervision window if it's open? thinking of using shared memory, not sure this, , doesn't method have use. some solutions i tried implement solution of sebastian lange : an emit in thread server a connect in mainwindow a slot in supervision so thread server emit signal @ every frame received. how can connect in mainwindow , how supervision receive struct emit in signal? here's code of emit: main

java - MySQL Database connection disconnected after few minute -

i working on spring+hibernate+jsf if ideal on page few minute getting exception when trying database query last packet received server 2,615,049 milliseconds ago. last packet sent server 27 milliseconds ago. caused by: org.hibernate.transactionexception: jdbc begin transaction failed: @ org.hibernate.engine.transaction.internal.jdbc.jdbctransaction.dobegin(jdbctransaction.java:76) @ org.hibernate.engine.transaction.spi.abstracttransactionimpl.begin(abstracttransactionimpl.java:160) @ org.hibernate.internal.sessionimpl.begintransaction(sessionimpl.java:1309) @ org.springframework.orm.hibernate4.hibernatetransactionmanager.dobegin(hibernatetransactionmanager.java:474) ... 46 more caused by: com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure is issue due configuration in project or database vendor issue in web.xml made entry <session-config> <session-timeout> 30 </session-timeout> </s

javascript - Appending Data within another file -

i hacking couple of wordpress plugins (not matters). have onclick function relates js function located in 'plugin' folder. what best way link main js file location 1 need in location 2? example: onclick="call_ajax_add_to_quotelist(add_to_quotelist_ajax_url,'.$product->id.');" '.$style.'>'.$label.'' call_ajax_add_to_quotelist located in wp-content/plugins/plugin1/js.js you have load wp-content/plugins/plugin1/js.js when need use call_ajax_add_to_quotelist function: <script src="...wp-content/plugins/plugin1/js.js"></script> hope helps!

hover - Move location of text in a box in html -

trying implement hover on caption on image opaque overlay appears words having bit of trouble. my code below: <style type="text/css"> a.hovertext { position: relative; width: 220px; text-decoration: none !important; text-align: center; } a.hovertext:after { content: attr(data-title); position: absolute; left: 0; bottom: 5px; padding: 0em 0px; width: 220px; height: 220px; background: rgba(0,0,0,0.8); text-decoration: none !important; color: #fff; opacity: 0; -webkit-transition: 0.5s; -moz-transition: 0.5s; -o-transition: 0.5s; -ms-transition: 0.5s; } a.hovertext:hover:after, a.hovertext:focus:after { opacity: 1.0; } </style> <a class="hovertext" data-title="europe 2014" href="url"><img alt="" border="0" src="url" height="220" width="220" /></a> the idea how want can&#

c# - Generic abstract class filter in NHibernate AutoMap for component -

i'm overriding iscomponent method of nhibernate's defaultautomappingconfiguration specify component every class implements generic abstract class don't find how. this base class of valueobject : public abstract class valueobject<t> : iequatable<t> t : class i want write similar to: public override bool iscomponent(type type) { return type.basetype == valueobject<t> t : class; } you can use condition: type.basetype.isgenerictype && type.basetype.getgenerictypedefinition() == typeof(valueobject<>) that condition match every type base type generic , open-generic version valueobject<t>

javascript - activate a class in java-script template rendered through backbone -

i have bootstrap-select's drop down filter in javascript template, rendered through backbone's view. <script type="text/template" id="activities-template"> <div class="span22"> <div class="members"> <select class="selectpicker" multiple title='<i class="icon-filter"></i> filter by'> <% _.each(project_users, function(user){ %> <option id=<%= user.id %>><%= user.first_name %></option> <% }); %> </select> </div> </div> </script> when ajax request made gets projects_users , enable selectpicker @ start drop-down options unselected. @activities.fetch success: (activities) -> activities_html = that.template activities:

How to auto update a continuously running Android app without user interaction -

we have app in google play store runs in foreground continuously. devices runs on out of our control , not rooted. run on either android 4.2 or 4.4. our goal have app update newest version release via play store without user interaction. restarting device acceptable "interaction" option. we find running app not updated automatically when running if "automatic update" turned on. what way achieve our goal? use alarm manager scheduled update , use create class , extend service or intentservice class. check if theres internet connection if yes proceed update this: check link android services - tutorial in way can update not showing activity using service. creating alarm manager: calendar cal = calendar.getinstance(); intent intent = new intent(this, myservice.class); pendingintent pintent = pendingintent.getservice(this, 0, intent, 0); alarmmanager alarm = (alarmmanager)getsystemservice(context.alarm_service); // start every 30 seconds alarm.s

Dependencies problems in downloading and installing packages in Ubuntu 12.04LTS and held broken packages -

i newbie in ubuntu. have installed 12.04 lts in laptop , fine. want install packages wine,vlc,chromium browser,etc getting various error messages,such , error 1.package dependencies cannot resolved. while installing chromium ubuntu software center, chromium-browser: depends: libgcc1 (>= 1:4.1.1) 1:4.6.3-1ubuntu5 installed depends: libudev0 (>= 147) 175-0ubuntu9.5 installed depends: libx11-6 (>= 2:1.2.99.901) 2:1.4.99.1-0ubuntu2.2 installed depends: libxcomposite1 (>= 1:0.3-1) 1:0.4.3-2build1 installed depends: libxdamage1 (>= 1:1.1) 1:1.1.3-2build1 installed depends: libxi6 (>= 2:1.2.99.4) 2:1.7.1.901-1ubuntu1~precise1 installed depends: libxss1 not going installed depends: zlib1g (>= 1:1.1.4) 1:1.2.3.4.dfsg-3ubuntu4 installed while installing vlc, vlc: depends: vlc-nox (= 2.0.8-0ubuntu0.12.04.1) 2.0.8-0ubuntu0.12.04.1 installed depends: libavcodec-extra-53 (>= 4:0.8-1~) 4:0.8.12ubuntu0.12.04.1 installed depends: libavutil-extra-51 (>=

java - File browse on Android App -

i want create android app. there form allow users choose files using html tag. there submit button on form, onclick of chosen file should copied android device location on server. right form on html page , have been using phonegap development. as of now, have created plugin reads file sdcard folder , using jsch library uploading files on sftp server. while researching, found many people using following method: form details posted server , using php script file content read using $_files (but not want follow approach) i need way, when user chooses file using browse option file name picked when form posted. for e.g below code mainactivity.java file package com.example.filepicker; import java.io.ioexception; import java.net.uri; import org.apache.cordova.droidgap; import org.apache.http.client.methods.httpget; import android.util.log; import android.view.display; import android.webkit.websettings.renderpriority; import android.view.windowmanager; import android.con

javascript - html td table search -

the question how perform search in column of table i use following js script , input tag: <script type="text/javascript"> function dosearch() { var searchtext = document.getelementbyid('searchterm').value; var targettable = document.getelementbyid('datatable'); var targettablecolcount; //loop through table rows (var rowindex = 0; rowindex < targettable.rows.length; rowindex++) { var rowdata = ''; //get column count header row if (rowindex == 0) { targettablecolcount = targettable.rows.item(rowindex).cells.length; continue; //do not execute further code header row. } //process data rows. (rowindex >= 1) (var colindex = 0; colindex < targettablecolcount; colindex++) { var celltext = ''; if (navigator.appname == 'microsoft internet explorer

html css link into another link -

here problem : i've try add "link" one. explanation : have image, inside link, when click anywhere on image i'm redirected page want. i'm trying is, add small "edit icon" @ top right corner of image, can edit properties on page dedicated this. the fact want have "edit icon" link, when click on want redirected on page, not page url of main image container link... so code looks : <a href...> <span ... style : size , background image looks clickable picture...> <a href...> <span... second span background (edit icon), float right (to in corner of container span) , small sized...> </span> </a> </span> </a> if things way, second block (edit icon) appears out of container... , if change order. appears it's not clickable. doing wrong? impossible make links links? or special way that? you can't place link other one. should pla

inline - f# idiomatic type resolution solution for resolving to the wrong type -

i'm getting started f# have code analogous following: let square x = x*x let result = square 5.1 let result' = square 12 unfortunately, results in following error: this expression expected have type float here has type int is there idiomatic f# solution problem, or thinking being tainted c# experience? just write that: let inline square x = x * x otherwise, after first time used square function, type inferred float -> float . hence, , given f# not automatic conversion int float , receive error. so, if don't want use inline , simplest solution write let result' = square (float 12) it simple , yet readable. for more advanced solutions please take @ this: does f# have generic arithmetic support? but solutions (imho) incomprehensible.

Django admin Password WEAK or STRONG message on successful submission of form -

i need display whether password entered while creating new user in django admin strong or weak. please me here suggesting how it. appericiated class newform(forms.form): email = forms.emailfield() password = forms.charfield(widget=forms.passwordinput()) confirm_password = forms.charfield(widget=forms.passwordinput()) def clean_new_password1(self): password1 = self.cleaned_data.get('password') if len(password1) < 6: "display password weak on submission of form" else: "display password strong on submission of form" return true i use messaging framework included in django so. i've yet have pleasure tinker sure seems suited job. although doesn't directly answer question, try out this module seems pretty(ier) me might not you'

html - I can't open an exe using Javascript -

i want open notepade.exe using html js ,i tried code not working can 1 me on this. file run.html !!! <html> <head> <script> alert("hi"); <!-- mywindow.close(); --> var param1var = window.location.search.replace( "?", "" ); alert(param1var); var oshell = new activexobject("shell.application"); var commandtorun = "c:\\windows\\notepad.exe"; oshell.shellexecute(commandtorun,"","","open","1"); window.close() </script> </head> </html> open internet explorer , change / enable these 2 settings tools > internet options > security > custom level > activex controls , plug-ins > initialize , script activex controls not marked safe scripting tools > internet options > advanced > security > allow active content run in files on computer just in case, restart internet explorer

eval - Can I use a string as a named argument in python -

this question has answer here: dynamic keyword arguments in python? 4 answers i've got string form timedelta object based on value. write if statements, know string match 1 of named arguments timedelta object. want similar below: td = timedelta("hours"=5) or: my_var = "days" td = timedelta(my_var=5) what recommended way this? use double-asterisk kwargs syntax: td = timedelta(**{my_var: 5})

javascript - How to make an eraser with kineticjs 5.1.0 acting on multi-layer? -

Image
i want make eraser kineticjs, have problem. the eraser need efficient on multiple layer (layera, layerb in code) , simple button or check box can choose if eraser work on first or second layer, , why not on of them. need keep them draggable. her jsfiddle show i've explained: http://jsfiddle.net/junkees/ja2v8/2/ var stage = new kinetic.stage({ container: 'container', width: 400, height: 500 }); var layera = new kinetic.layer(); var imageobj = new image(); imageobj.onload = function() { var x = new kinetic.image({ x: 0, y: 0, image: imageobj, draggable:false }); // add shape layer layera.setlistening(false); layera.add(x); // add layer stage stage.add(layera); layera.setzindex(10); //layera.draw(); }; imageobj.src="https://imagizer.imageshack.us/v2/595x397q90/707/u8q3.jpg" var layerb = new kinetic.layer(); var imagj = new image(); imagj.onload = function() { var x = new kinetic.image({ x: 0

php - Click counter via Mysql database -

table: links id link_ref name clicks unique_clicks url 1 external_link external link 2 1 .index.php table:links_clicks id link_id ip date hour 1 2 an_ip a_date a_hour these tables , below code have tried: $querym = mysql_query("select * `links` right join `links_clicks` on `links`.`id`=`links_clicks`.`link_id`"); while ($row = mysql_fetch_assoc($querym)) { echo $row['link_ref']."<br>"; } what want display output links "links" table , how many clicks have been made on each of them in last 24 hours. in table "links_clicks" stored clicks , in "links" stored informations each external link. links.id same many link_clicks.link_id so, how join tables it's first question. related 1: how count clicks each link? how count clicks on link in period of time ? first of all, use timestamp or datetime

c# - What's the difference between the ItemTapped and the ItemSelected event on a ListView in Xamarin.Forms? -

a listview in xamarin.forms has 2 events, (for me) seem same: itemtapped , itemselected there isn't documentation these, difference? itemselected state while itemtapped motion event. views can "tapped" , if remember correctly views can selected (or @ least activated there subtle difference), 2 don't have go do. example you'd have item's selected state toggled each time "tapped" motion event has occurred. once again make more clear can associate changes of selected state whatever need whether it's motion event "tapping" or "long pressing" or "double tapping" , on or other event or logic. hope helps , luck!

javascript - Display json file in Browser using Node.JS without file extension -

i have made server using javascript , node.js shows json file in browser. however, call site http://localhost:8888/test.json without extension. example just: http://localhost:8888/test here server code: var http = require("http"), url = require("url"), path = require("path"), fs = require("fs") port = process.argv[2] || 8888; file = (__dirname + '/test.json'); http.createserver(function(req, res) { var uri = url.parse(req.url).pathname, filename = path.join(process.cwd(), uri); var contenttypesbyextension = { '.html': "text/html", '.css': "text/css", '.js': "text/javascript", '.json': "application/json" //edited due answer - still no success :( }; path.exists(filename, function(exists) { if(!exists) { res.writehead(404, {"content-type": "text/plain"});

Loader Class View Codeigniter -

in codeigniter systems core loader.php there $ this->_ci_view_paths = array(apppath.'views/' => true); function if wanted change path $this->_ci_view_paths = array(apppath.'views/template'=> true); function. would able in my_loader.php overwrite default location. i have hmvc not changing view path public function view($view, $vars = array(), $return = false) { list($path, $_view) = modules::find($view, $this->_module, 'views/template/'); if ($path != false) { $this->_ci_view_paths = array($path => true) + $this->_ci_view_paths; $view = $_view; } return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return)); } because able $this->load->view('user/user_list', $data); rather $this->load->view('template/user/user_list', $data);

sql - Ssis error invalid column reference in package -

i have invalid column reference error in sis package after editing stored procedure case statement added column total sales amount paid. please can this? cannot remap columns in package unless resolve error. thanks i faced similar problem in ssis package. after adding few new columns source table "ole db source" element not map these new columns correctly either not displaying them @ on mapping list or showing "invalid column" error. turned out connection using had retainsameconnection parameter set true (the package uses temp tables not dropped) - changing false enabled me add new columns mapping. might idea check delayvalidation , validateexternalmetadata parameters on elements connected data flow. these should set true in case. perhaps runs same problem.

sql - Aggregating/Grouping a set of rows/records in MySQL -

i have table "sample" saves new record each 5 minutes. users might ask data collected specific sampling interval of 10 min or 30 min or hour. since have record every 5 minutes, when user asks data hour sample interval, have club/group every 12 (60/5) records in 1 record (already sorted based on time-stamp), , criteria either min/max/avg/last value. i trying in java once fetch records, , seeing pretty bad performance have iterate through collection multiple times, have read of other alternatives jagg , lambdaj, wanted check if that's possible in sql (mysql) itself. the sampling interval dynamic , aggregation function (min/max/avg/last) user provided. any pointers ? you can in sql, have construct statement. here example hour 4 aggregations: select min(datetime) datetime, min(val) minval, max(val) maxval, avg(val) avgval, substring_index(group_concat(val order datetime desc), ',', 1) lastval table t group floor(to_seconds(dateti

java - How to create an image from an InputStream, resize it and save it? -

i have code inputstream , create image: part file; // more code try { inputstream = file.getinputstream(); file f = new file("c:\\imagenesalmacen\\qr\\olakease.jpg"); outputstream os = new fileoutputstream(f); byte[] buf = new byte[1024]; int len; while ((len = is.read(buf)) > 0) { os.write(buf, 0, len); } os.close(); is.close(); } catch (ioexception e) { system.out.println("error"); } the problem have resize image before create if inputstream so how resize inputstream , create resized image. want set largest side of image 180px , resize other side proportion. example: image = 289px * 206px resized image = 180px * 128px i did this: try { inputstream = file.getinputstream(); image image = imageio.read(is); bufferedimage bi = this.createresizedcopy(image, 180, 180, true); imageio.write(bi, "jpg&q

mysql - Search for a recent added keywords -

say if there table has 100 million records.. more , more data keeps getting updated , then. mission search added keyword "srinu" table each , every 30 seconds , display it. what efficient way ? no need write code. give views/thoughts on this. this rather abstract question , have lot of opinionated answers. what criteria "recently added"? if needed quick query see records added within last 30 seconds create trigger , secondary lookup table after update , after insert insert recently_added; and create event delete recently_added datetime field less than 30 seconds ago , run every 30 seconds step can moved trigger , criteria added select instead this way select * recently_added if there no records found know no records updated within last 30 seconds. otherwise of keywords updated within last 30 seconds listed

java - Flex mxmlc error loading JVM windows 7 64 bit -

i'am executing command in windows 7 console: mxmlc then get: error loading: c:\program files (x86)\java\jre7\bin\client\jvm.dll how fix this? the jvm.dll exists in directory, why error occurs?, i've tried reinstall java, didn't helped the flash compiler, mxmlc, not run under 64 bit jvm. according 4.6 sdk docs: note: must use 32-bit version of jdk, version 1.5 or later. command line compilers not work 64-bit jdk. unfortunately, need install 32 bit jvm.

php - Form elements are not being POSTed in Opencart module -

i writing own module, using base dummy one. i've completed big part of task, need pass settings. reason added 2 new 'input' elements can see: <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form"> <div id="hidset" title="configure module" style="display:none;"> <table> <tr><td>apikey:</td><td><input type="text" name="my_module_apikey" value="5"/></td><tr/> <tr><td>user id:</td><td><input type="text" name="my_module_uid" value="6"/></td><tr/> </table> </div> then wanted div open in dialog box. wrote function it: function dialogsettings() { $( "#hidset" ).dialog({ height: 250, width: 250, modal: true, button

javascript - Displaying JSON data in drop-down in AngularJS -

my document.json file contains data like [ {"name" :"b"}, {"name" :"a"}, {"name" :"d"}, {"name" :"e"} ] when try display json data in drop-down list, last element e displayed in drop down .my html file <select ng-model="selectedtestaccount" ng-options="c c.name c in testaccounts"></select> and script file sampleapp.controller('democtrl', function ($scope, $http) { $scope.selectedtestaccount = null; $scope.testaccounts = []; $http.get('document.json').success(function (data) { $scope.testaccounts = data; }); }); how can display document.json data in drop-down list default selected first element in angularjs. guidelines please your json isn't quite right. need have braces around each item, this: [ { "name" :"b" }, { "name" :"a" }, { "name" :&q

html - Woothemes flexslider Arrow not displaying -

Image
i using flexslider , have problem in terms of navigation arrow. it's not displaying right way if put font source right folder. i used flex slider in wordpress theme , here screenshot of arrow. here css file jsfiddle.net/fdezd/ any kind of appreciated. lot. i had same issue. arrows displayed in screenshot no matter placed font files. tried absolute links á la "src:url('d:/myproject/fonts/flexslider-icon.eot');" , still didn't work. think has with font itself. but news: used following workaround: i'm using font arial , 2 symbols "<" , ">". you have adjust file flexslider.css following way: this line: .flex-direction-nav a:before { font-family:"flexslider-icon"; font-size: 40px; line-height:1; display: inline-block; content:'\f001'; } has replaced following one: .flex-direction-nav a:before { font-family:"arial"; font-size: 40px; line-he

javascript - Change active function from on click to on load -

i have function check mobile internet. this function work of click(onclick function) work automatically when app launch! how do? the function this: <script> function checkjsnetconnection(){ var xhr = new xmlhttprequest(); var file = "dot.png"; var r = math.round(math.random() * 10000); xhr.open('head', file + "?subins=" + r, false); try { xhr.send(); if (xhr.status >= 200 && xhr.status < 304) { return true; } else { return false; } } catch (e) { return false; } } function onjsbuttonclick(){ if(checkjsnetconnection()==true){ alert("internet connection exists"); }else{ alert("internet connection doesn't exist"); } } </script> try : $(document).ready(function(){ onjsbuttonclick(); }); add before closing </script> tag.

java - MyBatis Generator with multiple databases -

i'm trying generate "mybatis generator" mappers 3 tables, first 2 in 1 database (derby sample) , last 1 in database (birt sample). i'm using rad 8.5 derby. here xml configuration file <?xml version="1.0" encoding="utf-8"?> <!doctype generatorconfiguration public "-//mybatis.org//dtd mybatis generator configuration 1.0//en" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorconfiguration> <classpathentry location="c:\users\xxx\ibm\rationalsdp\workspace\example\webcontent\web-inf\lib\derby.jar"/> <!-- primo database --> <context id="derbytables" targetruntime="mybatis3"> <jdbcconnection driverclass="org.apache.derby.jdbc.embeddeddriver" connectionurl="jdbc:derby:c:\users\xxx\ibm\rationalsdp\workspace\.metadata\.plugins\com.ibm.datatools.db2.cloudscape.driver\sample;create=true"

.net - Google.Apis assembly reference error -

i have created custom log in page on premise sharepoint 2013 site. have added logic use google's authentication log in sharepoint site. when build project getting error: error cs0012: type 'google.apis.services.baseclientservice' defined in assembly not referenced. must add reference assembly 'google.apis, version=1.8.1.31687, culture=neutral, publickeytoken=null' i have added reference. have added reference gac. when double click error takes me part of code: private plusservice ps = null; but not red marks or errors on line in code, in output window. have used code google gives sample , have downloaded api references nuget google suggests. have ideas or has come across before?

java - Google app engine cronjob 10 minitues limitation -

i have deployed & scheduled fb data collection java web application on gae using cron.xml. application collecting data , loading data google cloud storage. one limitation of gae found while implementing application window active through cron job 10 minutes. https://developers.google.com/appengine/docs/java/config/cron data collection process requires more 10 minutes collect complete data. please suggest me alternative options.and reference links increase 10 minutes time limit. thanks . you can choose b-type instance basic scaling cron job. not have 10 minute limit: app engine modules in java

unicode - mysql doesn't support all symbols from range U+0000..U+FFFF -

consider following table: create table t1 (f1 varchar(255)); then, ruby : #!/usr/bin/env ruby require 'json' require 'sequel' require 'mysql2' db = sequel.connect( :adapter => 'mysql2', :database => 'd1', :user => '<user>', :password => '<password>', :encoding => 'utf8') v1 = '{"a":"b\ud83c\udf4ec"}' v2 = json.parse(v1) p v2['a'] db[:t1].truncate db[:t1].insert(f1: v2['a']); p db[:t1].first[:f1] or php : #!/usr/bin/env php <?php $dbh = new pdo('mysql:dbname=d1', '<user>', '<password>', [ pdo::mysql_attr_init_command => 'set names utf8', pdo::attr_errmode => pdo::errmode_exception, ]); $dbh->exec('truncate table t1'); $v1 = '{"a":"b\ud83c\udf4ec"}'; $v2 = json_decode($v1); var_dump($v2->a); $sth = $dbh->prepare("

html - Auto save a drop down list -

i have drop down list feed back. save data when save button pressed. want auto save drop down list without using save button how can it? here ontroller public actionresult selectfeedback(int id) { yelloadmindbcontext db = new yelloadmindbcontext(); viewbag.feedback = new selectlist(db.feedback, "feedbackid", "feedbackdrpdown"); return partialview(); } [httppost] public actionresult selectfeedback(int feedback, int id) { yelloadmindbcontext db = new yelloadmindbcontext(); if (modelstate.isvalid) { var temp = db.feedback.find(feedback); db.savefeedback.add(new savefeedback { loginid = id, feedback = temp }); db.savechanges(); return javascript("alert ('success');"); } return javascript("alert ('error');"); } public actionresult displayfeedback(int id) { yelloadmindbconte

Activity destroyed before onActivtyResult Android -

ok, i'm startactivityforresult take picture , save storage, file have specified (its path). i ran strange thing didn't know - when start activity result in 1 orientation, , switch orientation when finishing other activity, since orientation of activity has changed, ondestroy called , oncreate, onstart, , after onactivityresult, means cannot when activity if need data persist in onsaveinstancestate. am correct , why so? the order how functions called in first activity when second activity finishes is destroy create start activityresult isn't more reasonable be activityresult pause saveinstancestate stop destroy create so, if there's no use save in onsaveinstancestate, should in onpause? , best way it?

entity framework - why doesnt' it use the parameter in this raw sql? -

i using code: sqlparameter pnombreusuario = new sqlparameter("nombreusuario", paramnombreusuario); object[] parametros = new object[] { pnombreusuario }; string passworddb = dbcontext.database.sqlquery<string>("select password personal nombreusuario = @nombreusuario", parametros) .singleordefault<string>(); but query sent database is: select password personal nombreusuario = @nombreusuario why parameter username name not used? thanks. the docs indicate should send array of object values rather sqlparameter objects. e.g. string passworddb = dbcontext.database .sqlquery<string>("select password personal nombreusuario = @p0", paramnombreusuario) .singleordefault<string>(); does work you? edit: misread docs. try this: string passworddb = dbcontext.database .sqlquery<string>(

java - A new object seems to change the fields of previous objects -

i'm writing game contains elevators obstacle. elevator spawns either left or right of screen , has random chance ascending elevator or descending elevator. looks this: public class elevator extends worldobject { public static boolean ascending; public elevator(int screenheight, int xpos) { super(xpos, screenheight, 0, 0); ascending = new random().nextboolean(); } static public boolean isascending(){ return ascending; } } worldobject extends looks this: public class worldobject { protected float posx; protected float posy; protected float velx, vely; public float getposx() { return posx; } public void setposx(float posx) { this.posx = posx; } public float getposy() { return posy; } public void setposy(float posy) { this.posy = posy; } public float getvelx() { return velx; } public void setvelx(float velx) { this.velx

update through vba new record, currently opened in a form -

i have question regarding updating new record through vba. first - assumptions. i've made form called "assortment", displays set of records , sobreport shows related invntory. i've put button on it: "add new record". opens second form "inventory_details" intended enter , view inventory spcific data. inventory of specific assortment type. - i've passed assortment_id inventory_details form through docmd.openform like: docmd.openform stformname, , , , acformadd, , me.assortment_id the data source of "inventory_details" form query contains assortment table joined inventory table inventory_id. best way add id passed openargs opened new record , refresh form show related assortment data? trying like: private sub form_open(cancel integer) dim assortmentid integer if (not isnull(me.openargs)) assortmentid = me.openargs() set rst = me.recordset rst.edit rst.asso

Same PHP code acting differently in two scripts? -

so have piece of code i'm trying download audio file running rest api in progress, it's surroundings this: elseif($method == 'synthtts'){ //check if required parameters accounted checkparameters($data, array('message')); $message = $data['message']; $message = str_replace(' ', '+', $message); $url = "http://tts-api.com/tts.mp3?q=" . $message; $path = "tts-mp3/" . str_replace('+', '', $message) . ".mp3"; // saveurl($url, $path); echo $url . "\n" . $path . "\n"; $file = file_get_contents($url); file_put_contents($path, $file); exit("successfully synthesized tts " . $path); } i pass "hello world" message parameter , echo reveals expected $path , $url values("tts-mp3/helloworld.mp3" , " http://tts-api.com/tts.mp3?q=hello+world " respectivel

PHP scandir returns incorrect filenames -

scandir(some path) giving incorrect filenames. when ls of folder, results selected0_ljrnxtmpxn4_0:0:0.mp4 selected8054_ydzl86snmag_0:2:32.mp4 selected10_ijtkxi6wmbo_0:2:20.mp4 selected8056_jgabbaxqsk8_0:3:40.mp4 however, scandir returning following: s4xfwk~b.mp4 sdtp6p~d.mp4 shtyf1~m.mp4 sx8wca~j.mp4 i have double , triple checked make sure ls -ing , scandir -ing same folder. why scandir not returning correct filenames? update: machine running scandir windows server 2008 enterprise, machine files stored on running fedora 20, disk type fuse.glusterfs found answer. filenames when viewed linux system had colon : in them, isn't valid windows filename, replaced 8.3 names.