Posts

Showing posts from May, 2012

javascript - Automatically log out users when tab is closed using asp.net forms authentication -

i have simple web form uses forms authentication. implement authentication, have in web.config <system.web> <authentication mode="forms"> <forms loginurl="logon.aspx" name=".aspxformsauth"></forms> </authentication> <authorization> <deny users="?"/> </authorization> </system.web> and in codebehind on logon.aspx use let them form if credentials work: formsauthentication.redirectfromloginpage(formid, false); formid identifier either generated on logon page new form, or entered user continue existing form. when complete form or click button start new form use send them logon page: formsauthentication.signout(); the issue i'm worried users might lose track of formid they're working on, , fill out information wrong id (it displayed on form them, might ignore it). want automatically sign them out whenever refresh page, close tab, or close b...

PHP function store elements in an array -

i'm using front end javascript text editor, submits data in html format, convert images base64 encoded format. the following function parse $_post super global, html content , store encoded images in images folder along appropriate extension. $html = preg_replace_callback("/src=\"data:([^\"]+)\"/", function ($matches) { list($contenttype, $enccontent) = explode(';', $matches[1]); if (substr($enccontent, 0, 6) != 'base64') { return $matches[0]; } $imgbase64 = substr($enccontent, 6); $imgfilename = md5($imgbase64); // unique filename $imgext = ''; switch($contenttype) { case 'image/jpeg': $imgext = 'jpg'; break; case 'image/gif': $imgext = 'gif'; break; case 'image/png': $imgext = 'png'; break; default: return $matches[0]; } // here i'm able echo image names thier extentions. echo $...

doctrine2 - Loading Fixtures for functional tests in Symfony 2: Call to undefined method MyControllerTest::loadFixtures()) -

i trying find easy way load fixtures in symfony 2.6 run functional tests. quite common question, , has been asked few times, answers have found far not quite reach expectations: some rely on running command line inside functional test. other run manually each 1 of defined fixtures, , take care of creating , deleting database. there lot of overhead in both cases (use statements , manual code), task believe standard. on other hand, these same posts recommend liipfunctionaltestbundle. going it, here read in installation instructions: write fixture classes , call loadfixtures() method bundled test\webtestcase class. please note loadfixtures() delete contents database before loading fixtures." so tried... namespace appbundle\test\controller; use symfony\bundle\frameworkbundle\test\webtestcase; class mycontrollertest extends webtestcase { public function setup() { $classes = array( 'appbundle\datafixtures\loaduserdata',...

ios - Questions about navigation bar -

i confused relationship of navigation controller , content view controllers. in storyboard, navigation bar under navigation controller, linked navigationcontroller class , customized navigation bar in viewdidload function. however, since different content views have different navigation bar, different bar buttons, how can realize this? basic ideas enough. guess need specify specific bar buttons in specific content view controllers, since navigationbar property in navigationcontroller class, how can refer it? i want hide title of navigation bar , make bar show custom buttons (i know toolbar may match better, have other reasons adopt navigation bar). please tell me how hide title in detail , swift language preferred. 1) every viewcontroller instance has navigationcontroller property, it' optional. set bar buttons, you'll want use navigationitem . specify bar buttons either in interface builder per view controller, or or in viewdidload let navbarbutton = uib...

javascript - asp.net programmatically get text inside dynamic div -

i'm trying text of div on creating dynamically in asp. below example of html table created datagrid: <table border="1" id="maincontent_dgvalues" style="border-collapse:collapse;"> <tbody><tr> <td>date modified<td>comment</td><td></td> </tr><tr> <td>3/26/2000</td><td id="myedit" onclick="makeeditable()">my text</td><td><a href="javascript:__dopostback('ctl00$maincontent$dgvalues$ctl03$ctl00','')">update</a></td> </tr><tr> </tr> </tbody></table> this code have div created dynamically: <script > function makeeditable() { var divtag = document.createelement("div"); divtag.setattribute("id", "editdiv"); divtag.setattribute("runat", "server"); ...

file - read the last line twice -

ifstream infile("score.txt", ios::in); int score; while(infile.good()){ infile >> score; cout << score << endl; } i tried read scores file , print them. last score being read twice. tried other condition such while(!infile.eof()), nothing changes. confused this. the score file looks following: 78 23 43 23 54 the "54" read , printed twice. try one...... ifstream infile("score.txt",ios::in); int score; infile >> score; // before loop read 1 time while(infile.eof()) { infile >> score; cout << score << endl; }

c# - Call methods parallel and combine results -

i have mainmethod needs call 2 methods method1 , method2 parallel. both of them return list of employee different database. need call them parallel , combine results of method1 , method2 in mainmethod , return result caller of mainmethod. i appreciate if people can tell must signatures of methods , code need write mean async/await keywords. you can run them 2 task<t> s. result property takes care of waiting. approximately: // untested task<list<employee>> t1 = task.factory.startnew(() => method1()); task<list<employee>> t2 = task.factory.startnew(() => method2()); var result = t1.result.concat(t2.result);

php - Convert date from dutch to english -

i thought going quite easy not! have date: mei 28, 2015 (dutch) , convert english y-m-d problem site multilang stay dynamic (replace mai may) not solution, i've tryed: setlocale(lc_time, 'nl_nl'); setlocale(lc_all, 'nl_nl'); echo strftime("%y-%m-%d", strtotime($value)); or $date = date_parse(($value)); print_r($date); but time i'm getting: 1970-01-01 any ideas? i'm trying achieve in magento, maybe there magento function this use strptime() function - http://php.net/manual/en/function.strptime.php $value = 'mei 28, 2015'; $format = '%b %d, %y'; setlocale(lc_time, 'nl_nl'); setlocale(lc_all, 'nl_nl'); // array date details $result = strptime($value, $format); $day = str_pad($result['tm_mday'] + 1, 2, '0', str_pad_left); $month = str_pad($result['tm_mon'] + 1, 2, '0', str_pad_left); $year = $result['tm_year'] + 1900; print $year.'-'....

reporting services - SSRS report - PageName of the tablix is ignored when no rows -

i working ssrs report project in visual studio. set pagename property of tablix desirable name. but, in case when there no rows, property ignored , in excel see "sheet1" instead. there anyway fix it? see if link can of http://blogs.msdn.com/b/robertbruckner/archive/2010/05/16/report-design-naming-excel-worksheets.aspx

php - how to convert in url " _" to "-" using htaccess? -

this question has answer here: in htaccess, i'd replace underscores hyphens , redirect user new url 2 answers i have url looks like: url.com/rom_date/ct_8/first_0 how go converting url to url.com/rom-date/ct-8/first-0 how go making friendly urls in php? with htaccess can change first link second : #put me in global htaccess file rewriteengine on rewriterule ^([^_/]+)_([^_/]+)/([^_/]+)_([^_/]+)/([^_/]+)_([^_/]+)/?$ /$1-$2/$3-$4/$5-$6 [l,nc]

ios - SKPaymentTransaction stuck -

i got annoying issue regarding in app purchases on ios (consumable). case i create payment request i enter credentials , confirm purchase. i quit app before purchase confirmed apple i receive popup springboard (app being killed) saying payment processed. problem when launch app again add transaction observer (all delegate method being implemented) doing: [[skpaymentqueue defaultqueue] addtransactionobserver:self]; i log pending transactions , current state right after that: [[skpaymentqueue defaultqueue] addtransactionobserver:self]; /* logging content of[skpaymentqueue defaultqueue].transactions shows transaction state of skpaymenttransactionstatepurchased */ but transactions seems blocked since never calls - (void)paymentqueue:(skpaymentqueue *)queue updatedtransactions:(nsarray *)transactions the thing might have been called previous time crashed/quit before calling [[skpaymentqueue defaultqueue] finishtransaction:transaction]...

java - Generics and Inheritence? -

this question has answer here: java: can't generic list<? extends parent> mylist 4 answers public static void main(string... args) { list<child> list1 = new arraylist<child>(); method2(list1); } public static void method2(list<parent> list1) { } i below compilation error the method method2(list) undefined ... above issue can solved modifying list<parent> list1 list<? extends parent> list1 . but if try add child object below public static void method2(list<? extends parent> list1) { child child1 = new child(); list1.add(child1); } it gives compilation error again the method add(capture#1-of ? extends parent) in type list not applicable arguments (child) so question if list<child> can passed parameter list<? extends parent> list1 why can't add child object under...

javascript - PDF generation with DocRaptor in AngularJS -

i trying incorporate docraptor in angularjs project pdf generation , exporting pages pdfs. new angular , can't seem find supporting documentation. point me right resources. resource have found stackoverflow question: using docraptor web service angularjs? . i'm docraptor developer. support angular sites. example given in existing question linked pretty good. can use document_url field, instead of document_content field, , put in url invoice/report page. let me know or support know if can of further assistance.

php - How match ID number with CSS regexp -

i'm customising wordpress theme , stuck following css issue. have list of elements follows: li.block1, li.block2, li.block3, li.block4 { top: 0; } li.block5, li.block6, li.block7, li.block8 { top: 150px; } li.block9, li.block10, li.block11, li.block12 { top: 300px; } i'm generating code using php , wish use regexp style these elements. i'd achieve following: - li.block[1-4] {style 1} - li.block[5-9] {style 2} - li.block[10-14] {style 3} - , on... as i'm generating li.block[number] dynamically based on user input, run few hundreds of elements, believe using regexp right way go. i've tried following: tried use $ match last element, i'd on how match on range of values tried using last-child attribute match, it's dynamic, can't fix last-child in advance tried use in-range match range, couldn't figure out how check whether number in range and, several other dom matching criteria using css i think css match condition i'm usin...

html - Optimise CSS Delivery in Wordpress Theme -

when using page speed insights alert eliminate render-blocking javascript , css in above-the-fold content page has 1 blocking css resources. causes delay in rendering page. approximately 3% of above-the-fold content on page rendered without waiting following resources load. try defer or asynchronously load blocking resources, or inline critical portions of resources directly in html. optimize css delivery of following: http://www.mysite.co.uk/wp-content/themes/mytheme/css/m.min.css note: removed url working site workplace. i have tried doing suggested google , using <script> var cb = function() { var l = document.createelement('link'); l.rel = 'stylesheet'; l.href = 'small.css'; var h = document.getelementsbytagname('head')[0]; h.parentnode.insertbefore(l, h); }; var raf = requestanimationframe || mozrequestanimationframe || webkitrequestanimationframe || msrequestanimationframe; if (raf) raf(cb); ...

java - On parsing gson.toJson(obj) giving null -

wwhen passing object of local-inner-class shipaddress tojson() method of gson class returning null on parsing it. public class crusialdaterest { public string getshippingaddressesdetails() { gson gson = new gsonbuilder().create(); try { collection<impladdress> savedaddressbeans = new arraylist<impladdress>(); collection<ctflexfield> countryfields = new arraylist<ctflexfield>(); collection<ctflexfield> debitorfields = new arraylist<ctflexfield>(); class shipaddress{ collection<impladdress> savedaddressbean = new arraylist<impladdress>(); collection<ctflexfield> countryfield = new arraylist<ctflexfield>(); collection<ctflexfield> debitorfield = new arraylist<ctflexfield>(); shipaddress( collection<impladdress> savedaddressbeans, collection<ctflexfield> countryfields,collection<ctflexfield> debitorfields){ ...

android - replace database file from assets by the database from data folder -

i have database file "mydb.db" ( it have 1 table ), , put file assets folder, app copy data it, can read data there no problem, when try add new row in table new row existing in data folder mean if clear data or reinstall app lose new row. how add row file in assets folder "mydb.db" ? or how replace new database data/data folder old file "mydb.db" in assets folder? i use code sorry bad english. you cannot in app. assets read-only. you can modify database on computer , replace source version of asset gets bundled in apk. for versioning preinstalled databases , without problems code you're using, consider sqlite-asset-helper .

java - Regular expression for a string containing at least one number -

can please explain following regular expression means? ^(?=.*[\p{l}\p{m}0-9]).{6,50}$ it forces users have @ least 1 number in username. how should modify remove constraint? you need remove 0-9 constraint set in look-ahead: ^(?=.*[\p{l}\p{m}]).{6,50}$ now, allows string containing symbols newline, 6 50 occurrences, , @ least 1 unicode letter. to use in java, need double-escape backslashes: string pattern = "^(?=.*[\\p{l}\\p{m}]).{6,50}$";

user interface - Can i get some field like "Panel" from the Frame in java AWT? -

i'm new java , learning building gui using awt (not swing!) so, have created: a frame (let call f). a class, creates me checkbox in panel in constructor: public class checkboxing extends component{ public checkboxing( panel p) { ... } } is there field in frame can use initialize exemplar of checkboxing ? know, can rewrite checkboxing accept frame instead of panel , or use jframe , ruin idea i'm trying implement.

javascript - Link piece to square in puzzle -

i making puzzle jquery , use draggable , droppable. yesterday made squares drop puzzle pieces in , i've tried link piece square making id same or class doesn't works. does know how can link them if want drop piece on square square accept right piece? i have 25 pieces , 25 squares drop in, 5x5. $(document).ready(function() { $("button").button({icons: { primary: "ui-icon-gear" }}); $("img").draggable() }); $(function() { $( "#droppable" ).droppable({ drop: function( event, ui ) { $( ) .addclass( "ui-state-highlight" ) .find( "img" ) ; } }); }); html <img id="puz1.1.1" class="puz1.1" src="images/1.1.1.png"/> <img class="puz1.1" src="images/1.1.2.png"/> <img class="puz1.1" src="images/1.1.3.png"/> <img class="puz1.1" src="image...

c# - How to get Balance from property -

i have 1 class contains simple data transactions 1 field amount holds transaction amount plus or minus, question how calculate balance after each transaction without using linq , want know how done in merely pure programming. this code transaction class: using system; namespace accountsummary { class mastertransdata { public long transno { get; set; } public datetime transdate { get; set; } public long accountno { get; set; } public decimal amount { get; set; } public decimal getbalance() { decimal[] balance; mastertransdata[] mtd = transdata(); for(int i=0; i<mtd.length; i++) { balance[i] += mtd[i].amount; } return balance; } } } presumably balance single value total amounts, not array. you asked solution without linq, thought may useful show how relates. in linq, use sum extension method: mastertransd...

wordpress - www. redirect is failing with .htaccess -

i have wordpress site running on ubuntu apache2 server. want server redirect traffic www.mysite.com mysite.com. i made modification in .htaccess file this: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{http_host} ^www\.(.*)$ [nc] rewriterule ^(.*)$ http://%1/$1 [r=301,l] #rewriteengine on #rewritebase / #rewriterule ^index\.php$ - [l] #rewritecond %{request_filename} !-f #rewritecond %{request_filename} !-d #rewriterule . /index.php [l] </ifmodule> and modified apache2.conf this: <directory /var/www/> options indexes followsymlinks allowoverride require granted </directory> still no success.i still ubuntu apache server default page www.mysite.com. missing?

Specific php and swift code for image uploading to sftp -

php script , xcode shows here ****** response data = notice : undefined index: userid in /home/raimonds/script.php on line 36 {"message":"first name field empty","status":"error","userid":null} so here php code : <?php if(!empty($_post["firstname"])){ $firstname = isset($_post["firstname"]) ? $_post["firstname"] : ""; $lastname = isset($_post["lastname"]) ? $_post["lastname"] : ""; $userid = isset($_post["userid"]) ? $_post["userid"] : ""; $target_dir = "uploads/"; if(!file_exists($target_dir)) { mkdir($target_dir, 0777, true); } $target_dir = $target_dir . "/" . basename($_files["file"]["name"]); if (move_uploaded_file($_files["file"]["tmp_name"], $target_dir)) { echo json_encode([ "message...

scope - update/refresh angularjs ng-repeat with data from server -

i try buil website pictures. i can load picture, want have system picture. my problem have refresh page see picture , increment count. this controller : $scope.loadingpics = function (){ $http.get('/api/photos') .success(function(awesomethings) { console.log(awesomethings); $scope.firstname = awesomethings; }) .error(function (err){ $scope.errors.other = err.message; }); }; $scope.upvote = function(index){ $scope.vote = 1; var ref = index; var nom = index.url.substr(30, 40); var num = index.vote + 1; $http.put('api/photos/' + nom, { email: email, vote: num }) .success(function (data) { $scope.firstname = data; $scope.loadingpics(); }) .error(function (err){ $scope.errors.other = err.message; }); }; ...

Material design listview on Android 4 -

hi i'm trying create listview on android 4+ similar available in material design, https://developer.android.com/design/material/videos/contactsanim.mp4 modifications, after click on item expand item in pretty way scrolling top of list , making rest of items darken. best way achieve on android 4? trying use expandablelistview looks awfull. or maybe there library can provide functionality? yes use transition api building animations this. part of api used in android 4+ bu using, example, library

javascript - Best way to show/hide a part based on permission level - Angular JS -

i have angularjs single page application there lot of html blocks show users based on permission levels. the user permission determined service calls , value set based on permission. $scope.permission = 'admin' i can use ng-hide/show directives hide blocks based on permission. worried security. changing css display property not authorized can view blocks. the other option ng-if , using currently. know whether should same routing , more secure, believe. can use ui.router angular module acheive this. right way? should use ng-hide/show , ng-if or routing ? expecting thoughts. any appreciated. in advance. you should create directive such purpose: app.directive('checkpermissions', ['permissionsservices', function(permissionsservices) { return { restrict: 'a', link: function(scope, elem, attrs, ctrl) { if (attrs.permissions != '') { var haspermission = permissionsser...

c++ - Xcode 6.3 Apple Match-O linker Error with cocos2d v2.1.5 project -

i got problem when rebuild cocos2d v2.1.5 architecture x64 in xcode 6.3. please me fix this. undefined symbols architecture arm64: "_webpgetfeaturesinternal", referenced from: webpgetfeatures(unsigned char const*, unsigned long, webpbitstreamfeatures*) in ccimagecommonwebp.o "_webpinitdecoderconfiginternal", referenced from: webpinitdecoderconfig(webpdecoderconfig*) in ccimagecommonwebp.o "_webpdecode", referenced from: cocos2d::ccimage::_initwithwebpdata(void*, int) in ccimagecommonwebp.o "_neon_matrix4mul", referenced from: _kmmat4multiply in mat4.o "_aes_decrypt", referenced from: dataencrypt::parsexmldata(unsigned long, char const*) in userdataencrypt.o "_aes_set_encrypt_key", referenced from: dataencrypt::save() in userdataencrypt.o "_aes_encrypt", referenced from: dataencrypt::save() in userdataencrypt.o "_aes_set_decrypt_key", refere...

javascript - Remove attribute scroll spy Angular.js -

i have script angular.js , have smooth scroll on page scrollspy, menu animates when scrolling of page normal don't want it, want disable scroll spy , reactivate after. i tried remove attribute scrollspy before scrolling et reactivate after scroll spy works again don't know why. this code : $(document).ready(function() { $('.scroll').click( function() { // au clic sur un élément $('.nav a.scroll').removeattr('du-scrollspy'); var page = $(this).attr('href'); // page cible var speed = 750; // durée de l'animation (en ms) var top = $(page).offset().top-24; $('html, body').animate( { scrolltop: top }, speed ); // go $('.nav a.scroll').attr('du-scrollspy',""); return false; }); }); <ul class="nav nav-list"> <li> <a class="scroll" href="#section1_1...

Netbeans Cordova PushPlugin not working on iOS -

i'm building cordova project netbeans, uses pushplugin ( https://github.com/phonegap-build/pushplugin ). it works great on android, on ios doesn't register device. doesn't give errors. what's strange plugin folder (com.phonegap.plugins.pushplugin) in projects /plugins folder, it's not being copied platforms/ios/[appname]/plugins on build. i have in config.xml: <feature name="pushplugin"> <param name="android-package" value="com.plugin.gcm.pushplugin"/> <param name="ios-package" value="pushplugin"/> </feature> and work following javascript: var pushnotification; function ondeviceready() { alert('ready'); try { pushnotification = window.plugins.pushnotification; if (typeof device == 'undefined') { alert('device undefined'); } if (device.platform == 'android' || device.platform == 'android' || devi...

php - Change month name from other language to english in Smarty -

how change month name current locale (polish pl) english language in smarty? i have this {$product->specificprice.to|date_format:'%d %b %y %h:%m:%s'} which gives me 17 maj 2015 00:00:00 "maj" in polish language means may , want have markup: 17 may 2015 00:00:00 you may want set locale time/date formats in php code : setlocale(lc_time, en_us.utf8); if want output dates in english in few places in templates , keep time/date locale polish, should write custom smarty modifier , use output dates in custom format. not best simple way re-use smarty's date_format in custom modifier, following example shows (considering smarty 3): class smarty_extended extends smarty { private $_locale; public function __construct($defaultlocale) { parent::__construct(); $this->_locale = $defaultlocale; $this->loadplugin('smarty_modifier_date_format'); ...

c# - How to host my website developed using sql and asp.net locally? -

Image
i have developed online examination system project using visual studio web 2013 ide, using asp.net , sql server 2014 , css. want host in 1 of 50 systems acts server , remaining should able access page using server's ip address. the small version of iis installed visual studio helping me host website locally. now question is... how can achieve this. thanks in advance. you need install iis host web application. don't know kind of operating system have i'll post steps windows 8.1. go control panel -> programs , features -> turn windows features on or off from there check internet information services (as shown in image below) after install open internet information services manager click on default web site , on right panel click basic settings . in physical path box enter path application resides , click ok. now, make sure login iis_usr has access database , you're set. for more detailed list of steps , more configuration optio...

Splitting a csv with awk: how to consider returns? -

i have file: field1|field2|field3|f41;f42|f5 field1|field2|field3|f41|f5| field1|field2|field3|f41;f42;f43|f5 i want parse , obtain: field1|field2|field3|f41|f5 field1|field2|field3|f42|f5 ... in short make subparsing according semicolumn in field 4. awk script following: awk < myfile.txt -f\| '{ n=split($4,a,";"); print $1 for(i=0; ++i <= n;) print $1"|"$2"|"$3"|"a[i]"|"$5"|"; }' it works, anyway lines not ending "|" first character of following line disappearing! example, given file get: field1|field2|field3|f41|f5 ield1|field2|field3|f42|f5 i think due fact there no "|" @ end of line. there way tell awk consider carriage return? don't write loops using wacky syntax for(i=0; ++i <= n;) obfuscates code (e.g. need think if i 0 or 1 first time through loop since it's not stated). write them intended written for (init;condition;increment) : for(i=1;i...

php - How to get URL string in ZF2 controller -

i want url in controller method route. $route = $this->url('my/route', array('id' => $myid), array( 'force_canonical' => true, )); this give me route object want url $link = "http://example.com/my/route/23" in variable have send other action display text. you can generate url route way : $params = array('id' => $myid); $url = $this->url()->fromroute('my/route', $params); doc: ( http://framework.zend.com/manual/current/en/modules/zend.mvc.plugins.html )

Android - view disappear during animation -

i got custom animation, create on runtime simple translate. working fine, got no problems it, on nexus 10 latest android animation randomly start disappear , can't restart app. working, can see view on first , last frame of animation, issue during animation, won't render it. when highlight nested layouts can see animation occur. the app complex, cause got unity player subview , video view in there. any ideas? in end "gone" parameter on 1 of views causing issue. replace "invisible" , fix it.

javascript - Can't find controller in routes file hapijs -

i'm new whole nodejs world , i'm trying create simple app hapi.js myself started around here. anyways, i've got routes file setup way: var userscontroller = require("./src/controllers/userscontroller.js"); exports.register = function(server, options, next) { server.route([ { method: 'post', path: '/register', handler: userscontroller.register }, ]); next(); }; exports.register.attributes = { name: 'routes', version: '0.0.1' }; and have controller var hapi = require('hapi'); var usermodel = require('./src/models/user.js'); function userscontroller(){}; userscontroller.prototype = (function(){ return { register: function register(request, reply) { var newuser = user({ name: request.params.name, username: request.params.username, password: request.params.password }); newuser...

mysql - PHP pull specific sets of images from a directory -

i'm pulling image directory (images) , placing in html table row along mysql query. php finds image mysql db id matches image name. i.e. if id = 12 12.jpg pulled directory using $imgnum in path. <?php if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $imgnum = $row["id"]; ?> <tr> <td> <img src="images/<?php echo $imgnum ?>.jpg"/> the issue there may series of images associated row, i.e. 1-1.jpg 1-2.jpg , on, there may 1 , code above works fine. is there way output images name equalling id dash afterwards picks other associated images? if can tell me learn achieve this? cheers you can use php's glob() find similar files. along lines of this: foreach (glob("/path/to/images/folder/" . $imgnum . '-*') $filename) { // $filename }

database - Why does isOpen() function always return true? -

in constructor(qt 5.4.1 - windows 7): qsqldatabase db = qsqldatabase::adddatabase("qsqlite"); db.setdatabasename(":memory:"); db.open(); qsqlquery q; q.exec("create table authors(num integer, birthdate date)"); q.exec("insert authors values('123', '2015-01-01')"); qdebug()<<"your info saved in db."; every things okay until but, later, need change db , save date permanently, so: int dialog::saveinfospermanent() { qsqldatabase::database().close(); if ( qsqldatabase::database().isopen ()) { qdebug()<<"db open."; return 1; } qsqldatabase db = qsqldatabase::adddatabase("qsqlite"); db.setdatabasename("newdb.db"); db.open(); qsqlquery q; q.exec("create table authors(num integer, birthdate date)"); q.exec("insert authors values('123', '2015-01-01')"); qdebug()<<"your info ...

onload - XUL event listener for page load (in current tab only) or tab switch -

is there simple script allow me notified if page loaded in current tab or if new tab in focus? this i've found. hope helps else: // http://stackoverflow.com/questions/8355354/get-current-url-when-changing-tabs-in-xul-in-firefox window.addeventlistener("load", function(e) { gbrowser.tabcontainer.addeventlistener("tabselect", phoenix.ontabchange, false); }, false); window.addeventlistener("unload", function(e) { gbrowser.tabcontainer.removeeventlistener("tabselect", phoenix.ontabchange, false); }, false);

c# - WebSocket fired notifications -

is possible fire windows phone notification or change live tile websocket event? i want eg. change live tile content remotely server. app should have such connection , should work without running app. can me this? yes, possible using push notification windows phone . below steps your app requests push notification uri push client service. the push client service negotiates microsoft push notification service (mpns), , mpns returns notification uri push client service. the push client service returns notification uri app. your app can send notification uri cloud service. when cloud service has info send app, uses notification uri send push notification mpns. mpns routes push notification app. see this msdn page understand tile notification in detail.

php - Download html after javascript loads with ajax -

i having trouble script. supposed download html website , use specific data , output website. website need download html uses javascript generate important data. how can download html after javascript has loaded, , use ajax sent php? before using file_get_contents , downloads raw html. you should take headless browser, know https://github.com/ariya/phantomjs phantomjs, i'm sure there others.

java - Insert dynamic data into 2D array of strings -

i trying make catalog shop. have 2d array: string childelements[][] = new string[][]; i want add data array. data array: arraylist<string> names = new arraylist<string>(); names can vary depending on input get. for example if furniture store, categories tables , chairs etc. i have categories stored in array like: string groupelements[] = {"tables", "chairs"}; and names contains: {"wood", "metal", "4-seater", "6-seater"} so, want childelements array reflect like: childelements = ["chairs"]["wood", "metal"] ["tables"]["4-seater"]["6-seater"] so how insert data serve needs? i stick array of arrays , not go list or hashmap architecture depends on that. as @dude suggested use hashmap, organise things easier. in case category key , value array. // create map store map<string, list<string...

javascript - JQuery plugin issue with IFrame -

i have plugin records user action on website. actions recorded in different window of same browser. ie, works on sites except ones having iframe. script gets blocked on sites having iframes following error: script5: access denied. its self created plugin. the error on window.open not open new window properly below snippet of plugin. newwindow = window.open("", "scriptgen", "menubar=0,directories=0,toolbar=no,location=no,resizable=yes,scrollbars=yes,width=450,height=250,titlebar=0"); newwindow.document.write('<title>new console</title>'); using alert(window) displays "[object window] on sites..but on sites having iframes, displays "[object]" please guide. i don't know version of jquery using, think should update 1.11.0: https://jsfiddle.net/j3lac/ - try 1.10.1 (not working), , 1.11.0 (working) html: <div id="body"></div> <input id="button" type=...

c# - Query to see last 6 months records? -

select sum(invoice_amount) invoice_amount, count(*) invoice_count payment_exception pe inner join invoice_details ind on ind.customer_referenceid = pe.id pe.customer_code = '1001012' , ind.status='submit' select sum(invoice_amount) invoice_amount,count(*) invoice_count payment_exception pe inner join invoice_details ind on ind.customer_referenceid=pe.id pe.customer_code='1001012' , ind.status='submit' , ind.invoice_date>=dateadd(m,-6,getdate()) group invoice_amount you need add group condition .

What is the purpose of ping in SIGNALR (When transport is through WebSockets) -

ping?_=145265589222 ping?_=145265589223 ping?_=145265589224 ping?_=145265589225 i can't attach image, showing browser ping result above. please tell me ping purpose , if set pinginterval=null, drawback or disadvantage.

php - Select Query is not working as it should work - MYSQL -

i have data in database represents name, state , types of cases attorney does: name: new attar states: a:2:{i:0;s:13:"massachusetts";i:1;s:13:"new hampshire";} cases types a:13:{i:0;s:1:"5";i:1;s:1:"7";i:2;s:1:"8";i:3;s:1:"9";i:4;s:2:"10";i:5;s:2:"11";i:6;s:2:"13";i:7;s:2:"14";i:8;s:2:"15";i:9;s:2:"16";i:10;s:2:"17";i:11;s:2:"18";i:12;s:2:"19";} name: kevin regan states: a:1:{i:0;s:13:"massachusetts";} cases types a:1:{i:0;s:2:"14";} name: matthew gendreau states: a:2:{i:0;s:13:"massachusetts";i:1;s:13:"new hampshire";} cases types a:16:{i:0;s:15:"multiselect-all";i:1;s:1:"5";i:2;s:1:"2";i:3;s:1:"7";i:4;s:1:"8";i:5;s:1:"9";i:6;s:2:"10";i:7;s:2:"11";i:8;s:1:"1";i:9;...

mysql - In My Project i have x_user_module_perm table for which i need to keep one primary key and one composite primary key -

i using syntax :- create table `x_user_module_perm` ( `id` bigint(20) not null auto_increment, `user_id` bigint(20) null default null, `module_id` bigint(20) null default null, `create_time` datetime null default null, `update_time` datetime null default null, `added_by_id` bigint(20) null default null, `upd_by_id` bigint(20) null default null, `is_allowed` int(11) not null default '1', primary key (`id`), primary key (`user_id`,`module_id`), key `x_user_module_perm_idx_module_id` (`module_id`), key `x_user_module_perm_idx_user_id` (`user_id`), constraint `x_user_module_perm_fk_module_id` foreign key (`module_id`) references `x_modules_master` (`id`) on delete cascade on update cascade, constraint `x_user_module_perm_fk_user_id` foreign key (`user_id`) references `x_portal_user` (`id`) on delete cascade on update cascade ) ; i getting error cannot use 2 primary key's do possible, guy's please guide me !!! try changing primary key (user_id,module_id) ...

winapi - Showing a tooltip via TTM_TRACKACTIVATE does not work -

in background process want display short message balloon in tray area. however, not want add tray icon that. hence create tooltip icon , want place near tray. however, sending ttm_updatetiptext , ttm_trackposition , ttm_trackactivate returns 0. while not sure if should case or not, following code not show tooltip window , don't know why: this code: // "hwnd" hwnd hidden background window of background process hwnd htraywnd = findwindow(_t("shell_traywnd"), null); getwindowrect(htraywnd, &traypos); hwnd hwndtip = createwindowex(null, tooltips_class, null, ws_popup | tts_alwaystip | tts_balloon, cw_usedefault, cw_usedefault, cw_usedefault, cw_usedefault, hwnd, null, null, null); lresult ret; toolinfo toolinfo = { 0 }; zeromemory(&toolinfo, sizeof(toolinfo)); toolinfo.cbsize = sizeof(toolinfo); toolinfo.hinst = getmodulehandle(null); toolinfo.lpsztext = _t("test test"); toolinfo.hwnd = hwnd; ret = sendmessage(hwndtip, ttm...

paraview - Edit data in tecplot -

the results in tecplot through generated .vtk files small (eg magnitude of ^-18) because run analysis through scaled down model. i give results in exagerated form deflection , stresses visible. need multiply results factor. can in tecplot interface or should find way write .vtk files magnification factor. a method either appreciated. ps - have used calculator in paraview there similar in tecplot ? thanks you can create new variable using tecplot calculator . in : data > alter > specify equations in menu : select zone want alter (in case of doubt, select zones) create new variable new_var original variable var multiplied factor (eg. 100) : {new_var} = {var}*100 use "compute" button nb : variables names must put between braces you can find names of variables "data set info..." button, in top right corner of "specify equations" menu.

wix - Set location of binaries in wixproj file -

i using wix 3.9 , when run continuous integration build in tfs error heat.exe: directory not found because tfs putting binaries in different location local machine, project build locally not on tfs. in wixproj file have location set binaries works locally dir=$(solutiondir)\projectname\bin\$(configuration) . there can set find binaries both on local machine , tfs? i looking project reference variable $(var.myproject.targetdir) , doesn't seem work in wixproj files. i worked around issue changing project files output binaries same location team foundation build. way both desktop , continuous integration builds can use same reference common binaries directory. if using team foundation build 2012 or earlier directory reference be: dir=$(solutiondir)..\binaries\$configuration . corresponding output path in c# project ..\..\binaries\release or ..\..\binaries\debug (assuming project folder located in root of sources directory). if using team foundation build 2013...

java - App runs fine on emulator, but crashes on real device -

i have tried doing app parses xml files. in emulator works fine, when run in real device, android phone , android tablet, crashes ... this mainactivity.java public class mainactivity extends actionbaractivity { public list<unitmodel> model = null; private string filename = "modelinfo.txt"; unitmodelparser parser = new unitmodelparser(); public list<gps> coordinate = new arraylist<gps>(); private string fname; gpsxmlparser gpsparser = new gpsxmlparser(); arraylist<gps> coorlist = gpsparser.getitemslist(); string tag = "test"; private static final string folder_path = environment.getexternalstoragedirectory() + "/gps/"; file dir = new file (folder_path); protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); new loadmodeltask().execute(); button btnmodel = (button) findviewb...

java - how to add an arraylist of objects to file -

i want write program have sign , sign in button. if user press sign button username , password must written file. have problem in appending file. have arraylist of object(user) called people, , add arraylist file. when print contents of file see first user, , if print arraylist, has 1 object last one. here addmethod in class: public class addtofile { arraylist<user> people = new arraylist<user>(); user user; public void add(string username, string password) throws filenotfoundexception, ioexception, classnotfoundexception { user u1 = new user(username, password, "hello", null, null, null); fileoutputstream fout = new fileoutputstream("f.txt", true); objectoutputstream out = new objectoutputstream(fout); people.add(u1); system.out.println(people.size()); (user people1 : people) { system.out.println("user " + people1.username + " pass " + pe...

ORACLE SQL: Show the department name, id, and # of employees of the dept. that has the least # of employees -

note, homework question! show department number, department name, , number of employees working in department has least number of employees. i can figure out how many employees each department has, how show department least number of employees? select employees.department_id, departments.department_name, count(employee_id) employees join departments on employees.department_id = departments.department_id group employees.department_id, departments.department_name; what need having clause, allows apply condition after group by clause applied. in other words, allows apply condition on aggregate expression: select employees.department_id, departments.department_name, count(employee_id) employees join departments on employees.department_id = departments.department_id group employees.department_id, departments.department_name; having count(*) > 5 -- here!

objective c - Share the same UI for two subclasses in Obj-C/Storyboard -

i have viewcontrollera , , ui layout designed in interface builder (storyboard). viewcontrollera has 2 concrete subclasses, viewcontrollerb1 , viewcontrollerb2 ; have same ui superclass viewcontrollera , run different logic. how can create 2 different concrete classes share same ui storyboard in must indicate view controller's class? unfortunately storyboard doesn't support subclassing. should create delegate in viewcontrollera different logic.

rest - JBOSS spring restful web module deployment error Caused by: org.springframework.beans.FatalBeanException -

this has been make me confused while, have web module, deployed jboss fuse version 6.0.0.redhat-024. below config web.xml , pom.xml. <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/applicationcontext.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <servlet> <servlet-name>jersey web application</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.servletcontainer</servlet-class> <init-param> <param-name>com.sun.jersey.spi.spring.container.servlet.springservlet</param-name> <param-value>au.com.bookworld.inte.healthmonitor.service</param-value> </init-param> <load-on-startup>1</load...