Posts

Showing posts from June, 2014

How can I read date and time data from RTC of sim900 module using arduino? -

#include "sim900.h" #include <softwareserial.h> #include "sms.h" smsgsm sms; boolean started=false; int count = 0; void setup() { pinmode(5, input); // input pin switch serial.begin(9600); if (gsm.begin(2400)) { serial.println("\nstatus=ready"); started=true; } else serial.println("\nstatus=idle"); delay(1000); } void loop() { if (digitalread(5)==1) { delay(500); if (digitalread(5)==1) { count = count+1; /*if(started) { if (sms.sendsms("+12345678", "alarm")) serial.println("\nsms sent ok"); }*/ serial.println("count = "); serial.println(count); readtime(); serial.println(content); } } else { serial.println("normal"); } } i use sim 900 arduino detect change of input pin 5 , alarm user. have few question need

java - Can I have a Jersey ParamConverter for a List of PathSegments? -

i have data type gets created pathsegment (i have list of them), , i'd use paramconverter binding, seems able convert string , , there doesn't appear way have convert pathsegment . i know can have jersey inject relevant list<pathsegment> , can process there, hoping able use same mechanism binding request values. does know if jersey supports this, and, if so, mechanism able bind against more string s?

sql server - SQL Query Remove Part of Path/Null -

Image
so new whole sql query business need 2 issues. goal have in column "environmentname" has word "database" in column "nodename" displayed in query results. did [backbone_aspider].[dbo].[vw_cfgsvr_con] nodename = 'database' order environmentname asc nodepath results of query: i able query results remove rows null . have tried use "is not null" sql server management studio labeles " incorrect syntax ." what have tried: from [backbone_aspider].[dbo].[vw_cfgsvr_con] nodename = 'database' order environmentname asc not null nodepath thank in advance! your query pretty close.. 1: have specify specific column not null while using not null. modify query to: from [backbone_aspider].[dbo].[vw_cfgsvr_con] nodename = 'database' , environmentname not null order environmentname asc nodepath 2: check out article trimming parts of strings query results http://basitaalishan.com/2014/02/2

javascript - Passing a response callback via promise between background and content script? -

this question has answer here: chrome extension message passing: response not sent 3 answers i'm trying inject html template dom of webpage via content script. prefer keep html files in own folder within extension easy maintain. means in order inject template, content script have message background, background send request appropriate folder , return retrieved template via callback. however, content script isn't receiving response background page. contentscript.js chrome.runtime.sendmessage({action: "template request"}, function(response) { //this should html console.log(response) //hi, <div>template!</div> }); background.js chrome.runtime.onmessage.addlistener(function(request, sender, response) { //ignore non-template requests if (request.action !== "template request") return; //start ajax promis

regex - Regular expression to get last occurence until next char -

i trying work out regular expression , stuck - can help. i have string: "this string [flag no match] should match [flag this] dont want [no no]" i want capture last occurance of flag enclosed in brackets. tried this: \[flag(?!.*\[flag)(.*)\] i there, matches last "]" in string. how can match next "]" following match. want match this : "this" get this : "this] dont want [no no" hope can help. thanks make * non-greedy, \[flag(?!.*\[flag)(.*?)\] or \[flag(?!.*\[flag)\s*([^\]]*)\] demo

ruby - How to load a ERB, edit and save it to the disk using Rails and ERB -

ok, imagine have template file: <virtualhost *:80> <%= "servername #{@user[:domain]}" %> <%= "serveralias #{@user[:domain]}" &> documentroot "/my/app/path" errorlog <%= "/private/var/log/apache2/#{@user[:domain]}-error_log" %> customlog <%= "/private/var/log/apache2/#{@user[:domain]}-access_log" %> common <directory "/my/app/path"> options indexes followsymlinks allowoverride order allow,deny allow </directory> </virtualhost> and load file, replace variable actual data , save file? i know gist of read , save files disk ruby, i'm not sure how replace variables actual data while saving it. any ideas? @foo = "world" think need erb.new("hello <%= @foo%>").result # "hello world" http://ruby-doc.org/stdlib-1.9.3/libdoc/erb/rdoc/erb.html#method-i-result

hive - Do I really need hiveserver2? -

i using hive v.0.13. i confuse function of hiveserver2. if data in hdfs, have tried use "hive" cli create external table without having hiveserver2 started hence question correct? or did miss out anything? if yes what, if not when need hiveserver2? starting in hive 0.13, hiveserver2 provides support sending thrift rpc messages on http transport (hive-4752). particularly useful support proxying intermediary between client , server (for example, load balancing or security reasons). currently, can run hiveserver2 in either tcp mode or http mode, not in both. useful. ref: https://cwiki.apache.org/confluence/display/hive/setting+up+hiveserver2

excel - Fix IsNumeric Loop Bug? -

i trying fix simple loop message box won't go away until user enters integer. here code: sub platemicro() strname = inputbox(prompt:="enter number of wells in plate. default 96 (8x12).", _ title:="plate setup", default:="96") dim wellcount object dim numericcheck boolean numericcheck = isnumeric(wellcount) if isnumeric(wellcount) range("a1").value = wellcount 'enter number of plate wells selected template. else: strname = inputbox(prompt:="you must enter integer. enter number of wells in plate. default 96 (8x12)." _ , title:="plate setup", default:=userdefaultchoice) end if end sub consider: sub intcheck() dim var variant var = "whatever" while not isnumeric(var) var = application.inputbox(prompt:="enter integer", type:=2) wend msgbox "thanks!" end sub this allow exit if touch cancel

parsing XML file in PHP easiest way -

i'm searching easiest way values xml file using php. <?xml version="1.0" encoding="utf-8"?> <oscam version="1.20-unstable_svn build r10649" revision="10649" starttime="2015-05-27t06:41:07-0400" uptime="710700" readonly="0"> <reader label="sky" status="off" caid="09c7"> <emmstats totalwritten="0" totalskipped="0" totalblocked="0" totalerror="0"> <emm type="unknown" result="error">0</emm> <emm type="unique" result="error">0</emm> <emm type="shared" result="error">0</emm> <emm type="global" result="error">0</emm> <emm type="unknown" result="written">0</emm> <emm type="unique" result="writte

javascript - jsonp : Uncaught SyntaxError: Unexpected token < -

i need load aspx page returns string of text using jsonp since cross domain call. target page loaded inside div tag , displayed modal window on source page. i using test form pass 3 parameters target page expects, submit button, simple. when submit page, error message: uncaught syntaxerror: unexpected token < when click on error see error points line: <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> this first time working json/ jsonp, , not sure how fix error. possible figure out? my invoking page: <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> $(function () { $("#dialog").dialog({ autoopen: false, modal: true, title: "details", buttons: { clos

Signalr client methods not called consistently when deployed to IIS -

i stumped on one, have page using collect data on methods being called in web application. when run application visual studio, there no problem, works great, server , client methods function expected. however, when deploy application webserver running iis 7.5 on windows server 2008, r2 sp1 client side methods not consistently fire, looks running fine. triggering client event never happens. client side javascript: var nlog = $.connection.centralhub; $.connection.hub.logging = true; $(function () { var logtable = $("#logtable"); nlog.client.logevent = function (datetime, sitename, clientconid, loglevel, message, stack, emessage) { var tr = $("<tr>"); tr.append($("<td>").text(datetime)); tr.append($("<td>").text(sitename)); tr.append($("<td>").text(clientconid)); tr.append($("<td>").text(loglevel)); tr.append($("<td style='wh

node.js - Gulp task for multiple files -

i'm trying create gulp task creates (in case minifies) css file every project css there is. project should combine , minify following files: global.projecta.css tool1.projecta.css tool2.projecta.css it needs kind of loop or something...? if there new project d, should build too. if need add "projectd" array, ok too. this directory structure css ./global.projecta.css ./global.projectb.css ./global.projectc.css ./addons/tool1.projecta.css ./addons/tool2.projecta.css ./addons/tool1.projectb.css ./addons/tool2.projectb.css ./addons/tool1.projectc.css ./addons/tool2.projectc.css this not working task // not working.... gulp.task('css', function() { return gulp.src(['global.*.css', 'addons/tool*.css', '!*.min.css']) .pipe(concat('build.css')) .pipe(rename({suffix: '.min'})) .pipe(minifycss()) .pipe(gulp.dest('build/css')); }); you try this, although requires manually en

javascript - Prevent Area Tag Page Reload on Angular Ng-Click -

i've got image associated link map. 1 area tag have in there has ng-click on it. currently, when click ng-click, function links runs, page reloads. how prevent page reloading in process? i've added $event.stoppropagation() prevent page reload , it's not working reason. here's html: <div ng-app="programapp" ng-controller="programcontroller"> <img src="http://placehold.it/350x150" usemap="#testmap"> <map name="testmap"> <area shape="rect" coords="0,0,350,150" href="" ng-click="slideclick($event)"> </map> </div> and angular: angular.module('programapp', [ 'programapp.controllers', ]); angular.module('programapp.controllers', []) .controller('programcontroller', ['$scope', function($scope){ $scope.slideclick = function($event){ $event.stoppropagation();

Is CHANGE_WIFI_MULTICAST_STATE permission and use of WifiManager.MulticastLock required to receive multicast packets on Android? -

i have test app i'm using demonstrate whether or not multicast traffic making android device. i'm seeing behavior appears contradict google's documentation here , here implies 2 prerequisites need in place in order app receive multicast traffic: acquire multicastlock add change_wifi_multicast_state permission app's manifest my app able receive multicast traffic without either of these items in place. below code snippet sets multicast socket receiving data. multicastsocket multicastreceivesocket = new multicastsocket( 18200 ); multicastreceivesocket.joingroup( inetaddress.getbyname( "232.232.232.232" ) ); byte[] buffer = new byte[ 65536 ]; datagrampacket packet = new datagrampacket( buffer, buffer.length ); multicastreceivesocket.receive( packet ); should happening? should able receive multicast packets without either of 2 prerequisites in place? noticed multicastlock documentation says: normally wifi stack filters out packets not exp

c - Topic 1.6 by Kernighan and Ritchie -

i going through book "the c programming language" kernighan , ritchie , stuck @ topic. topic number 1.6 talks arrays. in book, have included program counts digits, white spaces , other characters. program goes this: #include <stdio.h> main(){ int c,i,nother,nwhite; int ndigit[10]; nwhite=nother=0; for(i=0;i<10;++i) ndigit[i]=0; while((c=getchar())!=eof) if (c>='0' && c<='9') ++ndigit[c-'0']; else if (c==' '|| c=='\t'||c=='\n') ++nwhite; else ++nother; printf("digits:"); for(i=0; i<10;++i) printf(" %d",ndigit[i]); printf(", white space = %d, other = %d\n", nwhite, nother); } first, don't understand purpose of first loop : for(i=0;i<10;++i) ndigit[i

ssas - MDX query to have a snapshoot at a given date -

i have following fact table : date item step value 2015-01-01 1 1 1.00 2015-01-01 2 1 2.00 2015-01-01 1 2 3.00 2015-01-02 1 2 4.00 2015-01-03 2 3 8.00 2015-01-05 1 3 16.00 and i'm looking script find value of items in each step @ given date. for example, date '2015-01-04' , resultset : step value 1 0.00 2 4.00 3 8.00 i'm on sql server 2008. ===== update 1 make question more understandable items can change of step can see in fact table, item in 1 , 1 step @ time. when calculate value of step, have sum value of each item present in step. if in affirmative questioned in comment above, below might - with member sumofvaluetillnow sum(null:[date].[date].currentmember, [measures].value) select sumofvaluetillnow on 0 [yourcube] ([date].[date].[2015-01-04]) or, if looking value each date, below - select sumofvaluetillnow on 0, [date].[date].children on 1 [yourcube]

rest - What information should be sent on body? -

i've been reading microservices , have doubts what's data should sent on body, , what's data should populated in server (by means of id). for example, imagine have real estate agency, , domain models agent, client , house. imagine agent submit deal has to: log in agency's system account create client's profile in system fill transaction form client data house sold click on submit (this submits data sales service) now question is, if sales service requires fields client's first , last name, client's contacts, house's address , on, should we: send required data browser, or id of house , client , service handle rest? if have restriction in system says "you can sell houses clients", how guarantee in sales service agent selling house client (how can trust data comes browser)? thanks in advance. send required data browser, or id of house , client , service handle rest? typically, if house , client aren't

windows - Run batch script with admin right on network directory -

on windows 7 mount 1 network directory using "right click on computer" "connect network drive". after this, want execute batch script using admin rights. script on network drive. so right-click on batch script , click on "execute width admin right" cmd opens , close no message. think due have mounted network drive without admin rights how can this? nb: script executes few commands installing software on network drive. you don't mount share 'admin rights'. user account has whatever rights granted server admin. if need 'execute' permissions share admin have grant account right. alternately, can mount share using different set of credentials has rights need, have given admin.

node.js - AWS Lambda: Can I return context and have a task still running? -

right have lambda function in production processes log strings , return them client, so: 1) string received lambda 2) lambda transforms string 3) lambda returns via context.succeed transformed string now adding additional step save string in dynamodb table, workflow be: 1) string received lambda 2) lambda transforms string 3) lambda saves string dynamo 4) lambda returns via context.succeed transformed string right bit saves function like: function _saveitem (item) { dynamo.putitem(item, function (err, data) { //error handling here context.succeed(json.stringify(item)); }) } i'd know if it's somehow possible fire putitem function and, without waiting end, return item via context.succeed i assume using "requestresponse" style invoke. true? if want value returned right away can invoke lambda function (using "event" invoke), , have function write ddb, , return value. the "event" invoke run async

Rename duplicate records in R -

i'd rename duplicate categories in column "product" (data$product) based on order of occurrence. below data frame: data <- data.frame(product=c("1123tr","5467yr","15-f020wm","15-f020wm","15-f020wm","15-k153cl","17-f222nr","17-f222nr"), platform=c("caribian","flare","tease","brill","kittl","moui","mouner","fourt"), value = c(200,500,550,456,678,765,34,33)) below table - how data.frame "data" looks like: product platform value 1123tr caribian 200 5467yr flare 500 15-f020wm tease 550 15-f020wm brill 456 15-f020wm kittl 678 15-k153cl moui 765 17-f222nr mouner 34 17-f222nr fourt 33 and below desired output: product platform value 1123tr caribian

java - Can we add maven plugin without attach its goal to a particular phase? -

hi new maven wondering how can use plugin without attach goal particular phase. example want use shade plugin create uber-jar(fat jar). goals overview the shade plugin has single goal: shade:shade bound package phase , used create shaded jar. so plugin has 1 goal called shade . <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-shade-plugin</artifactid> <version>2.3</version> <executions> <execution> <id>shade</id> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin> so said 'hey maven' want attach shade's plugin goal shade package lifecycle. ok if remove executions configuration. happens can maven understand put shade goal? every plugin put goals predefined creator pha

iis - How do you declare or use variables in web.config -

because our web application using both entityframework , system.data.sqlclient, need have 2 . error prone, need make update both same data. so wonder if posible add variables web.config xml? <connectionstrings> <add name="server" value="sql2014" type="variable" /> <add name="database" value="mydb" type="variable" /> <add name="username" value="sqluser" type="variable" /> <add name="password" value="kaldsommer" type="variable" /> <add name="xreport" connectionstring="data source={server};initial catalog={mydb};user id={username};password={password}" providername="system.data.sqlclient" /> <add name="xentities" connectionstring="metadata=res://*/entities.xmodel.csdl|res://*/entities.xmodel.ssdl|res://*/entities.xmodel.msl;provider=system.data.sqlcl

python - Tkinter application topmost, even over fullscreen -

i'm using tkinter on ubuntu. i'd application on top of screen, time. i'm aware of, , using, wm_attributes("-topmost", 1) . i've discovered equal right clicking on menu bar of application , selecting 'always on top', works fine applications. however, doesn't work when full-screen applications launched (specifically, tf2). in such cases, widget lies behind game. i'm aware of overrideredirect(true) , , stays on top of game on full-screen, not viable menu bar , being able move window central application. is there way have tkinter remain on top of every application, including full-screen? functionality of overrideredirect , keeping menu bar , ability move window.

ios - Xcode Property Not Retaining Value -

i have view controller called loginwindowviewcontroller.h declared property called usernametextfield: @property (strong, nonatomic) iboutlet uitextfield *usernametextfield; a string called james associated textfield. import view controller,firstviewcontroller.h loginwindowviewcontroller.m , imported loginwindowviewcontroller.h firstviewcontroller.m . in firstviewcontroller.h there property called username. @property (strong, nonatomic) iboutlet nsstring *username; then assign usernametextfield username(in firstviewcontroller.m). when nslog property username in firstviewcontroller.m, gives null value.how fix this? when import classes not import values. when set value of property set on instance of class. need explicitly reference property of current instance value have set. one note: iboutlet stands interface builder outlet , how create link storyboard or xib file ui element class property. so, no need use iboutlet if not linking in interface builder. string sh

Changing variables in java -

in following code, int = 1; int j = + 2; int = 2; would 'j' equal 2 after 'i' has been changed 2 or 'j' still equal 1? when assign value any variable in java, variable changes. in addition, these particular variables primitives, not reference types. each variable holds value, not reference object might shared among variables. also, note @gtgaxiola's observation code not compile because of second definition of i . can addressed follows: int = 1; int j = + 2; = 2; now, if variables references mutable objects, assign 2 references same object, , change object through either reference. colorrgb = new colorrgb(0,0,0); colorrgb b = a; a.r = 255; here, both a.r , b.r have value of 255, because both referring field in same object.

java - How to read jstl text from property file and display in jsp using jstl -

i need pull html text property file , display in jsp. im able read plain html text html text has <c:out> s in middle , c:out text displayed in frontend instead of out put value. sample code below. html text in property file: outage has been detected. expected restoral time<c:out value="${var1}"/> i created tld file picks property .properties file. used below format pick property <c:out value="${fnesup:pick('propertyname')}"/> can please let me know how pull text along jstl tag , display in jsp? the text diaplyed in page, instead of displaying <c:out> value. please hpw cout value while reading properties file. have imported jstl library in jsp page? <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

javascript - Browser autocomplete not allowing copy/keyup function to work -

i having issue code wrote. doing is, creating ecommerce checkout page , have 3 different sections. 1. shipping info 2. billing info 3. order confirmation info the code wrote copy written in shipping info section , show in order confirmation section farther down page, can confirm before ordering. way have it, works great if information in shipping info form typed in normally. but, if customer double clicks in 1 of input fields , allows browsers auto-complete fill in information, disables code , not show in order confirmation info part. <div class="field"> <label class="paddingleft" for="fullname">full name</label> <div class="center"> <input type="text" class="biginputbarinline preview" id="shiptofullname" data-copy="#name" name="shiptofullname" required> </div> </div> <div class="field"> <label class="

c# - Check if datareader is empty -

this question has answer here: sql data reader - handling null column values 19 answers i'm constant receive error: additional information: data null. method or property cannot called on null values. when try receive information. how can check if datareader empty. for example code: while (rd.read()) { if (rd.hasrows) { foundinformation[0] = rd.getstring(0); foundinformation[1] = rd.getstring(1); } else { foundinformation[0] = "nvt"; foundinformation[1] = "nvt"; } } how can check if rd.getstring(0) empty? thankyou. you need call isdbnull before call getstring. if (!rd.isdbnull(0)) { //... } https://m

javascript - node.js / io.js - How can I consistently log a request's flow considering domains are being deprecated? -

i've been using domains add request id logs. convenient because means don't have pass request object everywhere, can still see request context db query ran in, , can follow process each request goes throw regardless of layers in code accessed. since domains being deprecated , alternatives preserving capability ? thanks

image - convert a jpg file to UTF-8 without making it corrupt -

i have .jpg file encoded ansi, tried converting utf-8 made image corrupt. note: if have solution other image format, please post them. i can suggest base64 encoding, enconde files in text you. though not familiar algorithm itself, can present several websites you: https://www.base64-image.de/ http://www.askapache.com/online-tools/base64-image-converter/ http://www.dailycoding.com/utils/converter/imagetobase64.aspx adidtionaly, can use such images in own website adding them html. following answer has information regarding method: embedding base64 images

android - Always Status Code is coming 401 -

i doing 1 form post basic authentication status code coming 401. httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); multipartentitybuilder builder = multipartentitybuilder.create(); builder.setmode(httpmultipartmode.browser_compatible); builder.addpart("picture", new filebody(new file(picture))); builder.addtextbody("firstname", firstname); builder.addtextbody("lastname", lastname); string base64encodedcredentials = "basic " +base64.encodetostring((username+":"+password).getbytes(), base64.no_wrap); log.d("authorization", base64encodedcredentials); httppost.setheader("authorization", base64encodedcredentials); httppost.setentity(builder.build()); httpresponse httpresponse = httpclient.execute(httppost); httpentity httpentity = httpresponse.getentity(); but it's working in browser (advance rest client), please kindly go through c

wpf - How exactly do I set up Entity Framework to work with DB2 -

we running on db2 9.7. wrote wpf app uses ef 5 connect mssql dev server. need switch use db2 server. i have new connection string, provider name giving me trouble. keep getting exceptions when trying execute queries provier not registered or not installed. my connection string located in app.config file such: <add name="timscontext" connectionstring="database=db2c;uid=myuser;pwd=mypwd;server=mvsdevl:446;" providername="ibm.data.db2" /> needed change app compile x86 right drivers...

json - How to work with $http.jsonp -

i using below code json data ma getting success ,200 status , repsonse in network tab of browser (developer tools) have put break point going error , ma gettinf 404 status , undefined data can please me in this var url = 'http://xx.xx.xx.xx:8084/api/users/current/?callback=json_callback'; $http.jsonp(url,{ withcredentials: true}) .success(function(data) { console.log(data); }) .error(function(data) { console.log(data); });

c# - Remotely calling a script to run on client machines -

i need have asp.net mvc application written in c#. have network of thin clients connect app via ie 11. need know how can following: i need add code application on server allow connect each thin client (i have ip's) , execute remote script on network drive cause ie restart. how accomplish this?

mysql - How to join results of 2 tables based on not condition -

i have 2 tables, tablea & tableb defined this: create table tablea(id int, name varchar(20), partnumber varchar(30)); with values as: insert tablea values(1,'a1','10'); insert tablea values(2,'a2','20'); insert tablea values(3,'a3','30'); insert tablea values(4,'a4','40'); create table tableb(id int, name varchar(20), partnumber varchar(30)); insert tableb values(5,'b1','10'); insert tableb values(6,'b2','20'); insert tableb values(7,'b3','60'); insert tableb values(8,'b4','70'); now in result want join both tables , records tableb , records tablea tablea's partnumber column value not matching value of tableb's partnumber . i have tried below queries , of them gave same result of 14 records not correct. query 1 : select b.id bid, b.name bname, b.partnumber bpart, a.id aid, a.name aname, a.partnumber apart t

javascript - Typescript js.map files loaded by the browser using a wrong path -

Image
i don't understand why browser trying load js.map files using wrong path. here have in <head> html part: here tries load: what's wrong tries load file inside folder assets , doesn't exist. right path scripts/widget/spinner.ts . i can access files directly using right path , works (by url), also, js files correctly loaded. so guess .js.map files references somehow wrong path related ts (i don't know how works behind scene). here spinner.js.map file's content: {"version":3,"file":"spinner.js","sourceroot":"","sources":["../../../assets/scripts/widget/spinner.ts"],"names":["payline","payline.spinner","payline.spinner.constructor","payline.spinner.spin","payline.spinner.getspinnerlibrary","payline.spinner.autorun","payline.spinner.hide","payline.spinner.show"],"mappings":

android - SQLite Auto Increment in java code not working properly -

my project group , running unusual error. working on app , use local database created in java code, using android studio 2.1.1.1. sadly when create account not auto increment user_id, in fact returns value "0" (without quotation marks) there error in our cursor? there error in our creation of sqlite database? far know integer primary key default auto increment. private static final string table_create_user = "create table " + user_table + " (" + user_id + " integer primary key," + username + " varchar(200) null, " + name + " varchar(200) null, " + email + " varchar(200) null, " + phonenumber + " varchar(200) null, " + business + " varchar(200) null, " + bio + " varchar(200) null, " + hasstartup + " varchar

oop - Referring to Objects by an ID? (Java) -

i'm not java-newbie can't head around problem occured recently. i have simulate road system in java. sake of proper oop, i've got class car , class street (and several others manage whole simulation of course^^). managed simulate jam on 1 road , have had no problem doing so. ok, here comes question: want extend simulation 1 lonely street road system. thought of class called "roadsystem" might have array of streets , sort of connection (i thought of 'knots') allowing cars know can drive reach end of street driving on. the problem have no idea how implement these knots. car has able ask street "hey bro, i'm @ end of you, can drive now?" , street should somehow know knot has reference , ask streets connected particular knot. how do reference? thought of id might extremely slow bigger road systems if street has search through street-ids of every knot in order find own id there. or missing obvious solution problem? every highly appreci

c# - Invalid input - format string ASP.NET -

hello i'm quite new in asp.net programming dropdownlist code: protected void dropdownlist1_selectedindexchanged(object sender, eventargs e) { sqlconnection test = new sqlconnection("data source=michaŁ-komputer;initial catalog=projektnet_s10772;integrated security=true"); sqlcommand com; string str; test.open(); str = "select * klient klient_id='" + dropdownlist1.text.trim() + "'"; com = new sqlcommand(str, test); sqldatareader reader = com.executereader(); if (reader.read()) { txtimie2.text = reader["imie"].tostring(); txtnazwisko2.text = reader["nazwisko"].tostring(); txtemail2.text = reader["adres_email"].tostring(); txttelefon2.text = reader["telefon"].tostring(); txtmiasto2.text = reader["miasto"].tostring(); reader.close(); test.close(); } } update code protected void btnedytuj1_cli

java - How to show specific scrollpane in a CardLayout? -

i have list of jpanel components. want open corresponding panel based on clicking button. while clicking button, pass panel name. in case panel have more components, adding each panel jscrollpane , adding these scroll panes cardlayout . based on example , here code adding panel card layout: final jpanel cards=new jpanel(new cardlayout()); cards.setpreferredsize(new dimension(600, 550)); (jpanel p:panels) { jscrollpane scrollpanel=new jscrollpane(p); scrollpanel.setname(p.getname()); scrollpanel.sethorizontalscrollbarpolicy(jscrollpane.horizontal_scrollbar_as_needed); scrollpanel.setverticalscrollbarpolicy(jscrollpane.vertical_scrollbar_as_needed); cards.add(scrollpanel); } cardlayout cardlayout=(cardlayout) cards.getlayout(); cardlayout.show(cards, "name"); control.add(new jbutton(new abstractaction("\u22b2prev") { @override public void actionperformed(actionevent e) { cardlayout cl = (cardlayout) cards.getlayout(

How to get a id from a url using SQL QUERY. The ID changes dynamically. the database is Sql server 2008 -

i have url like: http://mysites.xyz.com/_layouts/ng/activitystream.aspx/id/2624d92223261d370d7287c9e83caeea/activity%20stream%20post. i need 2624d92223261d370d7287c9e83caeea. not able so. current query substring(@url2,len('http://mysites.xyz.com/_layouts/ng/activitystream.aspx/id/'),len(@url2)-len('http://mysites.xyz.com/_layouts/ng/activitystream.aspx/id/')- charindex('/',reverse(@url2)))) please suggest. try this: select substring( @url2, charindex('/id/', @url2)+4, charindex('/', @url2, charindex('/id/', @url2)+5) - (charindex('/id/', @url2)+4)) note: assumes id followed @ least 1 more slash. breakdown: first argument of substring string contains full expression. second 1 first index after /id/ . third 1 desired length - calculated first index of / after /id/ - first index after /id/ . update to cope strings not contain slash after id value, use case: select

javascript - drawImage() with wrong coordinates canvas -

i have problem: i'm working on map generator, using html canvas, user inputs x,y, width , height of image. when use drawimage users input, image doesn't fit canvas xy , select height , width in pixels. there can use solve this? <html lang=''> <head> <title>map tools</title> </head> <body> <div align='center'> <canvas id='map' class='mapcanvas' width="800" height="400"> </canvas> <p><a href="#" onclick="loadxml()" class="submitbutton">send</a></p> <textarea id="xmlinput" class="inputtextarea" placeholder="coords"></textarea> </div> </body> <script> function loadxml(){ co = document.getelementbyid("xmlinput").value.split(',') // x, y, h, l canvas = document.getelementbyid("map"); context

postgresql - Move RDS instance from EC2-Classic to VPC -

i migrating production system ec2-classic vpc platform. all done except rds instance, still in ec2-classic. original plan migration downtime: shutdown instances, take database snapshot, create new instance in vpc snapshot (rds "restore snapshot" feature). unfortunately when tried realized cannot restore type of instance want. when click "restore" amazon offers me limited number of options: expensive db.m3, db.r3 instances previous generation db.t1, db.m1, db.m2 instances ideally i'd create db.t2 instance, possible somehow? also, there way migrate 0 downtime? far i've found nothing in amazon docs.

jquery - Bootstrap Carousel Indicators Color change for 1 slide -

i using default bootstrap carousel. 1 of slides has white background carousel indicators disappear on slide. have javascript/jquery solution works, seems tiny bit slow/clunky. either improve script or alternative solution, appreciated. $('#carousel-generic').on('slid.bs.carousel', function (evt) { var elem = $(this).find('.carousel-indicators li'); var active = $(this).find('.carousel-indicators .active'); if(active.index() == 2) { elem.css('border-color', 'grey'); elem.css('background-color', 'rgba(0,0,0,0)'); active.css('background-color', 'grey'); } else { elem.css('border-color', 'white'); elem.css('background-color', 'rgba(0,0,0,0)'); active.css('background-color', 'white'); } }) since know 1 need change (hence index() ), create css styles it .carousel .carousel-indicato

Swift - displaying data for each row in tableview after row is clicked -

Image
having problems displaying data each row in tableview after row clicked, , want use didselectrowatindexpath, not without it! :) viewcontroller.swift import uikit class viewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource { @iboutlet weak var tableview: uitableview! let texttodisplayincell:[string] = ["item 1", "item 2", "item 3", "item 4"] let textdataforeachrowwhenclicked:[string] = ["first item", "second item ", "third item", "fourth item"] override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. self.tableview.delegate = self self.tableview.datasource = self } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } func tableview(tableview: uitableview, numberofrowsinsection section: int) -> i

html - Flexbox center not working in safari -

i'm having little trouble centering divs using flexbox, in safari. thought may lacking -webkit- seems safari needs -webkit- only? here code far, both classes child of .alltext can called within same javascript. <div class ="container"> <div class = "alltext textone"> <p>text here</p> </div> <div class = "alltext texttwo"> <p>text here</p> </div> </div> css: .alltext { color: black; display: hidden; } .centertext { margin-right: none; margin-left: none; display: flex; display:-webkit-flex; display:-webkit-flexbox; display:-ms-flexbox; align-items: center; justify-content: center; width: 100%; height: 100%; vertical-align: center; position: fixed; top: 0; margin: auto; margin-top: 0; } .textone { position: relative; max-width: 95%; text-align: center; font-size: 6em; } .texttwo { width: 85%; text-align: center; font-size: 6em; } thank

osx - linux move files inside sub folder to current directory -

hi need command linux , mac os move files subfolders current one. i have main folder (04) containing other folders ex. 01145032 contains jpgs , other files. have move files in 04 folder thanks you can use find command: cd 04 find . -type f -mindepth 2 -exec mv '{}' . \; -mindepth 2 make sure files sub directories found.

java - How to make available Oracle 11g database on one PC to another PC -

i have created java eclipse app database tables oracle 11g. works fine in local pc. how can make these tables work pc? maybe have put them in application folder? app connected db via jdbc connector. the connection logic follows: try { class.forname("oracle.jdbc.driver.oracledriver"); } catch (classnotfoundexception e) { system.out.println("unable load driver class!"); } string url = "jdbc:oracle:thin:@localhost:1521:xe"; string user = "system"; string password = "xxxxpw"; connection connection = null; try { connection = drivermanager.getconnection(url, user, password); system.out.println("connection succeed!!"); } catch (sqlexception e) { system.out.println("couldn't take connection!"); } you have 2 options oracle 11g , alternative oracle 11g. the first use pc or other pc database host , have other instance of application reference databases on database host. may require ch

Error when loading HDF files into R -

i trying use hdf data of chlorophyll levels in r, have package rhdf5 installed , running yet when try , load hdf data in lines of errors. here code using library("rhdf5") library(maps) june_data<-h5ls('./data/june chloro level.hdf') june_data the error produces is hdf5-diag: error detected in hdf5 (1.8.7) thread 0: #000: h5f.c line 1522 in h5fopen(): unable open file major: file accessability minor: unable open file #001: h5f.c line 1313 in h5f_open(): unable read superblock major: file accessability minor: read failed #002: h5fsuper.c line 334 in h5f_super_read(): unable find file signature major: file accessability minor: not hdf5 file #003: h5fsuper.c line 155 in h5f_locate_signature(): unable find valid file signature major: low-level i/o minor: unable initialize object hdf5: unable open file error in h5checktypeoropenloc(file, readonly = true) : error in h5checktypeoropenloc(). file './data/june chloro level.hdf' not valid hdf5 file. i