Posts

Showing posts from June, 2011

javascript - How to recognize the function is the class constructor and how to call it as a function? -

i'm little bit confused class feature in es2016, though assumed syntax sugar creating classes, in comparison function , prototype , behaviour in cases different, in particular - classes can't called same functions , seems, there no way find out if function class constructor or simple function, without using tostring , /^class/ regexp . assume example: class foo { constructor () { this.name = 'foo'; } } function bar () { this.name = 'bar'; } function dosmth (anyarg) { if (typeof anyarg === 'function') { var obj = { someprop: 'qux' }; anyarg.call(obj); return obj; } // ... } dosmth(bar); dosmth(foo); // class constructor foo cannot invoked without 'new' is typeof 'function' , can't call function! nice. and here 2 questions: is there way can call foo constructor function same bar overriden this context? is there way can detect anyarg constructor of...

foreach - tcl data formats confusion -

the motivation behind question learning... i have done tcl programming , have working code, not understand why syntax working , not. problem description: i'm writing code needs set voltages power , ground nets. after enter vdd nets string, set power_nets "vdd=1.1 vdda=1.2 vref=1.1" then simple tcl code should construct , execute following commands: set_vdd vdd 1.1 set_vdd vdda 1.2 set_vdd vref 1.1 that all. seems trivial, have had difficulty implementing it. still not understand why code not work, although seems correct me. working solution: working solution came following: foreach item [split $power_nets] { set net [lindex [split $item =] 0] set voltage [lindex [split $item =] 1] set_vdd $net $voltage } that's lot of code such simple operation. when written in more condensed form still works: foreach item [split $power_nets] { set_vdd [lindex [split $item =] 0] [lindex [split $item =] 1] } but still have feeling there room...

java - Primefaces PickList Ajax notfiring on transfer event to bean -

hey stackoverflow community, maybe guys able me out since im out of ideas. im using primefaces 6.0 problem: picklist not firing event java code can't handle it. my view.xhtml <p:dialog header="division" widgetvar="dialog2" id="divdialog" minheight="400" minwidth="400" showeffect="pop" resizable="false"> <h:form> <p:picklist id="picklist" value="#{workerviewcontroller.wvm.explicitdivision}" var="divlist" itemlabel="#{divlist}" itemvalue="#{workerviewcontroller.wvm.division}" showsourcefilter="true" showtargetfilter="true"> <p:ajax event="transfer" listener="#{workerviewcontroller.ontransfer}" /> ...

hadoop - Hbase Java API Example -

i new hbase development. following link . using hbase-1.1.2 release. when use sample code getting warnings. there several methods got deprecated (example, new hbaseadmin(conf);) saw hbaseadmin class has 3 constructors. out of 3 constructors 2 got deprecated. 1 constructor accepts "clusterconnection" argument. don't know following proper link play hbase. can please provide sample example using latest hbase libraries.? running hbase standalone mode. this should help hconnection connection; htableinterface htableinterface = null; configuration hbaseconfig = hbaseconfiguration.create(); hbaseconfig.setint("timeout", 120000); //zookeeper quorum, basic info needed proceed hbaseconfig.set("hbase.zookeeper.quorum","host1, host2, host3"); hbaseconfig.set("hbase.zookeeper.property.clientport", "2181"); hbaseconfig.set("zookeeper.znode.parent", "/hbase-unsecure"); ...

c# - Initializing object data in the constructor by deserializing a json file -

ok want rid of first constructor, , able deserialize directly. there way pull each variable json 1 @ time? or there blanket statement use pull them @ once , populate object. public masteremailsettings() { _user = ""; _password = ""; _domain = ""; _emailaddress = ""; } public masteremailsettings(string path) { var tempobject = new masteremailsettings(); try { tempobject = jsonconvert.deserializeobject<masteremailsettings>(file.readalltext(path)); _domain = tempobject.domain; _password = tempobject.password; _user = tempobject.user; _emailaddress = tempobject.emailaddress; } catch (exception ex) { console.writeline(ex.tostring()); } } personally, wouldn't create constructor going responsible going out disk, reading in file, using 3rd party lib deserialize object, take bits of deserialize...

xcode - phonegap console log on ios Simulator -

i new phonegap , have followed many suggestions use safari debug inside ios simulator. surely, can see html elements in safaris developer console cannot see console.log()-messages. on mac os 10.11 using simulator version 10 , xcode 9.1. cannot see console logs in xcode developer console either if run project there...

printing - How to render charp image in pdf using Ghostscript -

visual foxpro application creates pdf file using infotec ps printer driver , ghostscript 9.20 using gsdll32.dll with parameters -dnopause -dbatch -dsafer -dpdfsettings=/screen -r300 -sdevice=pdfwrite -soutputfile=file.pdf -c .setpdfwrite -f inputfile.ps pdf contains image image size bigger , shrinked in pdf creeate smaller logo. image has single color. image in pdf appears dirty , there pixels other colors. how fix image appears sharp , contians sinle color ? possible change ghostscript printer diver settins or windows ps printer driver settings. original image bigger , has quality. firstly, don't use -dpdfsettings=/screen. intended reduce file sizes suitable screen resolution, sets whole host of configurations. better far understand doing , select ones want change. now quite image has been quantised (ie has been turned jpeg), , flat coloured images unsuitable candidates jpeg compression relies on image being photographic (jpeg = joint photographic experts ...

postgresql - update increment of serial field from several records in postgres -

i want change increment value of columns use sequencial ids. how can it? i tried following 2 approaches, both failed: update information_schema.sequences set increment=1; this doesn't work because information_schema.sequences it's view. i tried use alter sequence, adding @ end, like: alter sequence a.sequence_name increment 2 (select * information_schema.sequences) but syntax error. how can this? try using setval docs or alter sequence... restart with... described here edited twice sample how change sequences in owned schema: do $$ declare record; begin in (select * information_schema.sequences) loop execute $e$alter sequence $e$||i.sequence_name||$e$ increment 2$e$; end loop; end; $$ ;

c# - Element obscured when Selenium testing Edge webdriver for Azure Active Directory login Sign in to your account page -

i'm using selenium make integration test. part of test logon process microsoft azure active directory uses the test passes when using internetexplorerwebdriver, fails edgewebdriver error: element obscured the relevant part of code: var wait = new webdriverwait(webdriver, timespan.fromseconds(10)); webdriver.url = settings.urlhome(); var signinelement = webdriver.findelement(by.id("signinlink")); signinelement.click(); wait.until(expectedconditions.elementtobeclickable(by.id("my_login_name"))); var loginlogomicrosoft = webdriver.findelement(by.id("my_login_name")); loginlogomicrosoft.click(); the error occurs when executing last click(). i've tried several other elements, none of them working. 'inspect element' determine elements receives click error when implementing in code. how can make microsoft azure active directory logon process part of selenium test? a same kind of issue found here . i use foll...

FusionCharts Pie Chart not displaying when all data values are 0 -

Image
i'm trying render pie chart using fusion charts (the latest version) , if supply 0 values in data array bunch of errors in js console: the chart isn't rendered, expected result i'd rid of these errors if possible. thanks!

chromium - Alternate stylesheet switching in both Chrome and Firefox -

i'm encountering weird inconsistent behavior between chromium 53 , firefox 49 when switching between stylesheets. my stylesheets added this: <link class="alternate-style" rel="stylesheet" title="carbon" type="text/css" href="assets/css/alt/carbon.css" /> ... the switcher works this: function setstyle(style) { $('link.alternate-style') .prop('disabled', 'disabled') .filter(function() { return this.title == style; }) .removeattr('disabled'); } (setstyle() called on startup default value.) this worked in firefox , chromium without problems late jquery 2.2.4. now i'm trying upgrade jquery 3.1.1. in chromium, there's no problem @ - in firefox, won't work after upgrade. stylesheets disabled, , style-changer won't anything. suspecting removeattr() has changed (jquery differentiates between attributes , properties more strictly), changed setstyl...

ios - Data transfer between child tabs in a Tab bar controller -

Image
my tab bar controller has 4 tabs, have 6 textfields in vc1 , want use data entered display labels in vc2, vc3 & vc4. have read adding data tabbarcontroller subclass , using in rest of vc's stuck on implementation. i'm absolute beginner , code or links implementation of code great. try this: i have created uitabbarcontroller 2 child controllers tab1viewcontroller , tab2viewcontroller . screenshot of storyboard: code: class tab1viewcontroller: uiviewcontroller { @iboutlet weak var testtextfield: uitextfield! override func viewdidload() { super.viewdidload() } } class tab2viewcontroller: uiviewcontroller { @iboutlet weak var testlabel: uilabel! override func viewdidload() { super.viewdidload() } override func viewwillappear(_ animated: bool) { super.viewwillappear(animated) let tab1controller = self.tabbarcontroller?.viewcontrollers?.first as! tab1viewcontroller self.test...

xcode - How to read Crash log and find clue on Xamarin.forms' iOS? -

i'm making app using xf pcl. on ios app, crashes while it's on background. i found crash log on iphone , look. it's hard understand nor find problem. here crash log. there nothing code xamarins's api or native api. i believe code cause problem couldn't find start line. can crash log? thanks. incident identifier: ce060e55-0908-4bb9-ad6------ crashreporter key: ccb636455a06b10ce38a22cdae9e204f4b28e79c hardware model: iphone9,3 process: allbx.ios [337] path: /private/var/containers/bundle/application/-----30b1-4f7a-a5ec-----/allbx.ios.app/allbx.ios identifier: com.----.allb version: 69 (1.1.0) code type: arm-64 (native) role: non ui parent process: launchd [1] coalition: com.----.allb [427] date/time: 2016-11-17 17:06:31.4329 +0900 launch time: 2016-11-17 16:37:02.7326 +0900 os version: iphone os 10.1.1 (14b100) report version: ...

java - builder pattern json deserialize -

i have problem. used example of jackson json deserializing builder pattern empty json. use jackson-databind version 2.8.4 missing something? code follows: the value class import com.fasterxml.jackson.databind.annotation.jsondeserialize; @jsondeserialize(builder=valuebuilder.class) public class value { private final int x, y; protected value(int x, int y) { this.x = x; this.y = y; } } the valuebuilder class import com.fasterxml.jackson.annotation.jsoncreator; //@jsonpojobuilder(buildmethodname = "build", withprefix = "with") public class valuebuilder { private int x; private int y; // can use @jsoncreator use non-default ctor, inject values etc public valuebuilder() { } // if name "withxxx", works is: otherwise use @jsonproperty("x") or @jsonsetter("x")! public valuebuilder withx(int x) { this.x = x; return this; // or, construct new instance, return } public valuebuilder wit...

c# - change comboBox values based on click i another -

i have 2 functions first 1 filling combobox tables within sql database, below: private void fillcombo() { combobox1.items.clear(); try { string connectionstring = "data source=lpmsw09000012jd\\sqlexpress;initial catalog=pharmacies;integrated security=true"; using (sqlconnection con2 = new sqlconnection(connectionstring)) { con2.open(); string query = "select * information_schema.tables "; sqlcommand cmd2 = new sqlcommand(query, con2); sqldatareader dr2 = cmd2.executereader(); while (dr2.read()) { int col = dr2.getordinal("table_name"); combobox1.items.add(dr2[col].tostring()); } combobox1.selectedindex = 0; } } catch (exception ex) { messagebox.show(ex.tostring()); ...

Android FloatActionButton: how to make it stick out of a View? -

Image
i have floatactionbutton have stick out bit view contains it, becomes cutted. how can obtain out bit container? example image this complete code of layout, including coordinator layout , fab. <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/activity_show_image" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/add_text_to_media_image"/> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id=...

asp.net - signlar concurrent connections with iis 8 on Win Server Essentials 2012 -

i had signlar app ran on windows 10 pro box. used iis on , allowed me have 10 concurrent connections. but needed expand concurrent connections app. purchased new hardware , windows server essentials 2012. i setup signlar app , started opening browser windows test on new box , couldn't more 4 connections open @ once. fifth browser page hangs. close browser page hanging page appears. i'm stumped.

jquery - jqGrid v4 - dynamic column not working -

controller code: public jsonresult getgridcolumn() { var jsondata = new { colnames = "['actname']", colmodel = "[{ name: 'actiontaken'}]", }; return json(jsondata, jsonrequestbehavior.allowget); } } view code : $(document).ready(function () { $.ajax({ type: "post", url: "/getform/getgridcolumn", data: "", datatype: "json", success: function (data) { coln = data.colnames; colm = data.colmodel; $("#taskgrid").jqgrid({ url: "someurl", datatype: 'jsonstring', mtype: 'post', colnames: coln, colmodel: colm, pager: jquery('#pager'), rownum: 10, rowlist: [10, 20, 30, 40], height: '100%', ...

Regex searching for number and letter combination optional brackets -

i need regex find match of single lower case a-z character followed 5 numbers either: at start of line at end of line surrounded () or [] surrounded whitespace so following results expected: a12345 match (a12345) match [a12345] match text a12345 match aa12345 no match at moment have (?<=[])]*)[a-z]{1}[0-9]{5}(?=[])]*) not working scenarios, example sees aa12345 , a12345a being matches when don't want them to. can help? edit: apologies should have mentioned .net c# first of should mention programming language. following solution pcre . regex: ((?<=[\[( ])|^)[a-z]\d{5}((?=[\]\) ])|$) explanation: ((?<=[\[( ])|^) checks preceding brackets, whitespaces or beginning. [a-z]\d{5} checks alphabet followed 5 digits. ((?=[\]\) ])|$) checks succeeding brackets, whitespaces or end of line. regex101 demo

c++ - Operator= of class 'Entity' doesn't work properly -

okay i'm making own entity component system, , want able set entity another, here how looks: entity& operator=(const entity& other) { this->name = other.name; this->tag = other.tag; this->isstatic = other.isstatic; return entity(this->name, this->tag, true, this->isstatic); } an entity has id has unique other entities, when set entity another, id gets set: 'main.cpp' entity = entity("a", "tag of a"); // automatically gets id: 0 because first entity created entity b = entity("b", "tag of b"); // b gets id: 1 because second entity created a.printall(); // function prints name, tag, , id of entity, prints out: " "a" has "tag of a" tag, , id = "0" " // after set b, things little messy = b; a.printall(); // prints out: " "b" has "tag of b" tag, , id = "1" ", should not happen, why did id of change ? the way...

java - DefaultHttpClient Depricated Android Studio 2.2.2 -

after following few guides on how data , send data database on local server using apache , mysqlli , error occurred saying code deprecated. after looking guides on deprecation found out of them outdated. here codes of manifest, parser , , gradle file module(by order): <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.denis.loginappphpmyadmintest" > <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme" > <activity android:name=".mainactivity" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> ...

java - How to use FragmentTransaction's add() method to set a Fragment in a RelativeLayout -

i'am using drawerlayout slide right left , accomplish task i'have created below's method : xml code : <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:facebook="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- framelayout display fragments --> <relativelayout android:id="@+id/mainview" android:layout_width="match_parent" android:layout_height="match_parent" > </relativelayout> <!-- listview display slider menu --> <relativelayout android:id="@+id/drawerview" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="start" > <li...

sql - Variable number of parameters in macro in SAS? -

i have macro passing in 6 table names , 6 columns. however, number of columns , tables not constant. is there way have variable number of parameters? familiar concept in python **kwargs. also, there way parameterize proc sql statement take many col , table inputs provided? or try catch of sort in sas check if variables exist before running sql statement? here macro i'm trying parameterize. %macro generate_tp_tbl(new_tbl_name, trans_col, tbl_1, tbl_2, tbl_3, tbl_4, tbl_5, tbl_6, col_1, col_2, col_3, col_4, col_5, col_6); proc sql; create table &new_tbl_name select a1._name_, a1.&trans_col &col_1, a2.&trans_col &col_2, a3.&trans_col &col_3, a4.&trans_col &col_4, a5.&trans_col &col_5, a6.&trans_col &col_6 &tbl_1 a1, &tbl_2 a2, &tbl_3 a3, &tbl_4 a4, &tbl_5 a5, &tbl_6 a6 a1._name_ = a2._name_ = a3._name_ = a4._name_ = a5._name_ = a6._name_; run; %me...

c - Failed summing/adding every other component inside an integer array -

i continue quest store input credit card number , validate it. 1) user types hipothetic credit card number, 1234567898769999 (stored string). 2) convert string array of integers int digits[]. 3) multiply digitis in positions 1, 3, 5 ... last odd position 2, instance 2*2, 2*4, 2*6, 2*8, 2*8, 2*6, 2*9, 2*9. 4) store them in same array , position [4,8,12,16,16, 12, 18,18]. 5) sum digits in positions 0, 2, 4 ... last position. trying run code below abnormal values appearing: #include <cs50.h> #include <stdio.h> #include <string.h> int main (void) { string cc_string; printf("please enter credit card number:\n"); //capture credit card number cc_string = getstring(); // array of integers credit card digits int cc_digits[15]; int sum_evens, sum_odds = 0; (int = 0; < 16; i++) { cc_digits[i] = cc_string[i] - '0'; //sum digits in positions (0 ... 14) if (i % 2 == 0) { ...

perl - Installing DBD::Sybase on OS X with Homebrew fails to find freetds libraries -

i installing dbd::sybase i receive following error, after setting export sybase=/usr/local/cellar/freetds/0.95.80 and download freetds: brew install freetds error: configuring dbd-sybase-1.15 ... can't find sybase libraries in /usr/local/cellar/freetds/0.95.80/lib or /usr/local/cellar/freetds/0.95.80/lib64 @ makefile.pl line 155, <in> line 44 i believe need edit makefile directly. need edit makefile? , use cpanm still. cpanm under brew (cellar). /usr/local/cellar/freetds/0.95.80/lib ├── libct.4.dylib ├── libct.a ├── libct.dylib -> libct.4.dylib ├── libsybdb.5.dylib ├── libsybdb.a └── libsybdb.dylib -> libsybdb.5.dylib /usr/local/cellar/freetds/0.95.80/ authors changelog news todo etc lib copying install_receipt.json readme bin include share there a reported bug in dbd::sybase on os x causing problem. one pa...

java - Trouble parsing JSONArray within JSONObject -

for reason whole array read when try select 1 segment doesn't let me see past past segment in array array length equals 1, got squashed 1 element. code: https://github.com/yehudaclinton/mytest/blob/master/testhttp.java try { object obj = parser.parse(result); jsonobject jsonobject = (jsonobject) obj; jsonarray items = (jsonarray) jsonobject.get("items"); log.d(tag, "items length: " + items.size());//for reason not more 1 string name = ""; //the following supposed return title of book (int = 0; < items.size(); i++) { jsonobject item = (jsonobject) items.get(i);//if 'i' equals more 1 program crashes if(item.get("title")!=null) {//only title jsonobject thetitle = (jsonobject) item.get("title"); name = (strin...

xml - Java SOAP header tag and namespace only appears into response -

i have webservice deployed server 1 client doing requests aginst it. have client , server certificates established ssl connection and, in server side, build signature , client tries verify it. problem when server signs soap message looks one: <?xml version="1.0" encoding="utf-8" standalone="no"?> <s:envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> <s:body> <ns2:responsemessage xmlns="urn:iec62325.504:messages:1:0" xmlns:ns2="http://iec.ch/tc57/2011/schema/message"> <ns2:header> <ns2:verb>reply</ns2:verb> <ns2:noun>querydata</ns2:noun> <ns2:timestamp>2016-11-17t15:44:51z</ns2:timestamp> <signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <signedinfo> <canonicalizationmethod algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <signaturemethod algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-...

c++ - CMake: rewrite project, only if modified? -

i have cmake project generates several visual studio projects single solution. if make change cmake scripts, affects single project (for example, add_target_definitions ) , call cmake regenerate projects, of project files (*.vcxproj) rewritten disk. triggers rebuild of targets, though perhaps 1 of project files different was. adds build time of different configurations have. i rebuild few projects these different target defines (eg. supplied on command line), , not recompile unaffected libraries. require solution works when compiling all_build target, , not split project multiple projects (solutions). is there cmake option, or other trick avoid behavior? it turns out cmake script using add_target_definitions in included in cmakelists.txt @ top level, , thus, cmakelists.txt in directories below dependency of it. found inspecting generated.stamp.depend 1 of projects. if split out separate script included project requires it, projects no longer rewritten.

machine learning - Picture classification with Neural Network in R -

i want try neural network classification of data got out of pictures. code use getting pictures , turning them data, have idea of data looks like. folder<-'.' file_list <- dir(folder, pattern="png") data <- mclapply(file_list, readpng) # extract subject id + img nr names subject_ids <- lapply(file_list, function(file_name) as.numeric(unlist(strsplit(file_name, "_"))[1])) # rename subject id's subject_ids[subject_ids==0]='circle' subject_ids[subject_ids!='circle']='line' img_ids <- lapply(file_list, function(file_name) as.numeric(unlist(strsplit(unlist(strsplit(file_name, "_"))[2], "\\."))[1])) # specify data should used test , train img nrs nritems <- length(img_ids)/2 nrtest <- nritems*0.7 testitems <- sample(1:nritems, nrtest) # split data train , test train_in <- t(array(unlist(data[img_ids %in% testitems]), dim=c(length(unlist(data[1])),sum(img_ids %in% testitems)))) tra...

Git push error "You must verify your email address." -

when i'm trying push github, following error: remote: must verify email address. remote: see https://github.com/settings/emails. fatal: unable access 'https://github.com/user/userrep.git/': requested url returned error: 403 i absolutely sure email verified. i've tried add remote url without .git, didn't help.

Is it possible to have a dynamic choice field with ng-admin? -

when creating or editing entity, possible have second choices field options dependent on first choices field? for example, have categories , subcategories. choices/options subcategory field dependent on selected choice/option in category field. in docs, there example categories , subcategories when attempt way shown, subcategories updated on page load , not change when different category specified. can find example through link below. https://github.com/marmelab/ng-admin/blob/master/doc/reference/field.md#-reference-field-type the way have dynamic choice field si write new custom directive , use template field. nga.field('my_field') .template('<my-custom-field field="::field" values="::entry.values"></my-custom-field>'),

sql server - The INSERT statement conflicted with the CHECK constraint.conflict occurred in database -

the solution above subject line exists in many links , have come across links , find no solution issue. here query : insert patientpatternelements (patientpatternsid, aseventid, locationid, effectivedate, effectivedateend, workloadstartdate, workloadenddate) select distinct patientpatterns.id, @hl7event_id, @default_locationid, @hl7event_effective_date, @hl7event_effective_date, @hl7event_effective_date, @hl7event_effective_date patientpatternelements inner join patientpatterns on patientpatternelements.patientpatternsid = patientpatterns.id patientpatterns.patientencounterid = @patient_encounter_id , patientpatterns.visit = @patient_encounter_visit --------------------- -- error checking ...