Posts

Showing posts from April, 2011

c# - Create and manage database in visual studio 2013 -

i'm learning basics of asp.net , visual studio 2013. teacher has given me assignment create basic student registration form , when student clicks submit, data should uploaded database. and there should option display submitted data in single table in webpage. i've created basic web form don't know how create , connect database. using php, create mysql connection , use sql queries rest. how do in asp.net , sql server? ps. i'm using sql server 2012 , visual studio 2013 community edition. any appreciated. you have number of options here. recommend based on appears limited experience tool entity framework https://msdn.microsoft.com/en-us/data/ef.aspx or nhibernate http://nhibernate.info/ sufficient. benefit of these tools can generate entire database model or vs versa. nhibernate might little more complex setup go entity framework. google samples, there should plenty! if familiar php similar such tool doctrine http://www.doctrine-project.org/ h

Is there any formula to create a hyperlink in an excel to another sheet? -

here need do. i have excel workbook many sheets. need work on 2 sheets- attributes_master , domain_details. both have field in commmon - domain not in same order. i need add hyperlink in domain column of attributes_master domain column of domain_master. there around 50,000 entries in column. i know can know cell address in domain_master using match() function. shortcut hyperlink done quickly? the excel hyperlink() function takes string arguments. can build string arguments concatenating different elements. a concrete formula bit hard without knowing workbook structure. assuming want link cell on domain_master sheet, , assuming column "domain" in column on both sheets, try along lines of =hyperlink("[linkdemo.xlsx]domain_master!a"&match(a2,domain_master!a:a,0),"click here") adjust reflect workbook file name , column structure.

c# - EasyNetQ/RabbitMQ - Publishing a message based on topic -

Image
i have created subscriber in easynetq/rabbitmq topic. think have atleast because can see there binding under queue name. looks following : the queue name random guid. don't think matters. however when try , publish message via easynetq : await _bus.publishasync(new message<byte[]>(memorystream.toarray()), "queuecallback"); the message never gets published onto above queue. worked out. i publishing inside message wrapper, subscribing byte array only. if routing key same, if object type not exact match never routed.

How can I make my Objective-C class conform to Swift's `Equatable` protocol? -

i have objective-c class (that happens button, not important), , @ part of (mixed language) project, have array of these buttons , i'd index of button using find() method. so: func dosomethingwiththisbuttonindex(index:int) { let buttons = [firstbutton, secondbutton, thirdbutton] if index == find(buttons, firstbutton) { // we've selected first button } } but i'm getting type 'implicitlyunwrappedoptional' not conform protocol equatable okay, lets go objective-c , have buttonthing implement <equatable> . doesn't recognize that. so do? i'm building around it, forcing array nsarray , using indexofobject . ugly. , frustrating. first, in swift write custom == operator function class. second, in swift, write class extension adds equatable protocol conformance. perhaps, example: func == (lhs: yourclass, rhs: yourclass) -> bool { // whatever logic necessary determine whether equal return lhs

java 8 - JTDS 1.3 connection issue with java8 x64 -

i following error when trying use jtds 1.3 + jdk1.8(64) on windows 7. exception in thread "main" java.lang.runtimeexception: error initializing desengine @ net.sourceforge.jtds.util.desengine.init(desengine.java:76) @ net.sourceforge.jtds.util.desengine.<init>(desengine.java:51) @ net.sourceforge.jtds.jdbc.ntlmauth.answerlmchallenge(ntlmauth.java:52) @ net.sourceforge.jtds.jdbc.tdscore.sendntlmchallengeresponse(tdscore.java:2179) @ net.sourceforge.jtds.jdbc.tdscore.login(tdscore.java:613) @ net.sourceforge.jtds.jdbc.jtdsconnection.<init>(jtdsconnection.java:369) @ net.sourceforge.jtds.jdbc.driver.connect(driver.java:183) @ java.sql.drivermanager.getconnection(unknown source) @ java.sql.drivermanager.getconnection(unknown source) @ test4.test4.main(test4.java:15) caused by: java.security.nosuchalgorithmexception: des secretkeyfactory not available @ javax.crypto.secretkeyfactory.<init>(secretkeyfactory.java:12

python - How to add comments feature to posts in a flask web application -

i developing web application flask.i confused how add comment feature posts in web application. parts of database models give below class post(db.model): id = db.column(db.integer, primary_key = true) title = db.column(db.string(140)) body = db.column(db.string(2000)) timestamp = db.column(db.datetime) user_id = db.column(db.integer, db.foreignkey('user.id')) comments = db.relationship('comment', backref='title', lazy='dynamic') def get_comments(self): return comment.query.filter_by(post_id=post.id).order_by(comment.timestamp.desc()) def __repr__(self): return '<post %r>' % (self.body) class comment(db.model): id = db.column(db.integer, primary_key = true) body = db.column(db.string(140)) timestamp = db.column(db.datetime) post_id = db.column(db.integer, db.foreignkey('post.id')) def __repr__(self): return '<post %r>' % (self.body)

javascript - What does the double colon mean in Scope Local variables in Chrome's debugger? -

Image
see screen dump fragment below. notice there 2 colons between legend , object (legend field of ptd). double colon mean? my problem if test value of ptd.legend, 'undefined'. shouldn't be... it means property name string "legend:". can tell syntax highlighting. for example: obj['legend:'] = 'value';

java - Accessing shared preferences in a non-activity class from fragment class -

i have fragment: public class todayverse extends fragment { textview textview; dailyquranmethods dailyquranmethods; public todayverse() { // required empty public constructor } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view view = inflater.inflate(r.layout.fragment_today_verse, container, false); textview = (textview) view.findviewbyid(r.id.verse); // setchapterverse(); textview.settext(dailyquranmethods.getversetoday(dailyquranmethods.datetoday(),getactivity().getapplicationcontext()) + "\nchapter:" + dailyquranmethods.getchaptertodayname(dailyquranmethods.datetoday(),getactivity().getapplicationcontext())); return view; } } this fragment calls non-activity class : dailyquranmethods uses sharedprefrences. purpose, had pass context parameter. passed:

voltrb - Changing <head> ection with Volt -

i've started playing volt, , looked on docs, couldn't find answer: i want add viewport meta tag on project's section, can't find out how alter it. could shed light on issue? yea, can change config/base/index.html renders @ earlier stage right now, can't bindings. (it's rendered erb right now) have ability render templates strings, plan make of initial rendering process done volt templates. haven't gotten around yet :-)

Pass img src to android view? -

i using volley json data. how use image src populate imageview? below response json data dribbble. http://api.dribbble.com/shots/everyone ? the data give me image source "image_url":"https://d13yacurqjgara.cloudfront.net/users/24831/screenshots/2112992/2015-06-18_19.51.18_copy.jpg" how can use image source inside imageview // build array jsonarray shots = response.getjsonarray("shots"); list<string> titles = new arraylist<string>(); (int i=0; < shots.length(); i++) { jsonobject post = shots.getjsonobject(i); string title = post.getstring("title"); titles.add(title); } // can see taking data , turning strings.. string[] titlearr = new string[titles.size()]; titlearr = titles.toarray(titlearr); // set adapter listadapter dribbblefeedadapter = new arrayadapter<string>(mainactivity.this, r.layout.feed_card,r.id.info_text,titlearr); // set listview listview dribbbledatalistview = (listview) fi

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. there variety of reasons script appears not sending emails. it's difficult diagnose these things unless there obvious syntax error. without 1 need

linux - bash cut columns to one file and save onto the end of another file -

i cut 2 columns 1 file , stick them on end of second file. 2 file have exact same number of lines file1.txt 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 file2.txt b c d e f g h j b c d e f g h j b c d e f g h j b c d e f g h j so far have been using cut -f9-10 file2.txt | paste file1.txt - > file3.txt which outputs want 1 2 3 4 5 6 7 8 9 10 j 1 2 3 4 5 6 7 8 9 10 j 1 2 3 4 5 6 7 8 9 10 j however don't want have make new file prefer alter file 1 above. i've tried cut -f9-10 file2.txt | paste file1.txt - but prints on screen. there way of adding columns 9 , 10 end of file1.txt? use sponge moreutils ! allows soak standard input , write file . is, replace file in-place after pipe. cut -f9-10 file2.txt | paste file1.txt - | sponge file1.txt note can doing using paste process substitution . $ paste -d' ' file1.txt <(

Change starting coordinate for svg line drawing? -

http://codepen.io/stevendavisphoto/pen/dovolo <svg xmlns="http://www.w3.org/2000/svg" height="223.5px" width="432.7px" viewbox="-1 -1 433.7 225.5"> <path d="m341.6,95.3c3.4-62.2-66.9-96.3-112.5-62.7c173.7-34.9,70.7,10.7,79.5,94.4c17.8,93.4-26.4,166,18,223.5 l396.4,0c461.3,162.7,410.9,85.8,341.6,95.3" stroke="#fff" stroke-width="2" fill="none" stroke-dasharray="" stroke-dashoffset="0.00"></path> </svg> the direction of drawing fine, i'd start lower left point, not random point in right middle. can show me how fix it? the path starts definition says - whatever point artist started from. the general solution load image vector editor , rearrange path components - or redraw path - starts want. if path simple enough, , familiar how svg path definitions work, can hand. have done below. otherwise need use vector edito

php - Get Hyphenated column values in Laravel -

i'm trying hyphenated column values in laravel application. i'm not able it. $result->reference works fine. but when try $result->product-id returns undefined property: stdclass::$product when tried $result->{'product-id'} object of class stdclass not converted string how can value? this should work: $result->getattribute('product-id');

c# - unity3d webplayer how to display all facebook user photos -

i new in facebook integration in app log in through facebook, but, want to, facebook user photos display them scene in unity have search web, find nothing, please can give me example guide me in right path? it's been week , did not find solution. these scripts first script using system.collections; using system.collections.generic; using unityengine; using facebook.minijson; public class util : scriptableobject { public static string getpictureurl(string facebookid, int? width = null, int? height = null, string type = null) { string url = string.format("/{0}/picture", facebookid); string query = width != null ? "&width=" + width.tostring() : ""; query += height != null ? "&height=" + height.tostring() : ""; query += type != null ? "&type=" + type : ""; if (query != "") url += ("?g" + query); return url; } public static void friendpictureca

java - Index out of bounds, but not? -

i have no idea how happening, maybe i'm missing simple. i trying remove first index if exists code this: arraylist<string> historyvalues = new arraylist<string>(); arraylist<string> historylabels = new arraylist<string>(); some_big_process_which_populates_array() if(historylabels.size() >= 1 && historyvalues.size() >= 1 ){ historylabels.add("not enough data yet"); historyvalues.add("0.0"); }else{ log.v("history_values", historyvalues.tostring()); historyvalues.remove(0); historylabels.remove(0); } and error. how empty array getting past size() checks? 06-18 15:36:53.208 1510815108/com.rainforestautomation.android.energyvue v/history_values﹕ [] 06-18 15:36:53.208 15108-15108/com.rainforestautomation.android.energyvue d/androidruntime﹕ shutting down vm 06-18 15:36:53.209 15108-15108/com.rainforestautomation.android.energyvue e/androidruntime﹕ fatal exception: main process: com.

android - How to do auto-rotation for video playback for an AR app in Unity and Vuforia written in C#? -

i working on unity version of video playback sample. have added video playback event handler script in inspecter , checked m full screen mode. default orientation landscape right. trying achieve auto rotation on full screen playback when turn device, changes orientation , on. have tried suggestions regarding problem, such tinkering player settings etc. didn't work. my second problem button in navigation bar. when video playing, have press button twice go camera. want kill full screen playback press button. how this. i have tried tinkering following code (videoplaybackuieventhandler.cs): /*============================================================================== * copyright (c) 2012-2014 qualcomm connected experiences, inc. rights reserved. * ==============================================================================*/ using unityengine; using system.collections; using vuforia; /// <summary> /// ui event handler class handles events generated user-tap a

python - blocking read(1) with timeout in pyserial -

i use following piece of code read serial port until terminating character. """read until see terminating character timeout""" response=[] byte_read='' break_yes=0 time_now = time.clock() while ((not (byte_read=='\r') ) , (break_yes==0)): byte_read = self.ser.read(1) if (not(len(byte_read)== 0) , (not (byte_read =='\r'))): response.append(byte_read) if ( time.clock() - time_now > 1 ): if self.debug_flag: print "[animatics motor class] time out occured. check code" break_yes=1 if break_yes==0: return ''.join(response) else: return 'fail' this works because of while loop, cpu resources taken up. i think having blocking read(1) timeout save of cpu. flag looking c "min == 0, time > 0 (read timeout)" in termios i looking similar flag in python. i use io.readline

Connecting to SQL Server to run a procedure -

i trying connect sql server call procedure set me filling , updating table have. don't know how go connecting or linking external server. in mysqlworkbench. how start please? thanks keith if trying connect sql server can using sql server management studio (ssms) . if have installed sql server on machine ssms has been installed in machine. else can use sql server installer , install client tool include ssms; using can connect sql server instance inside/outside network. here download link same it's express version http://www.microsoft.com/en-in/download/details.aspx?id=8961

Passing Elasticsearch and Kibana config file to docker containers -

i have found docker image devdb/kibana runs elasticsearch 1.5.2 , kibana 4.0.2 . pass docker container configuration files both elasticsearch (i.e elasticsearch.yml) , kibana (i.e config.js) can image itself? or have build separate docker container? can image itself? yes, use docker volumes pass in own config files let have following files on docker host: /home/liv2hak/elasticsearch.yml /home/liv2hak/kibana.yml you can start container with: docker run -d --name kibana -p 5601:5601 -p 9200:9200 \ -v /home/liv2hak/elasticsearch.yml:/opt/elasticsearch/config/elasticsearch.yml \ -v /home/liv2hak/kibana.yml:/opt/kibana/config/kibana.yml \ devdb/kibana i able figure out looking @ image dockerfile parents are: devdb/kibana → devdb/elasticsearch → abh1nav/java7 → abh1nav/baseimage → phusion/baseimage , taking peek devdb/kibana container: docker run --rm -it devdb/kibana find /opt -type f -name *.yml . or have build separate docker con

Visual Studio 2013 Configure Remote Git Repo -

i'm new git, i'm trying learn. followed this guide , got working on network share. used git bash. i've found how lot of visual studio gui, prefer rather having go , forth command line (i'm coming visual source safe pending checkins, checkin, , you're done). the command couldn't find was: git remote add origin <server> how do unc share in visual studio 2013, in gui? to knowledge visual studio tools git (vs git support) not yet support managing remotes, unfortunately. believe team @ msft responsible vs git features has backlogged, it's low priority. see comments on so#21469233 re: edward thomson .

javascript - PhoneGap how to refresh/reload page using one page app -

currently, have 1 page app uses handlebars templates. has search function controlled specific class page, page /#page/1 when click search result, takes different page controlled seperate external class called /#exhibitors/432 (the exhibitor id number @ end). when click go back, , phonegap loads search page (#page/1) in ios/safari, unless reload entire html page using location.reload(), app cache search first entered, , wont take new input. i have tried use location.hash add random string end of hash, work when reload entire html page using location.reload() when button clicked. there no issue android/chrome. any feedback how reload html , load search page @ #page/1 appreciate that. have tried using location.href = url/#page/1, load page none of dynamic data. more thoughts on topic: 1) rule of thumb avoid re-loading whole html page. how achieve this? in html page, should have specific div, manipulate see fit. example, on /#page/1, should set content of div whateve

spring - How to map a SpringServlet to root and also serve static content in root? -

i have jax-rs spring service i've added swagger to. swagger builds json description of service has served static file. i've included swagger ui view json description nicely. issue when mapping servlet path root not serve static swagger files under /swagger. service works fine. both work if map service path that's not root such /rest/*. i'd rather have nice path without "/rest/" in middle. so when have <url-pattern>/</url-pattern> service @ root <servicename>/ , going <servicename>/swagger/ returns 404 not found. if change <url-pattern>/rest/*</url-pattern> service working @ <servicename>/rest/ , swagger visible @ <servicename>/swagger . possible have work without needing service under <servicename>/rest/* ? i'm on spring 3.0.7-release , jersey 1.8. edit: also, running on weblogic 10.3.6.0. web.xml: <?xml version="1.0" encoding="utf-8"?> <web-app version

xcode6 - Xcode 6 crashes on submitting Archive -

today uploaded first build of first app app store beta testing. after making few changes, when tried submit new archive again xcode crashed, , still crashes. it's log: process: xcode [36810] path: /applications/xcode.app/contents/macos/xcode identifier: com.apple.dt.xcode version: 6.3.2 (7718) build info: ideframeworks-7718000000000000~2 app item id: 497799835 app external id: 812404257 code type: x86-64 (native) parent process: ??? [1] responsible: xcode [36810] user id: 501 date/time: 2015-06-17 21:59:26.432 +0430 os version: mac os x 10.10.3 (14d136) report version: 11 anonymous uuid: a70b5585-6adf-b647-c184-94420293db9f sleep/wake uuid: 536542a5-38c8-405f-8a5e-28dbe775c033 time awake since boot: 110000 seconds time since wake: 18000 seconds crashed thread: 14 dispatch queue: nsoperation