Posts

Showing posts from January, 2010

sql server - SQL Insert a record and use its Id to update another set of records foreign key -

i have 2 tables combinableorders , orders , tempory table of order ids orders contain nullable fk combinableorders i create record follows insert combinableorders ([rank]) values (0) i need associate new combinableorder set of orders derived temporary table of ids update orders set orders.combinableorder_id = @id_to_original_insert orders orders inner join @ids ids on orders.id = ids.id how id new created combinableorders? you want declare variable of right type declare @id int and set using scope_identity() after insert select @id = scope_identity() alternatively output in insert using output clause, that's may more complicated in case.

python - How to be memory-efficient with variables in classes? -

suppose, sake of example, have class this: def class foo(object): def __init__(self,x): self.x = x def lookup(self): return dict[x] the purpose of lookup function x in dict , return value. suppose dict large. wondering whether declare dict in class, or whether declare dict global variable. i worried memory-efficiency: dict going constant, , want not take more memory need. thus, asking how classes use memory. if declare e.g. 50,000 instances of foo , , declare dict within foo , mean spawning 50,000 copies of foo ? whereas if refer dict global variable, not spawn additional copies? how make few copies of dict possible? ideally, program have one. in case should have dict global variable. idea of inner variables can change , use them independently without clashes. that's why every instance of foo have it's own copy of dict. (actually named self.dict - should have self.x argument in lookup function uses object's inner variable.)

sql server - Joining multiple tables to one table in sql -

i have rather complex (well me) sql query happening , having trouble concepts. i have following sql on webpage building select [dbo].[enrolment].[_identity], [dbo].[enrolment].commencementdate, [dbo].[enrolment].completiondate, [dbo].[enrolment].enrolmentdate, [dbo].[course].name coursename, [dbo].[course].identifier qualcode, [dbo].[person].givenname, [dbo].[person].surname,[dbo].[employer].name empname, [dbo].[employer].address1,[dbo].[employer].suburb,[dbo].[employer].phone, [dbo].[employer].postcode,[dbo].[enrolmentstatus].name enrolname, [dbo].[student].identifier,[dbo].[student].person,[dbo].[contact].person contactid (((([dbo].[enrolment] left join [dbo].[course] on [dbo].[enrolment].course = [dbo].[course].[_identity]) left join [dbo].[employer] on [dbo].[enrolment].employer = [dbo].[employer].[_identity]) left join [dbo].[enrolmentstatus] on [dbo].[enrolment].status = [dbo].[enrolmentstatus].[_identity]) left join

html - Python 3.4 - reading data from a webpage -

i'm trying learn how read webpage, , have tried following: >>>import urllib.request >>>page = urllib.request.urlopen("http://docs.python-requests.org/en/latest/", data = none) >>>contents = page.read() >>>lines = contents.split('\n') this gives following error: traceback (most recent call last): file "<pyshell#4>", line 1, in <module> lines = contents.split('\n') typeerror: type str doesn't support buffer api now assumed reading url pretty similar reading text file, , contents of contents of type str . not case? when try >>> contents can see contents of contents html document, why doesn't `.split('\n') work? how can make work? please note i'm splitting @ newline characters can print webpage line line. following same train of thought, tried contents.readlines() gave error: traceback (most recent call last): file "<pyshell#8>"

ios - UINavigationBar on top of status bar after dismiss a modal view controller -

Image
i have modal view controller , embed in navigation controller a. presenting navigation controller b, after navigation controller b dismissed, navigation bar on top of status bar in navigation controller a. can see pic below. using ios 8.0 develop app way.

sql - Find missing sequences by category -

i have identify missing records example below. category batchno transactionno +++++++++++++++++++++++++++++++++ cat1 1 1 cat1 1 2 cat1 2 3 cat1 2 4 cat1 2 5 cat1 3 6 cat1 3 7 cat1 3 8 cat1 5 12 cat1 5 13 cat1 5 14 cat1 5 15 cat1 7 18 cat2 1 1 cat2 1 2 cat2 3 6 cat2 3 7 cat2 3 8 cat2 3 9 cat2 4 10 cat2 4 11 cat2 4 12 cat2 6 14 i need script identify missing records below category batchno +++++++++++++++++++ cat1 4 cat1 6 cat2 2 cat2 5 i not need know cat1 8 , cat2 7 not there potentially have not been inserted yet. you can create temporary result set possible batch no max batch number each category select batch no not available. cr

javascript - Test if a promise is resolved or rejected with Jasmine in Nodejs -

i know how in mocha want know how jasmine. tried describe('test promise jasmine', function() { it('expects rejected promise', function() { var promise = getrejectedpromise(); // return expect(promise).tobe('rejected'); return expect(promise.inspect().state).tobe('rejected'); }); }); however, state pending and, of course, test fails. couldn't find example online make work. can please me this? thanks. to test asynchronous code jasmine should use its async syntax , e.g.: describe('test promise jasmine', function(done) { var promise = getrejectedpromise(); promise.then(function() { // promise resolved done(new error('promise should not resolved')); }, function(reason) { // promise rejected // check rejection reason if want done(); // success }); });

c11 - C: Is there anything called a 'prefix expression'? -

the iso/iec 9899:2011 (american national standard c11) talks postfix expressions, there's nothing called prefix expression. why so? there's whole syntactic category postfix expression , prefix operators classified unary operators , defined in syntactic category unary expression , include prefix increment , decrement operators. note postfix expressions include array subscripting, function calls, , . , -> operators, not postfix increment , decrement. as why: there no stated reason — wasn't seen necessary name.

asp.net - How convert a string into Datetime in c# -

i want convert string "12092014" datetime object 12 september 2014. if ddmmyyyy standard date , time format of currentculture , can use datetime.parse directly; var date = datetime.parse("12092014"); if not, can use custom date , time format datetime.tryparseexact method like; string s = "12092014"; datetime dt; if(datetime.tryparseexact(s, "ddmmyyyy", cultureinfo.invariantculture, datetimestyles.none, out dt)) { console.writeline(dt); }

javascript - Retain parent state in AngularUI Router -

i'm developing application angularjs has phonebook. state page.phonebook contains list users , companies , form filters. data loaded via ngresource backend. if click on user, i'm getting users detail page. when browser (backspace), i'm getting phonebook list, new $scope . means lost old state filters, data, etc. i guess problem load state page.phonebook.user in page view, replaces page.phonebook state. but somehow possible retain old state? includes scroll position, filter values , data server. this state configuration: $stateprovider .state('page', { abstract: true, controller: 'pagecontroller', templateurl: 'app/templates/page.html', }) .state('page.phonebook', { url: "^/phonebook", templateurl: 'app/templates/page.phonebook.html', controller: 'phonebookcontroller' }) .state('page.phonebook.user', { url: "^/user/:userid", views: { '@page&

HANA Cloud Portal widget creation using SAPUI5 -

i'm trying create 2 widgets use <sap-context> feature hana cloud portal using sapui5 framework. the problem cannot find tutorials/examples of using mvc model widget creation. every example have found till uses sapui5 inside <script> tag in html file if it's jquery or javascript. is possible @ create widgets using mvc model @ all? if is, links examples/tutorials me alot. nb: as matter of fact, did try use mvc model, when try call function using following syntax: sap.ui.getcore().byid('<view-name-here>').getcontroller().publish("<key-name-here>", "<value-here>"); i uncaught typeerror: cannot read property 'getcontroller' of undefined error. i'm not sure causes error - flaw in code or fact there no 'core' if don't build sapui5 application... (i'm still new sapui5 thing) thank you.

amazon web services - How to load gzipped json data from a copy -

copy tmp_data 's3://mybucket/copy/batch_insert_data_1417072335118.json' credentials 'aws_access_key_id=xxxxxxxxxxxxxxx;aws_secret_access_key=yyyyyyyyyyyyyyyyyyyyyyyyy' json gzip acceptinvchars ' ' truncatecolumns trimblanks; above copy command works without gzip. want use gzip speed process. im uploading gzipped json file s3 bucket. above copy command not work? idea how load gzipped json file copy in redshift? you missing json_option ( http://docs.aws.amazon.com/redshift/latest/dg/r_copy.html ). try setting 'auto'. see corrected example below: copy tmp_data 's3://mybucket/copy/batch_insert_data_1417072335118.json' credentials 'aws_access_key_id=xxxxxxxxxxxxxxx;aws_secret_access_key=yyyyyyyyyyyyyyyyyyyyyyyyy' json 'auto' gzip acceptinvchars ' ' truncatecolumns trimblanks;

After setting up Android Studio I was given a notification that says, The directory / is under Git, but is not registered in the Settings -

Image
i not sure means or need do. if can take moment enlighten me grateful. when gives message there option "configure" or "ignore". click "configure". it bring version control settings , list path project under heading "unregistered roots". click on path , click plus sign in upper right hand corner. then click ok exit version control settings. (see this question .)

c++ - Assigning a new value to a iterator of a intrusive container -

while working boost intrusive container splay_set, have reset local iterator member variables. please see sample code below - #include <boost/intrusive/splay_set.hpp> using namespace boost::intrusive; class obj { public: obj(){}; ~obj(){}; boost::intrusive::list_member_hook<boost::intrusive::link_mode<boost::intrusive::normal_link> > m_memberhook; private: int a; }; typedef splay_set<obj, compare<greater<obj> >, member_hook<obj, splay_set_member_hook<boost::intrusive::link_mode<boost::intrusive::normal_link> >, &obj::m_memberhook> > storagesset; typedef storagesset::iterator storagessetiter; class storage { public: bool init(storagesset& sset) { // error: "no match operator= in ..." m_curiter = sset.begin(); ////<<<<------------- how set new iterator m_enditer =

javascript - web browser's back button is taking me out of JQuery mobile application -

i using jquery mobile building web application single page concept means each pages separate .html files javascript , css files loading in 1 index.html for changing page using : $.mobile.changepage('home.html', {transition: "none", changehash: true}); but when pressing button of browser, exiting application. can suggest me how implement button functionality. in advance.

java - eclipse.ini has been changed, but eclipse wont updated in Ubuntu 14.04 -

first, have done lot of research , answer think best : https://stackoverflow.com/a/17498043/1203797 according answer, eclipse.ini should on same directory of eclipse because downloded internet ( not via terminal/software center ). i need change ram used eclipse because keep getting gc overheat error when trying run big application. this eclipse.ini : -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140603-1326 -product org.eclipse.epp.package.jee.product --launcher.defaultaction openfile -showsplash org.eclipse.platform --launcher.xxmaxpermsize 2048m --launcher.defaultaction openfile --launcher.appendvmargs -vmargs -dosgi.requiredjavaversion=1.6 -xx:maxpermsize=2048m -xms512m -xmx2048m note have updated xmx/xms value, : -product org.eclipse.epp.package.jee.product -vm /usr/bin/java eclipse.home.location=file:/home/tama/development/adt-bundle/eclipse/ eclipse

issues with python xml parsing -

i'm new xml , rest have basic knowledge python. i'm facing issues while trying parse attached xml file. i use beautifulsoup library parse file and, unknown reason, can access different fields of entries 2 , 3 not entry 1, while formatted same way. can tell i'm doing wrong (attached) code , output please? <?xml version='1.0' encoding='utf-8'?> <feed xmlns="http://www.w3.org/2005/atom"> <title type="text">news</title> <id>1</id> <link href="" /> <link href="http://192.168.1.12:8083/mywebapp/rest/listofentries/1/entries" rel="self" /> <updated>2014-11-26t10:41:12.424z</updated> <author /> <entry xmlns:georss="http://www.georss.org/georss"> <title type="html">test rest</title> <content type="html">1</content> <author>

Logout user when admin blocks using codeigniter -

here have little bit confusion in coding. , problem is, when user logged in account. @ time,if admin blocks user whoever logged in. , if user clicks on link user must logout. i have created bunch of controller in project. so, don't make change in controllers. how write code in short , sweet.? thanks in advance. :) you need extend ci_controller , add in __constructor() validation user blocked/not

android - How to get Push Notification through GCM server through phonegap -

i have tried did not correct 1 please me. , need source code push-notification android using gcm server. start following tutorial 1 : http://devgirl.org/2013/07/17/tutorial-implement-push-notifications-in-your-phonegap-application/ and come , tell if went wrong. managed working in few hours of work, should fine tutorial.

How to store in a structure anonymous functions generated by a loop in Matlab? -

i store each anonymous function generated matlab loop in structure ( and not in cell ) , access , evaluate each stored anonymous function in separated loop. report simple example cell approach. don't know efficient way use structure in context. gammatrue = 2; deltatrue = -3; t = 4; n = 3; bs = 10; r = 5; bsdensdraws = cell(1, bs); bsdensdrawsev = zeros(t*n*r, bs); w = 1:bs data = randn(t*n, n-1); mutrue = gammatrue/deltatrue*data; sigmatrue = repmat(1/(deltatrue^2)*eye(n-1), [1 1 t*n]); draws = mvnrnd(repmat(mutrue, [r 1]), repmat(sigmatrue, [1 1 r])); %matrix (r*t*n)x(n-1)) bsdensdraws{w} = @(z) mvnpdf(draws,repmat(z(1)/z(2)*data, [r 1]), ... repmat(repmat(1/(z(2)^2)*eye(n-1), [1 1 t*n]), [1 1 r])); end param = [2 3; 4 5; 6 7]; w = 1:bs y = 1:size(param,1) gamma = param(y,1); delta = param(y,2); bsdensdrawsev(:,w) = bsdensdraws{w}([gamma delta]); %vector (t*n*r)x1 end end you need acc

arrays - PHP: Data loss when pass an object -

i have class array of socket class { public $clients = array(); } and class b extends thread in constructor pass class . class b extends thread { private $a; public function __construct($a) { $this->a = $a; } } next, if add print_r instruction, $this->a = $a; print_r($this->a); print_r($a); i have output $this->a a object ( [clients] => array ( [0]=> 0 ) ) this output $a . a object ( [clients] => array ( [0]=> resource id #n ) ) why lose socket data? i have tried pass &$a in construct.

c - Getting a seg fault when trying to append a point in 3D space to the end of an array -

i have function appends point in 3d space end of array , calculates time takes append each point. when ran code, created initialized code fine. when tried run function append, seg faulted right away. i've been looking @ code can't figure out why seg faulted. can me out? this append code: int point_array_append( point_array_t* pa, point_t* p) { assert( pa ); assert( p ); if( pa->len < pa->reserved ) { size_t new_res = pa->len * 2 + 1; // add 1 take care of null array size_t sz= new_res * sizeof(point_t); point_t* tmp = realloc( pa->points, sz ); if( tmp == 0 ) return 1; //fail pa->points = tmp; pa->reserved = new_res; } pa->points[pa->len] = *p; // copy struct array pa->len++; return 0; } these 2 structs use: typedef struct point { double x, y, z; // location in 3d space } point_t; typedef struct { size_t len; // number of points in a

linux - Socket unable to detect disconnect -

i have written server code accepts connection through client on wifi. wifi socket opened on wifi dongle shows ttyama0. i create socket serv_addr.sin_family = af_inet; serv_addr.sin_addr.s_addr = inaddr_any; serv_addr.sin_port = htons(port); then usual accept... while(1) { new_fd = accept(sfd,(struct sockaddr*)&client_addr,&len); ... ... } and in 1 of reader threads doing this: void* command2buff(void *args) { ... while(1) { .... clientbytes = recv(str_fd.new_conn_fd,&temp,1); if(clientbytes == 0 || clientbytes == -1) { ... } globalcmdbuf[wr] = temp; } } so recv should detect remote connection has turned off. when turn wifi off android phone code on embedded machine hangs. i turn on wifi on phone

rdbms - User Count for Hour -

i need find count of user in different time eg: table: start_time | end_time | user_id ---------------------------------------------------------- 1) 2014-11-25 01:23:00 | 2014-11-25 06:37:01 | 254 2) 2014-11-25 01:54l33 | 2014-11-25 02:25:31 | 365 3) 2014-11-25 01:55:36 | 2014-11-25 02:26:32 | 547 4) 2014-11-25 05:16:21 | | 485 5) 2014-11-25 05:29:03 | 2014-11-25 06:32:46 | 123 required result: time | count -------------- 1 | 3 5 | 3 the user signed in particular interval should calculated in count interval hours eg: user 254 logged in @ 1:23 , logged out @ 06:37 . count should in 1,2,3,4,5,6 hrs. reply me if explanation not clear. thanks in advance here's query works, might not efficient. -- count how many of each count quantity appears select qty, count(*) (-- count number of different hours each user select user_id, count(*) qty -- don't need user_

How to index data from mongodb to solr 4.7 -

does know how index data mongodb solr i've followed previous procedure mentioned here can give step step procedure fix issue, here scripts on mydataconfig.xml <dataconfig> <datasource name="mymongo" type="mongodatasource" database="test" /> <document name="products"> <entity processor="mongoentityprocessor" query="{'active':1}" collection="testusers" datasource="mymongo" transformer="mongomappertransformer" > <field column="name" name="name" mongofield="name"/> <field column="position" name="position" mongofield="position"/> </entity> </document> and in solrconfig.xml <lib dir="../../lib/" regex="solr-mongo-importer.jar" /> <lib

node.js - Passport authentication not working in sails.js application -

i have sails js application. trying setup authentication using passport.js authentication layer sails-generate-auth . have configured app following steps given in documentation. but when lift sails app, authentication not working. able access controllers, when not logged in (it's not redirecting login page). i added console.log statement in api/policies/passport.js follows: module.exports = function (req, res, next) { passport.initialize()(req, res, function () { passport.session()(req, res, function () { res.locals.user = req.user; console.log(req.user); // added me next(); }); }); }; now, when access controllers before login or after logout, printing undefined . when logged in, printing user data. idea why not checking authentication? i using local authentication strategy , have commented out others (twitter, facebook...) passport doesn't have policy deny access controller. this, have create policy. see link more deta

java - Avoid carriage return in paragraph with doxc4j -

i think paragraph elements definition creates new line need insert elements first element of page not moving down existing elements. is there element can use instead of paragraph? think tables , paragraphs available , understand tables contains paragraphs don't work purpose. or maybe exists property can set avoid new paragraph moving other elements? i tried keepnext , keeplines not i'm looking for. you can absolutely position ellipse, without being in first paragraph on page. in word, on ellipse, right click , choose "more layout options". on position tab, eg 1" below page. this creates like: <w:r> <w:pict> <v:oval strokecolor="#243f60 [1604]" strokeweight="2pt" style="position:absolute;margin-left:41.25pt;margin-top:1in; width:207.35pt;height:1in;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-width-percent:0;mso-wrap-distance-left:9pt;mso-wrap-d

indentation - IndentationError in for loop python -

i don't quite understand problem of code below for stripe in [sku.value sku in model_sheet.col(13) if str(sku.value)]: try: stripe = int(stripe) except valueerror: stripe = unicode(stripe) stars in [sku.value sku in model_sheet.col(19) if str(sku.value)]: yield hatinstance(hat_model, shade, cockade, rosette, color_ribbon, buttons, cover, stripe, stars, silk_band = silk_band) it says there @ line 9 column 5 indentationerror: unindent not match outer indentation level. didn't correctly followed proper pep8 indentions? better remove indentations , use tab of indentations, resolve issue. python segregates code blocks based on indentations

google bigquery - Append Data in a Big Query Table Automatically from Cloud Storage -

i have excel files want append big query table. after doing want append data same big query table using cloud storage automatically thru scheduler runs 4 times day. how this. please keep in mind not developer. know sql , big query. i suggest write simple script , host google app engine, , register bucket notification , hook gae endpoint. whenever file upload bucket, gae notificated, , invoke script, gets file, extract info it, , append table specify in big query. https://cloud.google.com/storage/docs/object-change-notification#_watching

MySQL MATCH running very slow -

i have large table 60 million rows indexed fulltext index. i running query below (for e.g) using full text search: select * text_file_data t match( t.`description_of_goods`) against('+mobile' in boolean mode) order t.id desc these queries take forever run, more 10 minutes. running on aws m3.medium server (1 vcpu, 4 gb ram). how can optimize make run faster ?

java - How to match two images whether there patterens are same or not? -

i want know example have 2 images , wants compare whether same or not searched didn't satisfying result tool or platform better matlab, mathematica, java etc , integration website. thanks in advance proposed steps: load images extract features (color, edges locations, corner points, gabor jets) define similarity measure compute similarity score between features this quick tip start literature... regarding platform suggest download library opencv in c++ http://opencv.org/ good luck

Get all the developers of a project using SonarQube API -

i know possible developers in system in sonarqube using : "/api/resources?qualifiers=dev". want developers particular project. want developer metrics of developers particular project. looking @ question, using commercial sonarsource devcockpit plugin sonarqube. in such case, means have purchased license have access sonarsource commercial support. suggest contact directly.

z3py - How can I use Z3 SMT locally -

any 1 have idea how use z3 smt locally instead of using website? know how use z3.py need use smt. rise4fun.com down makes difficult check models. z3 binaries various platforms available download on z3 website .

node.js - Node npm start error port listen on mac -

i generate new express app , when im click npm start , ctrl+c exit , try again npm start error: error:listen eaddrinuse what problem? depends on in app. process can detach console or spawn process, continue bind port.

string - Capitalise first letter of every sentence -

how capitalise first letter of every sentence in string? should use .capitalisedstring ? you can enumerate string per sentences using nsstringenumerationoptions.bysentences . detect "sentence" if first character upper-cased. so, may not perfect, can try this: import foundation let text:string = "lorem ipsum dolor elit, sed aliqfuas. imfs enim ad veniam, quis nostrud consequat? duis aute irure dolor in pariatur." var result = "" text.uppercasestring.enumeratesubstringsinrange(text.startindex..<text.endindex, options: .bysentences) { (_, range, _, _) in // ^^^^^^^^^^^^^^^^ enumerate upper cased string var substring = text[range] // retrieve substring original string let first = substring.removeatindex(substring.startindex) result += string(first).uppercasestring + substring } // result -> "lorem ipsum dolor elit, sed aliqfuas. imfs enim ad veniam, quis nostrud consequat? duis aute irure dolor in pariatur."

php - mysql column data display, fetching all fields of a column and displaying it as a link -

i have code fields of column "username". what trying is, want display each user in separate line , make link consists of each respective username. for example have usernames mike , tom in column "username" of database, want display mike link href="/mike" , tom link href="/tom". amount of usernames varying need output them all. <a href="/<?php $sql = "select * users"; $result = mysql_query($sql); while ( $db_field = mysql_fetch_assoc($result) ) { print $db_field['username'] . "<br>"; }?>"><?php $sql = "select * users"; $result = mysql_query($sql); while ( $db_field = mysql_fetch_assoc($result) ) { print $db_field['username'] . "<br>"; } ?></a> the way did here, taking names , outputs 1 link names in it. so wondering how can separate each username , give own link? thanks in advance guys! do - <?php $mysqli = n

python - Syntax Error: EOL while scanning string literal -

i wrote this: def compute_bill(food): total = 0 while item in food: if item's stock count > 0: total += prices[item] item's stock count = item's stock count - 1 then, got syntax error: eol while scanning string literal can me, please! the ' starts string, , have used in 3 places. causes 2 strings: 1 has apostrophe @ start , end, , unclosed one. unclosed 1 causes eol error because python interpreter runs out of code inspect before string finished. to fix not use apostrophies (or spaces) in variable names: def compute_bill(food): total = 0 while item in food: if item_stock_count > 0: total += prices[item] item_stock_count = item_stock_count - 1

android - Error: no results found for query -

when i've tried run code: parsequery<parseuser> query = parsequery.getquery("user"); query.getinbackground(fblogin.userobjid, new getcallback<parseuser>() { public void done(parseuser object, parseexception e) { if (e == null) { ... } else { log.e("tag", "error: " + e.getmessage()); } } }); the "fblogin.userobjid" parse user id: userobjid = (string) user.get("objectid"); well, when i've tried run code, got message: 11-27 13:48:32.827: e/tag(27174): error: no results found query what need fix it? instead of: userobjid = (string) user.get("objectid"); i wrote: userobjid = parseuser.getcurrentuser().getobjectid();

algorithm - Generating points in space according to a 3D probability grid -

if have bunch of point called point_set_a (enclosed cube example), each normalized probability value (the values based on something, e.g. flow velocity). how populate same space (cube) (say 100) point_set_b (so come x,y,z values), instead of randomly, want more points appear near point_set_a higher probability values. any ideas? pseudo code or language do. thanks! tim

How many accounts does a user have?-StackExchange -

i trying make query on stackexchange tell me for every user , on stack community present , possibly reputation on specific community. seems there no indicator in sql purpose. anyone has solution? appreciated! best italy i not have query every user specifically, there couple existing queries in data explorer can used count number of accounts exist across network: this query generates list queries run. building giant query across sites in se network utilizing output of previous point (and skipping first 4 rows , last row), can run query the results of second query show number of accounts exist on multiple sites. while doesn't show number of accounts each individual user, provide scope of shared accounts across network. querying each user prohibitively expensive in terms of resources.

vb.net - How to populate MySQL all table with vb Combo boxes and corresponding values with text boxes -

i making application on vb form want connect mysql database combo boxes , text boxes , corresponding values of tables text boxes. please let me know how can populate database tables 1 combo boxes , combo box inside value of 1 table , text boxes show corresponding values of tables. my database under: schema name :surveys. tables :ces-2005 ces -2009 ces-2010 etc values in side tables under: idces2005 state name bcg dpt nooe in order populate textboxes information database use following: textbox1.text = tablename.row(0)("name of column").tostring()

ruby on rails - ActiveAdmin and additional custom CSS files -

where can put custom css files customize activeadmin css? i see in active_admin.rb there following line: config.register_stylesheet 'active_admin.css' but can't understand file has go. want add custom styles aa's default ones lets have 2 css files, highlight.css , select2.css in config/initializers/active_admin.rb , add this: config.register_stylesheet 'highlight.min.css' config.register_stylesheet 'select2.css' note: highlight.css , select2.css should inside/under app/assets/stylesheets

java - stop for loop when get a specific value -

i have loop retrives database names .. want when got specific name stop loop , out of it.. tried didn't work : for (int = 0; < member .length(); i++) { jsonobject c = member .getjsonobject(i); // storing each json item in variable string username = c.getstring(tag_username); s1=inputname.gettext().tostring(); if (username.equals(s1)){ suc=1; return null; } else { suc=0; } } also tried break; didn't work either. how ? update this code working fine, found mistake in part of code. try do ... while loop int = 0; { jsonobject c = member.getjsonobject(i); string username = c.getstring(tag_username); i++; } while(!username.equals(inputname.gettext().tostring() && i<member.length()); this loop ends, when username equal inputname or when end of list reached.

html - IE10+ Nested 3d transforms inside overflow:auto are brake :hover behaviour -

i have trouble css 3d transforms on ie 10-11 here simplyfied html structure: <ul> <li>item 1</li> ... <li>item 12</li> </ul> and following css: ul { white-space: nowrap; overflow: auto; transform: rotatey(180deg); } li { display: inline-block; transform: rotatey(180deg); } here js fiddle the problem can't style list items :hover in ie - highlighting hardly ever if set overflow hidden/visible , or if remove transform - :hover do. also, in other browsers works great. , also, not related transform-style: preserve-3d what can fix problem? after long time got solution problem in context. the thing have aproach rotate element right-to-left: transform: scale(-1, 1); and approach uses 2d transformation instead of 3d. fixes problem in ie. jsfiddle - fixed ie but if try open above fiddle in chrome (i used version 42 dev-m) - you'll see wrong rendered scrollbar. fix - ad

playframework 2.3 - What is the activator command to generate application secret? -

i'm using play framework 2.3.6 . since play 2.3.x play commands replaced activator commands. play's documentation 2.3.x latest 2.4.x mentions commands play-generate-secret , play-update-secret not able find corresponding activator commands. we may not choose use these secrets production environment play generate secrets integration , pre-prod environments - can change frequently. has done before? proper activator commands? both activator play-generate-secret and activator play-update-secret work activator. you can find definition here in sources . , can see part of play , not activator. val generatesecret = taskkey[string]("play-generate-secret", "generate new application secret", keyranks.btask) val updatesecret = taskkey[file]("play-update-secret", "update application conf generate application secret", keyranks.btask)

Possible to put HTML annotations on PDF? -

i know can put text, links , videos..but can put html annotation well? if there's sdk, please point me well. i have tried search as possible couldn't find on it. updated: okay, here more details. i'm creating script create pdf image, , @ same time have place annotations on top of image. when person click annotation, html shown. understand there link annotations , shape annotation, i'm looking ability place html markup/codes in annotation. example, able design simple form or style text or embed youtube video. i hope i'm clear. thanks! here goes basic sample code : please add itext jar in project code : import com.itextpdf.text.document; import com.itextpdf.text.pagesize; import com.itextpdf.text.rectangle; import com.itextpdf.text.pdf.pdfwriter; import com.itextpdf.text.image; //input image in string format public void createfromimage(string input){ document document = new document(pagesize.a4.rotate()); document.setmargi

tsql - How Coalesce works in sql server? -

create table test(names varchar(100) primary key ) insert test values('hugeman') insert test values('jack') insert test values('william') insert test values('kevin') insert test values('peter') query 1: declare @sql varchar(100) select @sql = coalesce(@sql+'+','')+names test order names-- object_id =object_id('temp') print @sql this result hugeman+jack+kevin+peter+william query 2 declare @sql varchar(100) select @sql = coalesce(names+'+','') test order names-- object_id =object_id('temp') print @sql this results william+ as per documentation of coalesce, return first not null value. has result hugeman+ . returns entire rows. why query2 haven't done same ? this not stricly connected coalesce . try these selects: declare @sql1 varchar(1000) select @sql1 = isnull(@sql1, '') + names test order names print @sql1 declare @sql2 varchar(1000) select

android - Relative Layout squishing child views -

Image
i have imageview , textview inside relativelayout move them around group sticks together. looks fine in graphical layout inside eclipse. (the blue shows outline relativelayout): however when run app, child views appear squished toghether or on top of each other. imageview doesn't show anymore. i'm not sure why occurs? xml <relativelayout android:id="@+id/frameb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@+id/squashcourt" android:layout_alignleft="@+id/squashcourt" android:layout_marginbottom="8dp" android:layout_marginleft="8dp" android:clickable="true" android:orientation="vertical" > <textview android:id="@+id/tv_aboveb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:lay

python - pycharm cannot find reference 'layer' in '__init__.py' for cocos2d -

i starting out learn cocos2d using python. when write in pycharm : import cocos class helloworld(cocos.layer.layer): def __init__(self): super(helloworld, self).__init__() label = cocos.text.label('hello, world!', font_name = 'times new roman', font_size = 32, anchor_x='center', anchor_y='center') label.position = 320, 240 self.add(label) cocos.director.director.init() hello_layer = helloworld() main_scene = cocos.scene.scene(hello_layer) cocos.director.director.run(main_scene) pycharm shows error cannot find reference 'layer' in '__init__.py' when run it, code works. code works when run inside pycharm (not via terminal), although don't find surprising, thought maybe requires mentioning. doesn't gives auto-suggestions and/or auto-completes related cocos2d . any idea on how fix ? i using python 3.4.

facing issue to iterate list in drools -

facing problem list iteration in drools goodsshipment has list of goodsitems , goodsitem has list of documents my requirement is, need check atleast 1 document available or no. iam tried failed writen class checking purpose public class checkdocument { public boolean flag = false; public checkpreviousdocument() { } public boolean getpreviousdocument(goodsshipment goodsshipment) { list<goodsitem> list = goodsshipment.getgoodsitems(); iterator<goodsitem> itr = list.iterator(); while (itr.hasnext()) { governmentagencygoodsitem document = itr.next(); if (document.getdocuments().size() > 0) { flag = true; break; } } return flag; } } rule "previousdocuments minimum 1" when $o: goodsshipment() %x: checkpreviousdocuments(previousdocuments($o) == false) insert(-------------) end can ple

grails - Groovy - with closure with multiple references -

i'm trying parse json data , assign pojo in grails. i started obj.param=jsonrequest.jsonwrap.attrib.something.jsonparam after experimenting , refactoring, looks now. jsonrequest.jsonwrap.attrib.something.with { obj.param1=jsonparam1 obj.param2=jsonparam2 //... } } now, can avoid repeated use of obj reference? i'm imagining actual starting point following. on json side: import groovy.json.jsonslurper string jsontext = '''{ "jsonwrap":{ "attrib":{ "something":{ "jsonparam1": "value1", "jsonparam2": "value2", "jsonparam3": "value3", "jsonparam4": "value4", "jsonparam5": "value5" } } } }''' def jsonrequest = new jsonslurper().parsetext(jsontext) on groovy side: class objecttype { def param1, param2, param3, param4,

c# - Custom control rendering weird in Tapcontrol -

Image
here odd 1 , bit long describe bear me on one. i have control made c# 4 client profile called toggleswitch (tsw). toggleswitch design act metro switch, , splendidly ... until added tap control/tap page : the rendering acts weird not drawing background , on/off label don’t show up. affects other controls well, whole form won't draw. also both vs 2010 , 2013 design editors properties fields freeze can't access other controls and if left in normal program won't build ... crashed vs.. but, if change tap control normal either flatbutton or button stops , runs smoothly , fine, started wondering why don't render in normal so here have tried the tsw extends buttonbase clickability. changed control onpaint gets called in unlimited loop don’t help, click don’t work less important right i extended of button, no there still weird override every single method both button , buttonbase see if helped still nothing. after looking @ forms designer found property

java - Android Media Player accuracy -

i want make kind of karaoke app, need make ui changes @ particular moment (millisecond timing) mediaplayer.getduration is not same depending on device. mediaplayer.getcurrentposition gives me millisecond there not precision (it jump 200 millisecond 1 time 400 , on...) so guys, how can accuracy want ? there audio player or audio player can use in java ? thanks. theoretically accuracy depend on: 1) how ask getcurrentposition() . in cases use 100 ms interval. 2) media format use 3) , critical depend on implementation. part of hw , sw related multimedia vary device device , depend on device manufacturer, hw chips , os version. i suggest try query current position more frequently. , different media files. possible solution: you can use software implementation of media player (ex: ffmpeg can compiled android). negative side of cpu usage, battery drain , video decoding speed. devices cannot handle (too low fps) huge high quality video without hw acceler

controller - launch command from url in Symfony 2.5 -

i try eg router:debug slug : there no commands defined in "router" namespace. /** * method * * @route("/command-execute/{slug}", name="execute") * * @template() * */ public function executeaction($slug) { //todo add params , add security $kernel = $this->get('kernel'); $application = new application($kernel); $application->setautoexit(false); $options = array('command' => $slug); $input = new arrayinput($options); $output = new streamoutput(fopen('php://temp', 'w')); $application->dorun($input, $output); rewind($output->getstream()); $response = stream_get_contents($output->getstream()); //<pre> output of string array on layout echo '<pre>'; return array('response'=> $response); } any idea's ? try f

SQL Server - Merge multiple query results into one result set -

i have 3 queries return 1 columns each. select name tenant select name space select id contracts the table definitions are: tenant (id, name) space (id, name, tenantid) contracts (id, tenantid) the information have in these tables is: +----+---------+ | id | name | +----+---------+ | 1 | tenant1 | | 2 | tenant2 | | 3 | tenant3 | +----+---------+ +----+------+----------+ | id | name | tenantid | +----+------+----------+ | 1 | s1 | 1 | | 2 | s2 | 1 | | 3 | s3 | 2 | | 4 | s4 | 3 | | 5 | s5 | 3 | +----+------+----------+ +----+----------+ | id | tenantid | +----+----------+ | 1 | 1 | | 2 | 1 | | 3 | 2 | | 4 | 2 | | 5 | 2 | | 6 | 3 | +----+----------+ how can write query achieve below structure? +----------+-------+----------+ | tenant | space | contract | +----------+-------+----------+ | tenant 1 | s1 | 1 | | | s2 | 2 | | tenant

python 3.x - Counting Frequencies -

i trying figure out how count number of frequencies word tags i-gene , o appeared in file. the example of file i'm trying compute this: 45 wordtag o cortex 2 wordtag i-gene cdc33 4 wordtag o ppre 4 wordtag o how 44 wordtag o if i trying compute sum of word[0] (column 1) in same category (ex. i-gene) same category (ex. o) in example: the sum of words category of i-gene 2 , sum of words category of o 97 my code: import os def reading_files (path): counter = 0 root, dirs, files in os.walk(path): file in files: if file != ".ds_store": if file == "gene.counts": open_file = open(root+file, 'r', encoding = "iso-8859-1") line in open_file: tmp = line.split(' ') words in tmp: word in words: if (words[2]=='i-gene'):

php - Laravel revisionable models with one-to-many relationship -

is possible revisionable track changes one-to-many relationships? example: model: user. model: posts. user model uses venturecraft\revisionable\revisionabletrait; , have hasmany relationship posts. if post added or updated, can tracked revisionable under user post belongs to? thanks in advance i able come something. it's not elegant solution, it'd great if me clean (especially unset bothering me). my solution create duplicates in table model belongs to. don't know if wanted the first thing need add nullable datetime revision_at column in appropriate table. the trait pretty simple. make use of models boot() method register models updating event. fire whenever model update. that's need, since don't want revision first time creating model. <?php trait revisionabletrait { public static function boot() { parent::boot(); static::updating(function( $model ){ // grab original model , unset id

javascript - Focus on bootstrap dropdown -

i using bootstrap dropdown, want focus on dropdown can use keyboard navigate on list. way using jquery? tried use $('#myulid').focus() , not working. i able open dropdown, not focus on it. <button id="time_btn" type="button" class="btn btn-reverse dropdown-toggle" data-toggle="dropdown"> </button> <ul class="dropdown-menu" role="menu"> <li ng-repeat="item in items" ><a><span>test</span></a></li> </ul> just add <ul tabindex='1'> .... </ul> then add .focus() method

selenium webdriver - What is the default script generated by SeeTest Automation -

i need know, default script auto-generated experitest's seetest automation. propitiatory script editable? there's no default language in u can choose list of languages provided. code generated in language seetest commands created

c# - Change the background color when listbox is disabled -

i have listbox, , want change background color when listbox disabled , style variable "negative" or "positive", initial, did below: //----------------------------updated---------------------------- <listbox> <listbox.style> <style targettype="{x:type listbox}"> <style.triggers> <multidatatrigger> <multidatatrigger.conditions> <condition binding="{binding relativesource={relativesource self}, path=isenable}" value="false"/> <condition binding="{binding path=style}" value="negative"/> </multidatatrigger.conditions> <setter property="background" value="black" /> </multidatatrigger> <multidatatrigger> <multidatatrigger.cond

How to create a setup installer in Windows? -

i have application in python requires: copy specific folder programfiles run exe file installs dependencies set path variable (or run command that) create shortcut on desktop i tried installshield found out cannot start installer on way. ideas on how create simple wizzard installer? this should done every installer creation tools installshield, advanced installer, etc. have support installing file , shortcuts, prerequisites packages (your exe) , setting path variables.

matlab - "Contour not rendered for non-finite ZData" -

i'm trying plot frequency characteristic equation using ezplot, matlab gives following warning, "contour not rendered non-finite zdata". have used command plot frequency equations warning , plot display empty , not change axis range well. can please help. appreciated. here's code i'm using. % transfer matrix case-i, thin rotor clear all; clc; ei = 1626; l = 0.15; m = 0.44108; = 2.178*10^-4; i_p = 2.205*10^-5; itr = 0.24; i_pr = 0.479; syms p n; f = [1 l*1i l^2/(2*ei)*1i l^3/(6*ei); 0 1 l/ei -l^2/(2*ei)*1i; 0 0 1 -l*1i; 0 0 0 l]; p = [ 1 0 0 0; 0 1 0 0; 0 -it*p^2+i_p*n*p 1 0; -m*p^2 0 0 1]; p_r = [1 0 0 0; 0 1 0 0; 0 -itr*p^2+i_pr*n*p 1 0; -m*p^2 0 0 1]; = f*p*f*p*f*p*f; b = p_r*f*p*f*p*f; r = a(1,2)/a(1,4); a12_p = 0; a22_p = a(2,2)-r*a(2,4); a32_p = a(3,2)-r*a(3,4); a42_p = a(4,2)-r*a(4,4); ap(2,2) = a22_p; ap(3,2) = a32_p; ap(4,2) = a42_p; ap(4,4) = 1; c = b*ap; m = [c(3,2) c(3,4); c(4,2) c(4,

ruby on rails - 'devise' is not recognised as internal or external command -

can me error, cant use devise gem though installed, ive tried multiple versions still wont work? using devise 3.0.4 using hike 1.2.3 using multi_json 1.10.1 using jbuilder 2.2.5 using jquery-rails 3.1.2 using tilt 1.4.1 using sprockets 2.12.3 using sprockets-rails 2.2.1 using rails 4.1.8 using rdoc 4.1.2 using sass 3.2.19 using sass-rails 4.0.5 using sdoc 0.4.1 using sqlite3 1.3.10 using turbolinks 2.5.2 using tzinfo-data 1.2014.10 using uglifier 2.5.3 bundle updated! c:\ruby\dev\devise-test>devise -h 'devise' not recognized internal or external command, operable program or batch file. c:\ruby\dev\devise-test>rails -v dl deprecated, please use fiddle rails 4.1.8 not gems have associated executable. devise authentication solution works on top of rails/warden - should configuring within rails app (after adding gem gemfile).