Posts

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

i have following statement/query: select table1.file_id, table1.status, table2.status table1 inner join table2 on table1.file_id = table2.file_id; the result follows: file id | status table 1 | status table 2 ----------------------------------------------------- 5500002 | ax | ics 5500002 | ax | icso 5500002 | axo | ics 5500003 | ax | ics 5500003 | ax | ics 5500003 | ax | ics 5500004 | null | icso test 5500004 | axo | ics 5500004 | ax | null i need each file id check 4 statuses: - ax - axo - ics - icso i want run select on file id s cover 4 statuses. can see file id occurs multiple times , i'd want query return file id fulfills requirement, in instance return 5500002 , 5500004. for 550000...

python - Robot Framework location and name of keyword -

i want create python library 0 argument function custom robot framework keywords can call. needs know absolute path of file keyword defined, , name of keyword. know how similar test cases using robot.libraries.builtin library , ${suite_source} , ${test name} variables, can't find similar custom keywords. don't care how complicated answer is, maybe have dig guts of robot framework's internal classes , access data somehow. there way this? thanks janne able find solution. from robot.running.context import execution_contexts def resource_locator(): name = execution_contexts.current.keywords[-1].name libname = execution_contexts.current.get_handler(name).libname resources = execution_contexts.current.namespace._kw_store.resources path = "" key in resources._keys: if resources[key].name == libname: path = key break return {'name': name, 'path': path} execution_context...

methods - python can't use function in submodule -

my folder structure this: pythonstuff/ program.py modulea/ __init__.py foo.py bar.py here's code bar.py : def hello(): print("hello, world!") here's code program.py : #!/usr/bin/env python3 modulea import bar bar.hello() i run $ python3 program.py somehow error: file "program.py", line 3, in <module> bar.hello() attributeerror: 'module' object has no attribute 'hello' edit: __init__.py file empty. edit2: after trying realized had bar.py in root directory contained hello() method. bar.py in modulea/ directory empty. add it import os __all__ = [] module in os.listdir(os.path.dirname(__file__)): if module != '__init__.py' , module[-3:] == '.py': __all__.append(module[:-3]) the init .py files required make python treat directories containing packages; done prevent directories common name, such string, unintentionally hiding v...

Desktop Launcher for Python Script Starts Program in Wrong Path (Linux) -

i can not launch python script .desktop launcher created on linux mint 17.1 cinnamon. the problem script launched in wrong path - namely home folder instead of directory placed in. thereby can not find other vital files accompanying in folder , hence not work. to examine misbehaviour created short script check folder python script executing in: #!/usr/bin/env python import subprocess import time subprocess.call(["pwd"], shell=true) time.sleep(7) # chance read output executing own folder gives output: /home/myusername/pythonprojects i setting desktop launcher via nemo's menu. executing same script yields: /home/myusername i not understand behaviour. how create working desktop launcher python script? the page https://linuxcritic.wordpress.com/2010/04/07/anatomy-of-a-desktop-file/ describes format of .desktop files. you may note "path" element, specifies working directory file run in. in case want desktop file specified path=/...

netbeans - How to keep java.awt.List from covering javax.swing.JMenu -

to put simply, have menus in menu bar that, when @ start of application, goes on list when expand it. however, if list ever updated, menus go behind list, covering menu items. i have theorized need when list updated, make tell list go layer (which set bottom, lowest on list in application using netbeans). but, not know call tell program keep list there. (i still new java , learning go) have idea on how wish or better, causing problem? thank time , have wonderful day :3 you should use jlist instead of list. the problem components in java.awt have peer components, native os components, whereas swing 100% java. cannot write on these native peers... @ least not in java.

Extracting specific parts of a HTML-File with PHP Simple HTML DOM Parser -

i've got html-file several tables try extract link , image part. i'm using php simple html dom parser. here's html-file parse: <h1>title</h1> <p>text</p> <table cellspacing="0" cellpadding="0" border="0"> <tbody> <tr><td> <a href="http://www.google.com/some_url"> <img width="100" height="100" border="0" src="http://google.com/some_image.jpg"/> </a> </td></tr> </tbody> </table> <h2>title</h2> <p>text</p> <table cellspacing="0" cellpadding="0" border="0"> <tbody> <tr><td> <a href="http://www.google.com/this_url"> <img width="100" height="100" border="0" src="http://g...

angularjs - Redirect to a new template in angular js -

i new angularjs, please consider mistakes. the scenario is, have index.html page , login.html page, index , login have different layout different header footer , all. other pages expect login share same layout index.html now, how can navigate login.html using anuglar ui router. myapp.config(function ($stateprovider, $urlrouterprovider) { $stateprovider.state('home', { url: '/', templateurl: 'app/views/site/home.html', controller: 'homectrl' }).state('login', { url: '/login', templateurl: 'app/views/site/login.html' }) }); this not work loads content of login index keeping header , footer same of index. know state supposed work way. now, there way can call new view using ui.router. i appreciate help. thanks you set multiple named views ( https://github.com/angular-ui/ui-router/wiki/multiple-named-views ). this allow make header , footer separate views can ...

excel - Multiple IF, AND, OR statements -

i trying create excel formula represent logic: if (b8 < 0 & a8 > 0), b8+a8 or if (b8 < 0 & a8 < 0), b8-a8 or if (b8 > 0 & a8 > 0), b8-a8 i can't seem syntax right. alternatively, following put more closely/literally: =if(and(b8<0,a8>0),b8+a8, if(and(b8<0,a8<0), b8-a8, if(and(b8>0,a8>0), b8-a8, "null?" ))) should trick. wasn't sure put if none of cases fail, showing "null?" .. change desired. (but suspect pascx64's more efficient in long run ;) )

c++ - How to pass a 2d array through pointer in c -

possible duplicate: passing pointer representing 2d array function in c++ i trying pass 2-dimensional array function through pointer , want modify values. #include <stdio.h> void func(int **ptr); int main() { int array[2][2] = { {2, 5}, {3, 6} }; func(array); printf("%d", array[0][0]); getch(); } void func(int **ptr) { int i, j; (i = 0; < 2; i++) { (j = 0; j < 2; j++) { ptr[i][j] = 8; } } } but program crashes this. did wrong? it crashes because array isn't pointer pointer, try reading array values if they're pointers, array contains data without pointer. array adjacent in memory, accept single pointer , cast when calling function: func((int*)array); ... void func(int *ptr) { int i, j; (i = 0; < 2; i++) { (j = 0; j < 2; j++) { ptr[i+j*2]=8; } } }

c# - DataValidation using Regex not working -

so have maskedtextinput box follows: <telerik:radmaskedtextinput margin="2" borderbrush="lightgray" isclearbuttonvisible="false" mask="(###) ###-####" updatevalueevent="propertychanged" textmode="plaintext" value="{binding path=phonenumber, mode=twoway, notifyonvalidationerror=true, validatesonexceptions=true, updatesourcetrigger=propertychanged}" /> and bound through viewmodel following code-behind: //phone number [required(allowemptystrings = false, errormessage = @"a phone number required.")] [regularexpression(@"^\d{10}$", errormessage = @"invalid phone number...

python - More Pythonic way to turn any number of different lists or tuples into one list -

this question has answer here: making flat list out of list of lists in python 23 answers i trying write function take in number of different lists or tuples arguments , return 1 big list. def addify(*args): big_list = list() iterable in args: if isinstance(iterable, tuple): big_list.extend(list(iterable)) else: big_list.extend(iterable) return big_list >>> print addify((1,2,3), [2, 5, 3], (3,1,3), [3, 2344, 3]) [1, 2, 3, 2, 5, 3, 3, 1, 3, 3, 2344, 3] i learning args , kwargs , , code working right, seems code simple. there must better way writing long function check if argument tuple , if add convert list , add on. seems bloated. itertools.chain looking for: >>> itertools import chain >>> print list(chain((1,2,3), [2, 5, 3], (3,1,3), [3, 2344, 3])) [1, 2, 3, 2, 5, 3, 3,...

php - Escaping apostrophies and other characters in text area -

so have found form have falls apart , doesn't submit content until first apostrophe when types in apostrophe text area. how go escaping contents make mysql table? thanks! <form action=\"./functions/notes.php\" method='post'> <input type='hidden' id='id' name='id' value='{$row['id']}' /> <textarea placeholder=\"add more notes here...\" name=\"notes\"></textarea><br /> <input type='submit' name='formnotes' id='formnotes' value='add notes' /> </form> then in notes.php file $notesid = $_post['id']; $note = $_post['notes']; $date= date('y-m-d'); $result = mysql_query("update project_submissions set notes=concat(notes,'<br />".$date." ".$note."') id ='".$notesid."'"); apostrophes have special meaning sql, them data need "escaped...

javascript - Rendering HTML to Canvas on Retina displays -

this mdn article (citing this blog post ) teaches how render html content canvas. i've implemented in project , works. but on "retina" displays, draws canvas @ half of full resolution display supports. example, if have canvas on render html string "hello" , next canvas put <span>hello</span> , latter (rendered browser usual way) smoother , crisper former (rendered html onto canvas, using technique in links above, uses svg , image ). i believe there's way detect retina displays, know when higher resolution needed, given in this source code . when detect i'm on retina display, question is: is there method renders html canvas @ full retina resolution? look @ post var image = new image(); var ratio = window.devicepixelratio || 1; var canvas = document.queryselector("canvas"); var context = canvas.getcontext("2d"); // 1. ensure element size stays same. canvas.style.width = canvas.width + "px...

python - Non-greedy mode in re.search() does not match to end of string -

i'm trying parse values of cookie this: import re m = re.search("(.*?)=(.*?); path=(.*?); domain=(.*?)", "name=value1; path=/; domain=my.domain.com") print (m.group(0)) result this: name=value1; path=/; domain= my question is: why not match @ last non-greedy position? expected result be: name=value1; path=/; domain=my.domain.com of course, change greedy mode or use end of line character ( $ ) i'd understand why it's not working expected work :) non-greedy means match little can while still allowing entire match succeed. * means "zero or more". least can match zero. matches 0 , match succeeds. the other occurrences of .*? in regex cannot match zero, because entire regex fail match.

Select & retrieve multiple rows from a sorted datatable in R Shiny -

using https://demo.shinyapps.io/029-row-selection/ reference, building app select number of rows in sorted/unsorted data & retrieve corresponding indices. if use code as is , not work on sorted data. changed code follows: server.r library(shiny) shinyserver(function(input, output) { output$tbl <- renderdatatable( mtcars, options = list(pagelength = 10), callback = "function(table) { table.on('click.dt', 'tr', function() { $(this).toggleclass('selected'); shiny.oninputchange('rows', table.rows('.selected').data()[0][0]); # returns actual row number not allow multiple selection }); }" ) output$rows_out <- rendertext({ paste(c('you selected these rows on page:', input$rows), collapse = ' ') }) }) ui.r library(shiny) shinyui(fluidpage( title = 'row selection in datatables', sidebarlayout(...

c++ - Map a range of values to a single value -

i need map values ranging between lowerbound , upperbound value. illustrative example: for example, imagine have gps system has users subscribed it. system able provide me distance of user point. based on distance of user want assign them id. thus users in distance 1 100 id: 8.4 101 200 id: 7.2 201 300 id: 3.6 401 600 id: 4.1 and on... my approach: so did, created std::map initializing follows: std::map<int, double> distancetoidmap; distancetoidmap = { {100, 8.4}, {200, 7.2}, {300, 3.6}, }; then use code id given distance: double rounduptohundred = std::ceil(realdistance / 100.0) * 100; double powerfordistance = distancetoidmap.at(rounduptohundred); however approach breaks down 401 600 distance, because ceiling nearest hundred distance of 400+ value 500 don't have entry in map. of course trivial solution add entry 500 distancetoidmap not how want handle problem. i have map ...

c - Infinity loop while reading data from file -

i'm trying read data file. there 3 rows. i've done below. problem (file exists) infinity loop while reading file. i've observed program not moving line line until reaches end of file. what's incorrect in code? code: if (desktops == null) { printf("\n no such file.\n"); } else{ printf("\nfile exists. reading\n"); while(!feof(desktops)){ if(numberofobjects== 0) { fscanf(desktops,"%fl %fl %fl %fl %d %s %s %d\n",&height,&length,&width,&processorclock,&idnumberserial,&processortypechars,&nameinnetworkchars,&id); nameinnetwork = string(nameinnetworkchars); processortype = string(processortypechars); // nameinnetwork = "test"; glowalistyobjektow = new desktop(height,length,width,processorclock,idnumberserial,processortype,nameinnetwork,id); i...

javascript - Why are the radio buttons resetting when clicking on this jquery datepicker -

here jquery datepicker: $.fn.dcalendarpicker = function(opts){ return $(this).each(function(){ var = $(this); var cal = $('<table class="calendar"></table>'), hovered = false, selecteddate = false; that.wrap($('<div class="datepicker" style="display:inline-block;position:relative;"></div>')); cal.css({ position:'absolute', left:0, display:'none', 'box-shadow':'0 4px 6px 1px rgba(0, 0, 0, 0.14)', width:'230px', }).appendto(that.parent()); if(opts){ opts.mode = 'datepicker'; cal.dcalendar(opts); } else cal.dcalendar({mode: 'datepicker'}); cal.hover(function(){ hovered = true; }, function(){ hovered = false; }).on('click', function(){ // scrip...

Is it possible to allow many users to make live broadcasts using YouTube API and a single account? -

i want make web application , want use youtube api allow users make live broadcasts. is necessary users log google/youtube accounts use live stream or possible make them use function without bothering them detail? in order create live event , live stream objects required livestream on youtube, user making requests must authenticated. from docs: your application must have authorization credentials able use youtube live streaming api. obtaining authorization credentials guide here . adding live event similar uploading video. user making upload must authenticated in order video appear on channel.

javascript - Phaser.js: How to use Text as sprites -

Image
in game numbers game elements: can moved, touched, exploded , have collision detected. how can turn text sprites and/or physical bodies using phaser.js? you cant because sprite , text different node can attach text empty sprite , when move sprite text move same collision need manually