Posts

Showing posts from January, 2012

c# - EF6 Updating 3 tables in one go -

i have database 3 tables table customer customerid (pk) name table order orderid (pk) customerid (fk) orderdate table orderdetailline orderdetaillineid orderid (fk) price productcode what in entity framework add 1 customer, add several different orders, each many orderdetailline relating first customer inserted. have hooked relationship in sql server , imported them ef model. no problems. can insert 1 customer , many orders , orderdetailline first time records inserted ok correct databse tables i looping around customer , orders in file adding adding customer , orders database but when want add order same customer( getting primary key violation on customer customerid). ef trying re-insert same customer after initial context.savechanges(); so, how stop ef trying add same customer when using same datacontext? i have been going around in circles hours , getting same error {"the insert statement conflicted foreign key constra...

c# - Display different values of one enumerator list into different sub menu of menu list -

i have enum follows [it prototype] public enum class alphabets { none=0, a, e, i, o, u, b, c, d, f, g, noun, adj, verb, nosign }; i want display enum contents menu item such that, main menu "english" contains sublist vowels, letters, grammer , these sublist contains element follows, english - vowels - a, e, i, o, u - letters - b, c, d, f, g, - grammer - noun, adj, verb possible have 1 enum , sort across different sub menu of menu list or different menu list? you can notate each enum display groupname when enumerate through them, groupname , sort accordingly i use these extension methods values //gets attributes enum public static t getattribute<t>(this enum value) t : attribute { if (value == null) { throw new argumentnullexception(); } var type = value.gettype(); var memberinfo = type.getmember(value.tostring()); ...

node.js - facebook login error - using MEAN -

i new mean. i've been trying create 'facebook' login new mean application. making use of strategy from: "passport-facebook". the code user.js file, i've created new schema facebook users follows: var mongoose = require('mongoose'); var fbuserschema = mongoose.schema({ id: string, token: string, email: string, name: string }); var fbuser = mongoose.model('fbuser', fbuserschema); my passport.js file has this: var fbuser = mongoose.model('fbuser'), facebookstrategy = require('passport-facebook').strategy; module.exports = function(){ passport.serializeuser(function (user, done) { if (user) { done(null, user.id); } }); passport.deserializeuser(function (id, done) { user.findone({_id: id }).exec(function (err, user) { if (user) { return done(null, user); } else { return done(null, false); ...

c - How can I delay in a Linux interrupt handler (I know sleeping usually not possible) -

i'm working on embedded linux arm system needs react power failure signal turning off power supplies (via gpio control) in specific sequence. process needs start possible, i've installed interrupt handler detect power failure. the problem need introduce little bit of delay between turning each supply off. understand delays not allowed in interrupt handler, it's totally okay if handler never returns (power failing!). i'm trying introduce delay using method described in this post , can't life of me cause measurable delay (observed on oscilloscope). what doing wrong, , how can right? what follows relevant code. /* function sets en_gpio low, waits until pg_gpio goes low. */ static inline void powerdown(int en_gpio, int pg_gpio) { /* bring enable line low. */ gpio_set_value(en_gpio, 0); /* loop until power goes low. */ while (gpio_get_value(pg_gpio) != 0); } /* attempt @ delay function. */ #define delay_count 1000000000 static void delay(vo...

How to match two columns in Excel -

Image
i trying match 2 columns, column (2, 3, 4, 5, 5, 6, 7) , column b (2, 3, 4, 5, 6, 7) using if(iserror(match(a1,$b$1:$b$8,0)),"",a1) . the formula matches values correctly fives. match both 5's in column single 5 in column b. whereas expected pick 1 5 in column , matching in column b leaving other 5 pending. have alternative formula 1 above? thanks assuming copying formula down in column, use countif see if number has occurred in column:- =if(or(iserror(match(a2,$b$2:$b$7,0)),countif(c$1:c1,a2)),"",a2) (i adding headers , starting in row 2).

c# - Getting error Type 'System.String' is not supported for deserialization of an array -

i'm having issues deserializing nested array of json objects in c# using javascriptdeserializer here code using (stream s = request.getresponse().getresponsestream()) { using (streamreader sr = new streamreader(s)) { string jsondata = sr.readtoend(); var workout = ser.deserialize<clserviceoutput1>(jsondata); } } here jsondata {"data":"50951","filedata":[37,80,68,70,45,49,46,51,13,37,226,227,207,211,13,10],"mailitem":null,"status":"success","turnaroundtime":null} here class public class clserviceoutput1 { public string data { get; set; } public string filedata { get; set; } public string mailitem { get; set; } public string status { get; set; } public string turnaroundtime { get; set; } } fileda...

mysql - Convert JSON to Excel file with php pdo -

i have file give me json output mysql database: <?php require 'core/init.php'; $general->logged_out_protect(); $username = htmlentities($user['username']); $user_id = htmlentities($user['id']); try { $result = $db->prepare('select id,br,sufiks,kupac,datum,rok,status racuni user_id=:user_id'); $result->bindparam(':user_id', $user_id); $result->execute(); //$res = $result->fetchall(pdo::fetch_assoc); /* extract information $result */ foreach($result $r) { $temp = array(); // following line used slice pie chart $temp['id'] = (int) $r['id']; $temp['br'] = $r['br'].$r['sufiks']; $temp['kupac'] = (string) $r['kupac']; $temp['datum'] = (string) $r['datum']; $temp['rok'] = (string)$r['rok']; $temp['statu...

html - Youtube video and text side by side in Markdown -

Image
i have text on right... ##features * feature 1 * feature 2 * feature 3 and youtube video on left. how properly? i tried things like this , unsucessfully: | | | |-|-| |<iframe width="560" height="315" src="https://www.youtube.com/embed/vnp85kimxk0" frameborder="0" allowfullscreen></iframe>| ##features * feature 1 * feature 2 * feature 3 | edit i tried this: <table> <tr> <td width="50%"> <iframe width="300" height="315" src="https://www.youtube.com/embed/vnp85kimxk0" frameborder="0" allowfullscreen></iframe> </td> <td width="50%"> ##features * feature 1 * feature 2 * feature 3 </td> </tr> </table> but impossible use markdown in table anymore : markdown not parsed , rendered parsedown normal text... markdown deliberately simple : markdown not replacement html, or close it. synt...

java - Tapestry5 : URL Re-writing : Pass parameters to transformPageRenderLink method -

i upgrading tapestry 5.2.4 5.3.8 , stuck @ re-implementing url re-writing part. in application user account can have multiple data stores. user can have same page of different stores active @ same time. hence need put storeid in page links , event links urls. done follows. i register mylinktransformerclass in appmodule follows. @contribute(pagerenderlinktransformer.class) @primary public static void provideurlrewriting( orderedconfiguration<pagerenderlinktransformer> configuration){ configuration.addinstance( "faces", mylinktransformer.class); } following mylinktransformer class implements pagerenderlinktransformer public pagerenderrequestparameters decodepagerenderrequest( request request) { // incoming requests - remove store id url , // save request attribute string path = request.getpath(); if (path.equals("/")) { // redirect accounts page ...

how to validate, to enter negative and positive decimal values upto 2 decimal places using jquery keypress -

i have grid in have allow user enter either positive or negative value upto 2 decimal places. //on keypress event amountvalidation: function (e) { $('.js-amt').keypress(function (e) { var character = string.fromcharcode(e.keycode) var newvalue = this.value + character; if (isnan(newvalue) || hasdecimalplace(newvalue, 3)) { e.preventdefault(); return false; } }); function hasdecimalplace(value, x) { pointindex = value.indexof('.'); return pointindex >= 0 && pointindex < value.length - x; } }, you can use: $('.js-amt...

Fit an integral function with parametric limit to data with Python (Debye Model) -

Image
i trying fit resistivity vs temperature data bloch-gruneisen formula resistivity in metals: function as can see there integral function parametric limit. don't know how implement algorithm run least squares fit. came with: import matplotlib.pyplot plt import numpy np import pylab pl import scipy sp scipy.optimize import leastsq #retrieve data file data = pl.loadtxt('salita.txt') temp = data[:, 0] res = data[:, 2] def debye_func(p, t, r): rho0, ad, td = p coeff = ad*np.power(t, 5)/np.power(td, 4) f = np.power(x^5)/np.power(np.sinh(x), 2) #function integrate err_debye = r - rho0 - coeff * #integral??? return err_debye p0 = sp.array([0.0001 , 0.00001, 50]) plsq = leastsq(debye_func, p0, args=(temp, res)) print plsq ideas on how write it? edit: code has become: import matplotlib.pyplot plt import numpy np import pylab pl import scipy sp scipy.optimize import leastsq scipy.integrate import quad #retrieve data file data = pl.loadtxt('...

windows - share variable value between C programs -

this question has answer here: sharing memory between 2 processes (c, windows) 7 answers inter process communication 1 answer i trying share variable value between 2 c programs run independently each other therefore each of uses separate memory, used share.h header file extern statement not work, used txt file write variable 1 c program , read 2nd c program there there sync problems , permission problem read file, ideas how solve issues or how share variable value? i dont think possible adding headers 2 programs have there own memeory space. cant communicate both adding headers. you need use ipc mechanism on side note: extern used share variables between 2 c files part of same program, cannot use between 2 different programs.

imagej - Calculating surface and storing as Excel file -

i'm new imagej , trying analyze several images: have code can analyze color threshold set of images in directory , store them separately: input = "/m_3/imagej/test_folder/"; output = "/m_3/imagej/finished2/"; function action(input, output, filename) { open(input + filename); run("set scale...", "distance=872 known=9 pixel=1 unit=cm"); run("color threshold..."); // color thresholder 1.48v // autogenerated macro, single images only! . . . // colour thresholding------------- saveas("jpeg", output + filename); close(); } setbatchmode(true); list = getfilelist(input); (i = 0; < list.length; i++) action(input, output, list[i]); setbatchmode(false); now want calculate area of newly saved images , should work function measure.. run("measure"); how can store calculations in .xls or .csv -files? possible calculate area of files in 1 directory , store results in 1 .xls or .csv -fil...

python - Keep stdin line at top or bottom of terminal screen -

so writing project run program receives/sends messages other computers running same program. the receiver/sender of data running on thread , prints stdout. stuff this: [info] user 'blah' wants send message you. [info] other info [msg rec] message 'hello' received blah. now issue wish input commands terminal, problem when try enter command , new info message or msg rec printed stdout. have commands such quit , status etc. >> indicates input line. something may happen: [info] user 'blah' wants send message you. [info] other info [msg rec] message 'hello' received blah. >> stat[msg rec] message 'sup' received bob. then press enter , command status gets executed looks poor in terminal. message appears every 2-4 seconds issue. there way solve this? tried using ansi cursor commands try , insert new line before last line last line remain input line , type in "stat", wait while , finish "us" without i...

c - Creating a shared string array which children processes can access -

this question has answer here: creating multiple children of process , maintaining shared array of pids 1 answer i declaring array of string using char users[10][256]; then forking , creating 10 child processes. need each child process access , modify string array. how do ? you'd want use shared memory. under linux, can check this out. uses shmget , shmat , shmdt create shared memory segments, shared memory segments , detach shared memory segments respectfully. under windows, can check this out. uses openfilemapping , mapviewoffile create "file mappings" , map them process's virtual memory respectfully. both, finally, achieve same result.

node.js - How to improve the performance of the query -

r.db('db').table('tb').group('message').map(function(doc){ return { count: 1, from: doc('timestamp'), to: doc('timestamp'), browsers: r([doc('ua')('family')]) } }).reduce(function(left, right){ return { count: left('count').add(right('count')), from: r.branch(left('from').lt(right('from')), left('from'), right('from')), to: r.branch(left('to').gt(right('to')), left('to'), right('to')), browsers: left('browsers').setunion(right('browsers')) } }).ungroup().orderby(r.desc(r.row('reduction')('count'))).limit(100) what want to: group documents message find earliest , latest timestamp each group find distinct tags in group i result like: { 'message': 'message content shared group', 'earliest': 1431307840000, 'latest': 1431307849...

java - Can't get json from Swagger + Jersey -

i have restful service based on jersey 1.18.1 , want show api via swagger . firstly have json. read instruction: swagger core jersey 1.x project setup 1.5 . swagger allows set configuration different methods , decided use custom application subclass. did step step can't json have use swagger-ui . what did: custom application @applicationpath("api/v1") public class discountsapp extends application{ public discountsapp() { beanconfig beanconfig = new beanconfig(); beanconfig.setversion("1.0.2"); beanconfig.setschemes(new string[]{"http"}); beanconfig.sethost("localhost:8002"); beanconfig.setbasepath("swaggerapi"); beanconfig.setresourcepackage("alexiuscrow.diploma.endpoints"); beanconfig.setscan(true); } @override public set<class<?>> getclasses() { set<class<?>> resources = new hashset(); resources.add(shopsresources.class); //... resource...

c# - How can I save an .xlsx file as Unicode text using interop? -

i have build report making desktop application . need user friendly, reports in hebrew has unicode , not regular .csv file or question marks.. want receive file path of report (like c:\folder\file.xlsx ) , able save copy of original file in location unicode text file.. help? same problem this guy . "i need use saveas() microsoft.office.interop.excel can't figure how " add this: using excel = microsoft.office.interop.excel; then use code: excel.application app = new excel.application(); try { app.displayalerts = false; app.visible = false; excel.workbook book = app.workbooks.open("d:\\test.xlsx"); book.saveas(filename: "d:\\test.txt", fileformat: excel.xlfileformat.xlunicodetext, accessmode: excel.xlsaveasaccessmode.xlnochange, conflictresolution: excel.xlsaveconflictresolution.xllocalsessionchanges); } { app.quit(); } "d:\\test.xlsx" input excel filename , "d:\\test.txt...

excel - PL/SQL CONCAT Function -

goal: have excel document links customer bills. desired pl/sql output: account_id | bill_id | '=hyperlink(".\"&'||bill_id||'&"-00.pdf")' -----------+---------+---------- 12345 | 10 | =hyperlink(".\"&10&"-00.pdf") 23456 | 11 | =hyperlink(".\"&11&"-00.pdf") 34567 | 12 | =hyperlink(".\"&12&"-00.pdf") pl/sql queries ( documentation here ) not picking second concat , pl/sql developer generates popup title "variables" asking value. select account_id, bill_id, '=hyperlink(".\"&' || bill_id || '&"-00.pdf")' customer_table tested select account_id, bill_id, concat( concat('=hyperlink(".\"&',bill_id),'&"-00.pdf")') customer_table current output: account_id | bill_id | '=hyperlink(".\"&'||bill_id||'...

Form created using wordpress plugin does not have bootstrap -

i creating website in wordpress 4.2.2. i created plugin customize registration page. activated plugin , called form function within wp-login.php this case 'register' : require( dirname(__file__) . '/wp-load.php' ); custom_registration_function(); login_footer('user_login'); break; i can see new registration form problem is, wordpress styles totally gone. have plain html page no styles. wordpress not loading bootstrap page. i not know why bootstrap not being loaded. you can add css in plugin folder or should register styles , script , theme functions.php file. function myplugin_scripts() { wp_register_style( 'style-name', plugin_dir_url( __file__ ) . 'css/style.css' ); wp_enqueue_style( 'style-name' ); } add_action( 'wp_enqueue_scripts', 'myplugin_scripts' );

html - how to disable previously selected select options displayed using bootstrap selectpicker and ng-options -

i have multi select dropdown. need when user lands on page, need restrict him modify previous selections, disable options inside dropdown. here html - <div> <select multiple class="form-control selectpicker" ng-model="selectednames" data-live-search="true" ng-options="opt.name opt in availablenames track opt.id" ng-change="onnamechange()"> </select> </div> tried suggestions link - http://silviomoreto.github.io/bootstrap-select/ but if add option tag manually when using ng-options, doesn't displayed. tried using ng-repeat rather ng-options ng-repeat dropdown stopped showing tick-marks against selected values & default displayed - "no values selected", though model still had them. any pointers how achieve without resorting jquery ? thanks anup use disable when syntax in ngoptions. refer ngoptions docs more details. add key in ngoptions indicate if field selected user ...

javascript - "Cannot read property 'fitBounds' of undefined" when plotting markers on Google Maps with AngularJS -

i'm trying have map zoom or expand fit markers when updates plotted off screen , can't see them. code follows... $scope.loadmap = function () { var chosendestination = new google.maps.latlng($scope.destination.latitude, $scope.destination.longitude); var mapoptions = { zoom: 12, center: chosendestination, scrollwheel: false, maptypeid: google.maps.maptypeid.terrain } $scope.map = new google.maps.map(document.getelementbyid('map'), mapoptions); var marker = new markerwithlabel({ position: chosendestination, map: $scope.map, animation: google.maps.animation.drop, title: $scope.destination.name, labelcontent: " ", labelanchor: new google.maps.point(7, 35), labelclass: "searchlocation" + $scope.destination.name }); } $scope.updatemapmarkers = function (hotel) {...

android - Should we add fragment to framelayout before calling replace method? -

i'm sorry, atm can't test code. have question. how should work fragment manager? got error when trying add fragmenta, fragmentb, , again a. got error : fragment added. , here question: should call transaction.add @ launch , replace others fragments or shouldn't. attention , sorry english, not native language you can add if want on first launch can use .replace if there isn't fragment loading frame , still work.

android - mqtt client active on the smart device to be usable -

can confirm in order use mqtt protocol, app on smart device (ios or android) embedding mqtt client code, must active? if so, how can wake-up app remote server enable mqtt conversation? maybe push notification should alert smartphone user open app because important messages outstanding him? for android app can start service run in background , receive published messages time. for ios need wake application connect broker, usual approach use apple push notification service wake app up.

mysql - Get Sum using php and SQL is date is same -

i have db structure follows: date morning evening qty(ltr) total 13-may-2015 101 10 111 15-may-2015 10 1.25 11.25 15-may-2015 10 2.25 12.25 15-may-2015 101 10 111 16-may-2015 10 1.25 11.25 16-may-2015 10 2.25 12.25 17-may-2015 10 2.25 12.25 what want create new table in data same date should in 1 row only, means duplicate dates should added. how can ? i want result date morning evening qty(ltr) total 13-may-2015 101 10 111 15-may-2015 121 13.5 134.5 16-may-2015 20 3.5 23.5 17-may-2015 10 2.25 12.25 you looking group by clause: select `date`, sum(morning), sum(evening), sum(total) mytable group `date`

iphone - iOS application provisioning profile error , profile not associated -

Image
i need figure out reason error while installing application on ios devices. here error says while installation : i don't have expertise on ios development. please explain issue , resolution if can. in advance. please follow below steps: 1.go project setting.in left panel see there targets. 2.clicked on (your project name)tests. 3.go info. there assign proper bundle identifier. 4.go build setting->code signing 5.here set code signing identity , provision profile (make sure select correct provision profile) 6.clean build.

how to parse json array using Google gson -

i've following json array , wanted parse 3 email address 3 separate variables. i wanted done using google gson library . how can ? string jsonarrays= [ { "id": "0e9b73bc-cf32-48b4-88cc-ee4ff8c3a823", "firstname": "chris", "lastname": "rogers", "height": "180cm", "weight": "74kg", "location": "uk", "email": "chris.rogers@test.com" }, { "id": "0e9b73bc-7cd7-48b4-88cc-ee4ff8c76vcv", "firstname": "lavina", "lastname": "langer", "height": "170cm", "weight": "63kg", "location": "poland", "email": "lavina.rogers@test.com" }, { ...

python - Get JSON file from GET request from Infoblox -

currently i've got piece of code, looks response_code 200 (so know works) url not return data. i've read sending data_file_format request server knows has return json or xml , ... anybody got advice? #!/usr/bin/python import requests import json rest_url = 'url_to_infoblox_api/network?network=192.168.1.0/24' r = requests.get(url=rest_url, auth=('infoblox_username', 'infoblox_password'), verify=false) r_json = r.json() print r.status_code //return code 200, works! print json.dumps({ "data" : r_json //but no data ... }) as skyline75489 suggests - try printing r_json.text see raw json. use key want find values interested in. example if have extensible attribute called windowpane following return value of attribute. r_json['extattrs']['windowpane']['value']

ios - Xcode project environment variables -

Image
how distinguish multiple environments in ios app? my swift app uses external api connection , have 2 api urls - testing , productive. is there way how use 1 variable , set value testing in xcode , value appstore release? currently using xcode 6.3.1 application deployment target ios 8.1 in swift need use "swift compiler - custom flags" instead of pre processor macro... set flag shown in figure below use below code checking.. var url; #if debugurl url = ** debug url ** #else url = ** release url ** #endif note : add debug symbol -d debug entry.

CSS3 border-image and Retina screens -

my question pretty simple, there way (or hack) make 'border-image' property support retina (high definition) displays? @ least in webkit-based browsers. if try use high resolution image in border-image, appears larger, , found no way of scaling down. if set smaller border width and/or slice size, (naturally) crop image, not scale down. know simulate border backgrounds, in question more interested know if there's way use 'border-image'. thank in advance! this example: <style> .border-button { border: 20px solid transparent; border-image: url(button-border.png) 20 20 repeat; } @media screen , (-webkit-min-device-pixel-ratio: 2) { .border-button { border: 10px solid transparent; border-image: url(button-border@2x.png) 10 10 repeat; } } </style> this silly of me, haven't tried setting 'border-width' half size of border image slice. scales image down fine, , correct answer. apologise posting question obvious, perha...

Trying to parse CSV file in Grails -

i'm trying parse csv file has 3 fields. my method looks this: // action called when user submits upload form def handle() { commonsmultipartfile file = request.getfile('filecsv') if(file.empty) { flash.error = g.message(code:'',default:'empty cannot uploaded') } else { inputstream fs = file.inputstream fs.spliteachline(',') { row -> new connection( randomizedid: row[0], token1: row[1], token2: row[2] ).save(flush: true) key++ println("connection added") } } } looking @ output, line "connection added" printed multiple times. when go looking @ connection list, there none...

Several flavors for an Android application (Eclipse ADT) -

there android application developed under , built eclipse/adt. have make exist in 2 flavours: market version (with google libraries purchase support) , version customer n (without google play stuff custom features). i cannot refactor library because break version control history. important not break version control , make sure bugs fixed in common part fixed in both flavors. important keep directory structure ( src/ res/ libs/ ). cannot introduce flag because requirement leave no trace of custom features in market binary. if wanted remove custom features manually, (1) remove source files (both java , resources) and (2) comment out lines in other source files (again, both java , xml resources). how make application exist in 2 versions (flavours) different feature sets? another version of same script. better suited large number of configurations. supports ancestor configurations. cannot set configurations linux , master separately: must define linux-master . happen...

Netlogo multiple patch layer -

can create multiple patch layers in netlogo, instead of using several patch variables in 1 layer? i'm trying integrate different maps (geology, traffic, etc.) netlogo environment. far, i've defined multiple patch variables using patches-own command. maps have not stackable. if can have separate patch layers different maps, clearer. you can't make more patch layers. structure of netlogo patch world fixed. but might consider representing information using turtles instead. can sprout them, 1 per patch, or define several breeds of turtle, , have each patch sprout 1 of each breed. order in breeds defined determine layers' stacking order, , can hide or show whole layers using hide-turtle , show-turtle . if want turtles patches, set shape "square" (adjusting size of "square" shapes in turtle shapes editor if necessary).

tomcat8 - Tomcat: javax.net.ssl.SSLHandshakeException: no cipher suites in common -

i'm trying setup remote tomcat server deployment in intellij. for reason "handshake" fails. 11:44:28 error running vps-tomcat unable connect 185.80.128.231:1099, reason: java.rmi.connectioexception: error during jrmp connection establishment; nested exception is: javax.net.ssl.sslhandshakeexception: received fatal alert: handshake_failure i added debug options tomcat startup: ignoring unsupported cipher suite: tls_ecdhe_ecdsa_with_aes_128_cbc_sha256 tlsv1 ignoring unsupported cipher suite: tls_ecdhe_rsa_with_aes_128_cbc_sha256 tlsv1 ignoring unsupported cipher suite: tls_rsa_with_aes_128_cbc_sha256 tlsv1 ignoring unsupported cipher suite: tls_ecdh_ecdsa_with_aes_128_cbc_sha256 tlsv1 ignoring unsupported cipher suite: tls_ecdh_rsa_with_aes_128_cbc_sha256 tlsv1 ignoring unsupported cipher suite: tls_dhe_rsa_with_aes_128_cbc_sha256 tlsv1 ignoring unsupported cipher suite: tls_dhe_dss_with_aes_128_cbc_sha256 tls...

php - user access control getting user level -

i have login form <form method="post" action="formdata.php"> in formdata.php have variables as $n=$_post['name']; $p=$_post['password']; then after succesful login direct page "main.php" . from main.php want check user level , based on user level restrict pages user can access. to user level included $query=mysql_query("select level member username='$n'"); $level=mysql_fetch_array($query); if ($level==3){ echo "level 3 user"; } but don't think user level database variable $level correctly doesn't executes if ($level==3) . can't use $n in where username='$n' because $n declared in formdata.php ? how can level field value database? your usage wrong. must if($level[0] == 3) or if($level['level'] == 3)

python - QTreeView change column name -

i'm working qtreeview , qfilesystemmodel. how can change column name? this sample of code: startdir = "/home/abusquets/cads" filter = ["*.dxf"] model = qtgui.qfilesystemmodel() model.setfilter(qdir.alldirs | qdir.nodotanddotdot | qdir.allentries) model.setrootpath(startdir) #només volem fitxers dxf model.setnamefilters(filter) model.setnamefilterdisables(0) tree = qtgui.qtreeview() tree.setmodel(model) tree.setselectionmode(qtgui.qabstractitemview.multiselection) tree.setrootindex(model.index(startdir)) self.setcentralwidget(tree) in qstandarditemmodel, can it: model->setheaderdata(0,qt::horizontal, "---header0---"); but, in qfilesystemmodel, headerdata ( int section, qt::orientation orientation, int role = qt::displayrole ) const was reimplemented. methord 1 you need new class inherited qfilesystemmodel, , reimplemente headerdata() again. methord 2 use delegate model methord 3 set header model independ...

How to change column attributes on Oracle APEX? -

Image
in picture, shows problem: need display values of column table in apex. values being displayed text field. but, need display few text fields , others display value without allowing edit it. i've been looking it, i'm stuck.. there conditional display area, not sure if need go solution. section seems limit values displayed not change display format based on values, latter need. if know or can point me in right direction!

angularjs - Angular directive for D3 datamap rendering only once -

Image
so, made angular directive renders d3 datamap in html template. pass data directive via 'data' attribute. problem facing map displays when page loaded first time. however, when come template navigating other templates (routing done through 'ui-route'), map doesn't rendered , there no error in console either. here's directive : app.directive('stabilitymap', function() { var containerid = document.getelementbyid('world-map-container'); var margin = 20, padding = 50, width = containerid.offsetwidth - margin; height = containerid.offsetheight - margin; return { restrict: 'a', scope: { data: '=', }, link : function(scope, element, attrs) { scope.$watch('data', function(newval, oldval) { var colorscale = d3.scale.linear().domain([50, 100]).range(['#ff0000', '#280000']); var fills = ...

rest - Geoserver CQL query using Java -

i have 2 layers of shape file(shape file contains geographical information of particular area) in geoserver, able filter specific place california using cql query: (intersects(col1,querysingle('layername','col1','filterparam=value'))) on geoserver ui. want same using java/rest api. help/suggestion highly appreciated.

javascript - Populate input text box based on drop down select box in Jquery -

i have drop down select box , input text box. select box display categories , this: <select id="category" name="category"> <option value="">please select...</option> <option value="1">category-1</option> <option value="2">category-2</option> <option value="3">category-3</option> <option value="4">other</option> </select> input text box this: <input type="text" id="othercategory" name="othercategory" value="" style="display: none;"> my question is. when user select "other" dropdown need populate input text. i tried this: $(document).ready(function() { $('#category').change(function() { var myvalue = $(this).val(); var mytext = $("#category :selected").text(); if (mytext != '' , mytext == "...