Posts

Showing posts from February, 2011

.net - Can't negotiate Signalr when using only webapi -

i followed following video on getting signal , webapi running together: video however, i'm unable working on solution. have empty api project has references many other projects have api controllers defined functionality. in 1 of other projects, wanted add signalr hub communicate client. so, added signalr through nuget. right off bat began getting owin error added following app settings <add key="owin:automaticappstartup" value="false" /> i've added hubcontext controller in question so: private readonly lazy<ihubcontext> _hub = new lazy<ihubcontext>( () => globalhost.connectionmanager.gethubcontext<taskhub>()); /// <summary> /// gets hub. /// </summary> protected ihubcontext hub { { return _hub.value; } } then in 1 of api calls, added following code send message client: hub.clients.all.taskloaded(); when started work on client, connection fail each time. after investigation learned .../s

OSX crash log: How can I find what line in my app caused this crash? -

someone else got error, how find out source of crash? not sure file libdyld.dylib nor sure how understand exception type , code. os version: mac os x 10.9.5 (13f1077) crashed thread: 0 dispatch queue: com.apple.main-thread exception type: exc_bad_instruction (sigill) exception codes: 0x0000000000000001, 0x0000000000000000 thread 0 crashed:: dispatch queue: com.apple.main-thread 0 com.themolehill.tickmac 0x000000010bf9bb6b 0x10bf98000 + 15211 1 com.themolehill.tickmac 0x000000010bf996b6 0x10bf98000 + 5814 2 com.apple.appkit 0x00007fff87d77718 -[nsviewcontroller view] + 41 3 com.apple.appkit 0x00007fff87f2b4c2 -[nspopover showrelativetorect:ofview:preferrededge:] + 172 4 com.themolehill.tickmac 0x000000010bfa8371 0x10bf98000 + 66417 5 com.themolehill.tickmac 0x000000010bfabb55 0x10bf98000 + 80725 6 com.apple.appkit 0x00007fff87e8ba58 -[nswindow sendevent:] + 11296 7 com.apple.a

android - Some layouts expanding slower than others when using LayoutTransition.CHANGING -

i have 19 horizontal linearlayouts arranged vertically within linearlayout. empty , onclick show text. animating layouts with parentone.getlayouttransition().enabletransitiontype(layouttransition.changing); for reason first 7 layouts seem opening onclick little slower 8th. split second have asked others @ when open make sure i'm not crazy. post entire file huge , on maximum allowable text on this. here meat , potatoes. so, why layouts opening slower others? numbers 8-19 open instantly onclick , 1-7 have small delay noticeable. java on create @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getsupportactionbar().hide(); setcontentview(r.layout.tacticalfieldcarestudy); linearlayout parentone = (linearlayout) findviewbyid(r.id.tfclayoutone); linearlayout parenttwo = (linearlayout) findviewbyid(r.id.tfclayouttwo); linearlayout parenttwobullets = (linearlayout)findviewbyid(r.id.tfclayouttwobullets

xaml - stackpanel Horizontal wrap text WP 8.1 -

Image
code: <code> <stackpanel orientation="horizontal"> <textblock text="key1:" fontsize="20" foreground="#73000000" textwrapping="wrap"/> <grid><textblock text="small value1" fontsize="20" textwrapping="wrap" /> </grid> </stackpanel> <stackpanel orientation="horizontal"> <textblock text="key2:" fontsize="20" foreground="#73000000" textwrapping="wrap"/> <grid> <textblock text="long long long long long longlonglong long long longvalue2" fontsize="20" textwrapping="wrap" /> </grid> </stackpanel> </code> image screen shot: i need make transfer of v

python - Django Form context data lost on validation fail -

my form (code below) loads , saves fine. however, if there validation error in form , reloaded, context['uploaded_files'] assign in get_context_data method empty. why , how can once again pass context['uploaded_files'] when form reloaded on validation fail? class businesseditview(updateview): template_name = 'directory/business_edit.html' model = appuser form_class = businesseditform def get_context_data(self, **kwargs): context = super(businesseditview, self).get_context_data(**kwargs) user_object = context['appuser'] files = [user_object.logo] context['uploaded_files'] = files return context def get_object(self, queryset=none): return self.request.user def post(self, request, *args, **kwargs): form = businesseditform(request.post, instance=self.request.user) if form.is_valid(): form.save(commit=false) return httpresponsere

ruby on rails - factory_girl: has many through association -

i have rich many many relationship between projects , users. project model has: has_many :project_members, dependent: :destroy, foreign_key: 'gallery_id' has_many :members, through: :project_members, class_name: 'user', foreign_key: 'member_id' user model: has_many :project_members, dependent: :destroy, foreign_key: 'member_id' has_many :member_projects, through: :project_members, source: :member_project and project_member model: belongs_to :member_project, foreign_key: 'gallery_id', class_name: 'project' belongs_to :member, foreign_key: 'member_id', class_name: 'user' i wrote project factory as: factorygirl.define factory :project_member association :project association :user role 'owner' end end however gives me: > undefined method `project=' #<projectmember:0x00000006f66048> i

c++ - kill subprocess if proc -

i'm using c++11 , linux. attempting start multiple ssh commands using fork() , popen() , monitor when ssh command stops running. when kill ssh command on other computer, doesn't appear kill fork() child process started it. child process continues run until exit program. need kill child process once ssh command called popen() quits running? there better use popen() call ssh command? you need call wait or waitpid in order o/s remove child process. completed child process has not had status retrieved parent wait becomes "zombie" process. if you're not interested in child process status want have them cleaned up, can install signal handler sigchld , fire whenever 1 of child processes finishes, , call wait within handler "reap" child.

r - dplyr on subset of columns while keeping the rest of the data.frame -

i trying use dplyr apply function subset of columns. however, in contrast code per below, trying implement while keeping columns in data-frame. currently, resulting data-frame keeps selected columns. can use remove-and-cbind construction merge these columns original dataframe, wondering if there way directly in dplyr? have tried move select function inside mutate function, not able make work yet. require(dplyr) replace15=function(x){ifelse(x<1.5,1,x)} dg <- iris %>% dplyr::select(starts_with("petal")) %>% mutate_each(funs(replace15)) dg > dg source: local data frame [150 x 2] petal.length petal.width 1 1.0 1 2 1.0 1 3 1.0 1 4 1.5 1 5 1.0 1 6 1.7 1 7 1.0 1 8 1.5 1 9 1.0 1 10 1.5 1 dg <- iris %>% mutate_each(funs(replace15), matches(&qu

html - Strange interaction with display:flex and rowspans in IE -

i trying position: absolute element within table, , found cells span multiple rows, reach bottom of first cell, , happen in ie. after tinkering, seemed cause of problem table nested in div display: -ms-flexbox , , removing css meant element reach bottom of second row cell spanned. here js fiddle showing mean. in chrome work correctly, in ie10, green boxes aren't aligned base of rowspan cell. https://jsfiddle.net/lomldtxg/8/ can explain how these 2 pieces of css interact, , why happens? seems ie explorer issue, there workaround / hack needs done in order have render correctly?

Exposing database IDs - security risk? -

i've heard exposing database ids (in urls, example) security risk, i'm having trouble understanding why. any opinions or links on why it's risk, or why isn't? edit: of course access scoped, e.g. if can't see resource foo?id=123 you'll error page. otherwise url should secret. edit: if url secret, contain generated token has limited lifetime, e.g. valid 1 hour , can used once. edit (months later): current preferred practice use uuids ids , expose them. if i'm using sequential numbers (usually performance on dbs) ids generating uuid token each entry alternate key, , expose that. given proper conditions, exposing identifiers not security risk. and, in practice, extremely burdensome design web application without exposing identifiers. here rules follow: use role-based security control access operation. how done depends on platform , framework you've chosen, many support declarative security model automatically redirect browsers auth

java - JComboBox as title in titledBorder -

i'm using create titled border: border line = borderfactory.createlineborder(color.black); border titled = borderfactory.createtitledborder(line, *somestring*); and i'd use jcombobox string title (replace somestring jcombobox). can borderfactory, else or need write custom?

html5 - Div to auto adjust to fit responsive background image -

i'm looking solution have parent div auto adjust size responsive background image while still allowing child elements inside div. i've used solution thread, can see, child elements being pushed down. suggestions? example: http://nowicki.nigelyoshida.com/services/ <div id="category-name" style="background-image:url('http://nowicki.nigelyoshida.com/wp-content/uploads/2015/06/nowicki-services.jpg'); background-size: contain; width: 100%; height: auto; padding-top: 65%" class="col-xs-12 page-header-image"> <span>services</span> <div class="featured-text"> <h1>why chiropractic?</h1> <p>chiropractic therapy can maintain balanced relationship between musculoskeletal health , nervous system promote flexibility , pain relief.</p> </div> </div>

python - Need to iterate through each column and find max and min -

import numpy np x = np.loadtxt('xdata.txt', dtype=float) y = np.loadtxt('ydata.txt', dtype=float) normalx = [] normaly = [] column in x: = 0 while <=17: xmax = max(column[i]) xmin = min(column[i]) normalx = (?-xmin)/(xmax-xmin) normalx.append(normalx) += 1 else: break i have 148 17 matrix import , want normalize data. trying iterate through each column , find max , min code far results in "typeerror: 'numpy.float64' object not iterable". should ? if want have element in column. instead of big 148x17 matrix ill put 4x4. 1.61 125 13 933.57 1.95 135 29 1357.77 1.91 135 28 1728 2.2 137 46 1828.05 first column max 2.2, min = 1.61 etc. in code, first accessing for columns in x causes columns row in x , later on inside loop trying access columns[i] , return element in position in row. you can use np.amax(x, axis=0) maximum of each column , inturn

powershell - Create new power plan -

i have found sorts of references using powershell change active power plan, , have found instructions manually creating new power plan, can't seem find using powershell automate creation of new plan. can done, , need keep looking? or not finding because can't done? and, little context, automating setup of lab machines 3 day conference. machines come various vendors, , have no idea nor control on settings windows image going provide. laptops set power down screen @ 10-15 minutes, crazy lab, go more listening instruction, when go try need password. goal have script create new power plan settings want, , second script makes plan current user. need make work in psv2 99% of time windows 7, , not in position demand ps update. automate os install too, , eliminate few more variables, working os image get. apparently need wrap powercfg calls in script produce power plan modification. 1 thing can call powercfg -import <file> <guid> , , can prepare file setting

python - create function openerp 6.0 -

i created module in openerp 6.0, problem openerp 6.0 did not support same code openerp 7, function create: if 1 can me solve problem: def create(self, cr, uid, vals, context=none): if context none: context = {} if vals['teacher_id']: teacher=self.pool.get("res.partner").browse(cr,uid,vals['teacher_id'],context) teacher.attendee=true if vals['etudiant_ids'][0][2]: etudiant in self.pool.get("res.partner").browse(cr,uid,vals['etudiant_ids'][0][2],context): etudiant.attendee=true return super(attendee, self).create(cr, uid, vals, context=context) the problem in "if vals['etudiant_ids'][0][2]:" if vals['etudiant_ids'][0][2]: typeerror: 'bool' object has no attribute '__getitem__' the above error comes, when accessing dictionary, key not found. better way debug is, use print statements check value print vals['etu

c# - Passing more multiple queries in a View ASP.NET -

in repository class have 2 queries want appear in 1 view: public classxxxx getxxxolist(string name) { return context.classxxxx.where(v => v.name == name).single(); } and second query in repository class have: public ienumerable<classxxxx> list() { return context.classxxxx.tolist(); } then in view doing this: @model ienumerable<namespace.models.classxxxx> @model namespace.models.classxxxx to return 2 queries in view respectively. asp.net throws exception on using @model twice in 1 view. instead of: @model ienumerable<namespace.models.classxxxx> @model namespace.models.classxxxx you can create viewmodel class, contains needed data: public class yourcontextviewmodel { public list<person> person { get; set; } public string username{get;set;} ... } it's idea create viewmodel object populate views.

mysql - How can I upload a text file the best into a database as I want it to? (in C) -

at first need do: need input text file database. that not hard, text file gave me kinda strange. i modified looks in database, don't want change every file hand time. thought why not splitting text file separate text files or in arrays , upload bit o should belong in database. but after searching long time in internet couldn't find on how (or maybe found didn't :p). so question is: what best way split text file can upload chunks in database? best split in lot of text files , upload every text file or in array , upload arrays database. the text file self divided text , numbers , want numbers uploaded database , text in column names of database. here example of such text file (normally without spaces between it): usindsvorigecall = -1.0000;0.0000;0.0000;0.0000; weersindsvorigecall = -1.0000;10.1000;7.5200;10.4000; 0.0000;10.4000;7.6740;10.7000; klimaatsindsvorigecall = -1.0000;7.4000;8.8000;6.6000;-99.0000;-99.0000;-99.0000;-99.0000;-99.0000

database - Grails Relation m:n:n -

we work existing mysql database under grails contains m:n relation. no problem here. in situation have add second n relation entry, links same table , has associated first n entry. if database, create table looks like: field m_id -> links m table field n_id1 -> links n table field n_id2 -> links n table but how can represented in grails domain class? possibly answer can found somewhere, searches did not successful, maybe due lack of search term creativity. edit: trying clarify question: have many-to-many relation, 2 items on 1 side, have maintain association each other (and must clear example original , replacement item), can not seperated 2 separate entries relation. hmm... try think of racing car drivers nominating series of races, , every nomination has contain driver , substitute. races m (left hand), driver n1 , substitute n2. (it hard work find example...) edit: by coincidence found this question addresses same problem left off rather unsolved.

ios - Define a section of code in a class that's configured for two targets to run only in one of the targets: -

Image
i'm working on custom keyboard project. in project have 2 targets (the app , keyboard targets). build class that's responsible handling network data both of targets: class feeddatamanager: urlmanagerdelegate, modelmanagerdelegate { //class variables.... func initforkeyboard() { self.mmodelmanager = modelmanager(acontext: self.managedobjectcontext()) self.mmodelmanager.delegate = self self.mmodelmanager.mdelegatehashstring = hashstring(self) self.mfeedsarray = array<news>() mmodelmanager.getfeeds(&self.mfeedsarray) self.murlmanager = urlmanager() self.murlmanager.delegate = self } func initforapp() { self.mmodelmanager = modelmanager(acontext: self.managedobjectcontext()) self.mmodelmanager.delegate = self self.mmodelmanager.mdelegatehashstring = hashstring(self) let uuid: string? = userdefaultsmanager.sharedinstance.getobjectforkey("uuid") as? string self.murlmanager = urlmanager() self.murlmanage

html - How can I vertically align the text on these CSS buttons? -

jsfiddle: https://jsfiddle.net/u7lm5sjp/ i have links like: <div class="splash_button_row"> <span> <a href="www.google.com" class="splash_button">label 4 label 4 label 4 </a> <a href="www.google.com" class="splash_button">label 2</a> <a href="www.google.com" class="splash_button">label 5 label 5label 5</a> <a href="www.google.com" class="splash_button">label 5 label 5label 5label 5 label 5label 5</a> </span> </div> and while bunch of .css like: .splash_button { background: linear-gradient(to bottom, #3498db, #2980b9) repeat scroll 0% 0% #3498db; border-radius: 30px; text-shadow: 6px 4px 4px #666; box-shadow: 2px 2px 3px #666; font-family: georgia; color: #fff; padding: 10px 20px; border: 2px solid #216e9e; text-decoration: none; display: inline-block; margin: 10px; wh

javascript - Making AngularJS ui-router / app wait for $http data to prevent FOUC -

i have following question... or situation. have states defined in angularjs app, so... $stateprovider .state('myapp', { abstract: true, template: '<ui-view/>' }) .state('myapp.stateone', { url: 'state1', templateurl: '/an/views/state-1.html', controller: 'stateonectrl' }) .state('myapp.statetwo', { url: 'state2', templateurl: '/an/views/state-2.html' controller: 'statetwoctrl' }) .state('myapp.statethree', { url: 'state3', templateurl: '/an/views/state-3.html' controller: 'statethreectrl' }) there more states , have changed naming example, suppose need check if user allowed see / load 'mayap

graph theory - Find all sets of closed nodes in R -

Image
i have edge list follows (simple example): dt <- data.frame(x = c(letters[1:7],"a","b","c","a","d","e","f"), y = c(letters[1:7],"b","a","a","c","f","f","d")) > dt x y 1 a 2 b b 3 c c 4 d d 5 e e 6 f f 7 g g 8 b 9 b 10 c 11 c 12 d f 13 e f 14 f d i graphed using following code: require(igraph) myadj <- get.adjacency(graph.edgelist(as.matrix(dt), directed=false)) my_graph <- graph.adjacency(myadj) layout <- layout.fruchterman.reingold(my_graph,niter=500,area=vcount(my_graph)^2.3,repulserad=vcount(my_graph)^2.8) plot(my_graph, vertex.size=10, vertex.label.cex=1, edge.arrow.size=0, edge.curved=true,layout=layout) what go extract set of closed nodes. i'm not sure typical notation like, imagine: node set 1 1 2 b 1 3 c 1 4 d 2 5 e 2 6 f 2 7 g 3 i have looked a

java - Error on setting custom ListView Image -

i want set custom listview arrayadapter . every listitem has imageview , 2 textviews . the layout of each item rowlayout.xml : <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <imageview android:id="@+id/item_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:adjustviewbounds="true" android:maxheight="80dp" android:maxwidth="80dp" android:src="@drawable/logo" /> <textview android:id="@+id/item_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/item_subtitle" android:layout_torigh

javascript - Auto calculate todays date when doc opens and add days to date in another field -

i using adobe xi standard , have pdf document text field “today” mouse java script of var f = this.getfield("today"); f.value = util.printd("mmm/d/yyyy", new date()); problem 1) want automatically update when document opens instead of when mouse enters dont know how or place script in proper place. i have text field labeled “text11” formatted date mm/dd/yyyy i have text field labeled “21stday” want calculate 21 days date in “text11” field. problem 2) have not been able script work. can please tell me how make work , place scripts novice @ doing this. thank in advance! i believe there 2 potential ways this: an openaction entry in catalog root action dictionary of s(ub)type javascript named javascripts seem executed when document first opened in acrobat. for fomer see table 3.25 in section 3.6.1 , section 8.5 in pdf v1.7 reference, , section 3.6.3 latter.

datetime - Python pimping / monkey-patching -

i want simple thing: monkey-patch datetime . can't exactly, since datetime c class. so wrote following code: datetime import datetime _datetime class datetime(_datetime): def withtimeatmidnight(self): return self.replace(hour=0, minute=0, second=0, microsecond=0) this on file called datetime.py inside package called pimp. from error message i'm given: traceback (most recent call last): file "run.py", line 1, in pimp.datetime import datetime file "/home/lg/src/project/library/pimp/datetime/datetime.py", line 1, in datetime import datetime _datetime importerror: cannot import name datetime i assume can't have module called datetime importing module called datetime . how should proceed keep module , class named datetime ? put module package e.g., your_lib.datetime . should not use datetime name top-level module. if on python 2 add @ top: from __future__ import absolute_import to forbid implic

Using MYSQL connector C -

i have used mysql connector c project. when connect localhost , connects , data accessed when try connect internet host mysql.hostinget.in , doesn't connect. connecting localhost: works. mysql *con = mysql_init(null); mysql_real_connect(con,"localhost","root","","main",0,null,0); connecting internet host: doesn't work. mysql_real_connect(con, "mysql.hostinger.in", "u250589599_sri", "abcd","u250589599_main", 0, null, 0);

sql server - How to set transaction isolation level using classic ASP? -

i have classic asp page , want set transaction isolation level read uncommitted . using this documentation have came following: set conn = getconnection conn.isolationlevel = adxactreaduncommitted 'conn.begintrans 'conn.committrans set cmd = server.createobject("adodb.command") set cmd.activeconnection = conn cmd.commandtype = adcmdtext cmd.commandtext = "insert [dbo].[a] ([isolationlevel]) select case transaction_isolation_level when 0 'unspecified' when 1 'readuncommitted' when 2 'readcommitted' when 3 'repeatable' when 4 'serializable' when 5 'snapshot' end transaction_isolation_level sys.dm_exec_sessions session_id = @@spid" set rs = cmd.execute() response.write(conn.isolationlevel) the last response.write gives me correctly 256 ( read uncommitted ) when query table got readcommitted records. could tell doing wrong? and here body of getconnection function: function getcon

Streaming webcam from c# Windows Form to ASP.NET -

after research, cannot figure out way convince me following. i have webcam, connected pc, , want stream content asp.net webpage hosted azure using windows form application. could help? maybe using expression encoder 4, have no idea

vb.net - OpenGL Fitting Viewer to Object (written in VB .NET but C# answers will work too) -

background i attempting make simple cad viewer. have chosen start .stl files which, of don't know, bunch of triangles form part on screen. when outputting cad software, can output text file version if stl. lists of points: solid facet normal -7.8662990e-02 +8.3699658e-01 -5.4152455e-01 outer loop vertex +3.3529416e+03 -3.7456115e+02 +8.5293264e+02 vertex +3.3530518e+03 -3.7467327e+02 +8.5274334e+02 vertex +3.3527449e+03 -3.7467680e+02 +8.5278246e+02 endloop endfacet facet normal -1.7741169e-02 +8.8266388e-01 -4.6966979e-01 outer loop vertex +3.3527449e+03 -3.7467680e+02 +8.5278246e+02 vertex +3.3522178e+03 -3.7464933e+02 +8.5285399e+02 vertex +3.3524442e+03 -3.7463108e+02 +8.5287975e+02 endloop endfacet and forth.. can loop through points , create triangles: dim integer = 0 until + 2 >= listview1.items.count gl.glpushmatrix() gl.glbegin(gl.gl_triangles) gl.glcolor3f(1.0, 0.0, 0.0)

Vimeo API v3: request to get multiple videos by Video Id's -

is there way, can make api request multiple video details using list of id's ? how youtube provides googleapis.com/youtube/v3/videos?id=[id1,id2,id3]. can achieve same through vimeo ? guide through pls. thanks unfortunately not. it's planned though! your best solution might add them in channel, group or album, query collections videos.

ssl - Multiple intermediate CA servers sharing index.txt cert file -

i have multiple intermediate ca servers creating certs. can see these new certs been added index.txt. question on cert revocation. if server 1 creates cert server 1 goes down. go server 2 revoke cert how server 2 know certificate? possible share index.txt information across multiple ca servers. reason using multiple servers high availability

python - How to avoid additional whitespaces in loggerfile, caused by indentions -

today applied pep 8 coding convention on project. therefore splitted logger.debug avoid e501 line long . have now: def find_window(): ... logger.debug("returning list of window handles\ specified windowtitle: {}".format(title)) so far, good, bad news is, in loggerfile: 06/25/2015 02:07:20 pm - debug - libs.window on 104 : returning list of window handles specified windowtitle: desktop: notepad there additional whitespaces after word handles. know if this: def find_window(): ... logger.debug("returning list of window handles \ specified windowtitle: {}".format(title)) this work, looks stupid , more if u have more indentions. how avoid whitespaces in loggerfile? logger.debug(( "returning list of window handles" "with specified windowtitle: {}" ).format(title))

java - Create aggregation in mongodb with spring -

i have aggregation works in mongo , need create exact 1 in java spring. didn't find way. know if there one? db.collection_name.aggregate([ { $group: { _id : { year : {$year : "$receiveddate" }, month : {$month: "$receiveddate"}, day : { $dayofmonth : "$receiveddate"} }, count : { $sum: 1 } } } ]) you try projecting fields first using spel andexpression in projection operation , group new fields in group operation: aggregation agg = newaggregation( project() .andexpression("year(receiveddate)").as("year") .andexpression("month(receiveddate)").as("month") .andexpression("dayofmonth(receiveddate)").as("day"), group(fields().and("year").and("month").and("day")) .count().as("count&qu

php - Get path from adjacency list data -

i have array (data adjacency table) , looks like: array ( [0] => array ( [id] => 1 [name] => anniversary [parent] => 0 ) [1] => array ( [id] => 12 [name] => new arrives [parent] => 1 ) [2] => array ( [id] => 13 [name] => discount [parent] => 12 ) [3] => array ( [id] => 6 [name] => birthday [parent] => 0 ) ) and i'm looking way retrieve path id; for example: getpath(13): anniversary->new arrives->discount; example: getpath(12): anniversary->new arrives; example: getpath(1): anniversary; example: getpath(6): birthday; how can this? thanks! function getpath($id, $arr, $level = 0) { $result = array(); foreach($arr $key => $value){ if($id == $value['id']){

sql - Is it possible to use column values to determine the tablename in a from clause of a subselect? -

i run query uses column value (in tablename stored) determine tablename in clause of subselect. something that: select column_with_tablename, (select count(*) valueof(column_with_tablename) ) numberofitems from table1 i know fragile need work. (i inherited database stores tablenames in column) is there way ? for pure sql solution, refer this answer select column_with_tablename, to_number(extractvalue(xmltype (dbms_xmlgen.getxml('select count(*) c '||column_with_tablename) ),'/rowset/row/c')) count table1

Two constructor calls inside one constructor in Java -

suppose following situation: class foo{ foo(i i, i1 i1){ super(); this(i); ... } foo(i i){ super(); ... } } java complains constructor call must first statement in constructor. cannot make 2 constructor calls first @ same time. there workaround wouldn't repeating code of one-argument constructor inside 2 argument constructor? yes, mentioned in comment , don`t need call super(). how works in java ? if don`t write constructor, java write to you, when compiling code , inserting: public class apple{ public apple(){ // injected java, super(); // object class } if write constructor, don`t add java replace yours: public class apple{ public apple(){ super(); // added java, during compiling } if write own: public class apple{ public apple(){ // init things , make world better place } in case java don`t insert anything, super(); because need call object class well. so, super(); there @ cost.

javascript - How to check object has any property in knockout js -

how check whether observable object has property exist in knockout js. have tried hasownproperty , return false me. my code follows: <div data-bind="click:setobject">click here</div> <div data-bind="click:init">check console</div> <script> var viewmodel = function() { var self = this; this.arrayval = ko.observable({}); this.setobject = function(){ /* have set property here */ self.arrayval({ id:10 }); }; self.init = function(){ console.log(self.arrayval()); console.log(self.arrayval.hasownproperty('id')); /* on second click (after setobject ) expect trut,but returned false */ } self.init(); }; ko.applybindings(new viewmodel()); </script> you need obtain value inside arrayval observable: consol

vb.net - Include empty spaces when selecting from row in Open XML -

my excel looks this b c d 1 2 3 i use this, dim row documentformat.openxml.spreadsheet.row = sheetdata.descendants(of documentformat.openxml.spreadsheet.row)().firstordefault(function(y) y.rowindex.value = 1) i 3 cells (b,c,d) in result. how include blank spaces? excel file contains cells filled addresses. empty cells "virtual". you can check address cells, "missing" cells . translate address (which in "a1" style) number index, can use function (credit: codeproject article: read , write microsoft excel open xml sdk ): dim regexcolname = new regex("[a-za-z]+", regexoptions.compiled) private function convertcellreferencetonumber(cellreference string) integer dim colletters = regexcolname.match(cellreference).value.tochararray() array.reverse(colletters) dim convertedvalue = asc(colletters(0)) - 65 = 1 colletters.length - 1 dim current = asc(colletters(i)) - 64 convert

sql - Table Join condition -

i have 2 tables table : item lookup x b null c y d k table b : lookup x y z want join these tables , output item lookup x b null c y i wanna pick matching lookup , null lookups in output view. can tell me join condition it looks want rows in a either match b or have null lookup. inner join , special condition: select distinct a.item, a.lookup tablea join tableb b on (a.lookup = b.lookup) or (a.lookup null); if have index on lookup , exists better performance: select a.item, a.lookup tablea a.lookup null or exists (select 1 tableb b b.lookup = a.lookup); edit: using left join where condition possible: select distinct a.item, a.lookup table

c# - System.Net.Sockets.SocketException while using webclient -

this question has answer here: no connection made because target machine actively refused it? 19 answers string uploadpath = "http://10.126.64.230/home/pi/videos/"; webclient webclient = new webclient(); credentialcache cc = new credentialcache(); uri uri = new uri("http://10.126.64.230/pi"); networkcredential nc = new networkcredential(); nc.domain = "root"; nc.username = "pi"; nc.password = "posix"; cc.add( uri, "ntlm", nc); webclient.credentials = cc; //system.text.encoding.ascii.getstring(responsearray); bool cntrl = system.io.file.exists(uploadpath + this.fuplvideo.filename); if (cntrl) { // filename = uploadpath + this.fuplvideo.filename + datetime.now.tostring("yyyy-mm-dd hhmmtt") + ext; // webclient.uploadfile(uploadpath, "post", fullfilepath); } else { webclient.

jquery - How can I extract the year from the datepicker() result in JavaScript? -

i not javascript , have doubt related how correcly pick date field. so page have input tag take date <input id="datatrasmissioneade" class="hasdatepicker" type="text" onchange="aggiornamentodateag(this.value)" readonly="readonly" value="" maxlength="10" name="datatrasmissioneade"> so input tag contain 25/06/2015 (and have first trivial doubt: content of input tag considered string or date in javascript?) ok, have javascript function retrieve content of previous input tag by: odatatrasmissioneade = $("#datatrasmissioneade").datepicker("getdate"); alert("data trasmissione all'ade: " + odatatrasmissioneade); the alert() function show this: data trasmissione all'ade: thu jun 25 2015 00:00:00 gmt+0200 (ora solare europa occidentale) so think, absolutly not true assertion, input tag having id="datatrasmissioneade" contains string

php - enable to send mail via PhpMailer? -

i have configure , install composer in project,i require autoload.php file file send mail.my login details correct while running application m getting smtp error: password command failed i have included detailed error below.please me sort out problem <?php require_once 'vendor/vendor/autoload.php'; $m = new phpmailer; $m->issmtp(); $m->smtpauth = true; $m->smtpdebug = 2; $m->host= 'smtp.gmail.com'; $m->username = 'suhasgawde10@gmail.com'; $m->password = '*************'; $m->smtpsecure = 'ssl'; $m->port = 465; $m->from = 'suhasgawde10@gmail.com'; $m->fromname = 'suhas gawde'; $m->addreplyto('suhasgawde10@gmail.com','reply address'); $m->addaddress('suhasgawde10@gmail.com','suhas

javascript - jQuery slide in seperate paragraphs in a common div without sliding the whole div -

so have div , in have several paragraphs. div has styling (e.g background, border) , paragraphs live "inside" div list items. <div id="box"> <p>'s in here </div> and add paragraphs via code: $("box").append("<p>some text</p>").hide().slidedown("slow"); but when add new paragraph entire div "box" gets hidden , slides down. how make last paragraph slides down? alternatively, can create paragraph jquery object hide it, append target div , since have created object seperately have reference object, using object can animate it. here sample code: var $paragraph = $("<p>another paragraph</p>").hide(); $("div").append($paragraph); $paragraph.slidedown(); here full example on js bin

fiware - Keyrock Installation -

i following manual installation steps provided here: https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/identity_management_- keyrock -_installation_and_administration_guide we not know in step "4. initial sample data" of keystone, since says should use automatic installation tools if plan use keystone fiware identity management. then, can install keyrock manually? or have through automatic tools in order use keystone fiware. thanks in advance, rafa. its hard give answer out knowing specific use case try give broad explanation. yes, can install manually if that's want. "initial sample data" step depends on how want use identity manager (or back-end part based on keystone). sample data fake data in database can right away demo or test identity manager. said, installation instructions not clear in explaining there "required data" , "testing data", try explain better here (and update wiki afterwards :) ) if w

php - Autoloading a separate, Laravel application into Lumen -

i'm writing api existing laravel application using lumen. allow api's controllers access laravel app's models, i've added laravel app git submodule, , set autoload "main" namespace via composer.json file: "psr-4": { "app\\": "app/", "main\\": "main/app/" } this works fine, wanted ask impact have on memory usage. entire laravel app being loaded memory (thus causing performance drop), or lumen app being told "where look" when main\model class referenced? thanks as process uses standard php autoloading functionality under hood, classes loaded ad-hoc if not defined, rather them each being loaded initially.

What's substantive difference between function and Object in javascript? -

when learn js @ first voice object, think maybe function object , object object too. but when learn prototype, thing different thought. function helloworld(){ this.hi = 'world'; } var foo = { 'sth':'happend' }; function bar(){}; bar.prototype = foo; console.log(new bar().sth); bar.prototype = helloworld; console.log(new bar().hi); and print happend undefined then replace bar.prototype = helloworld; bar.prototype = new helloworld(); correct result. happend world i'm newbie, maybe it's stupid question, want know what's wrong in mind? function not object? me? lot.. yes, function object, , can have properties well: var foo = {}; var bar = function(x){return x+1}; foo.prop = "hello "; bar.prop = "world!"; // works same! alert(foo.prop + bar.prop); what's substantive difference between function , object? wel

java - Is there any way to use BiConsumers as simply as Consumers? -

this theorical question no concrete application. i have following method not touch. (if possible @ all) used biconsumer . void dosmallthing(a a, b b) { // , b. } void dobigthing(list<a> as, b b) { // do? } how can iterate on as while keeping b constant , use this::dosmallthing in dobigthing ? of course following doesn't work. void dobigthing(list<a> as, b b) { as.stream() .foreach(this::dosmallthing); } the following works nice , use everyday. void dobigthing(list<a> as, b b) { as.stream() .foreach(a -> dosmallthing(a, b)); } the following works well, bit more tricky. consumer<a> dosmallthingwithfixedb(b b) { return (a) -> dosmallthing(a, b); } void dobigthing(list<a> as, b b) { as.stream() .foreach(dosmallthingwithfixedb(b)) } but of solutions don't simplicity of consumer case. there simple exists biconsumer ? you want "bind" function argument. unfortunately there's no bu