Posts

Showing posts from May, 2010

.net - Problems with SaveAsync task in DynamoDB for C# -

i'm trying save administrator class object dynamodb using context.saveasync method: // save admin dynamodb. context.saveasync(admin,(result)=>{ if (result.exception == null) { console.writeline("admin saved"); } }); but keeps bothering me following error: cannot convert `lambda expression' non-delegate type `system.threading.cancellationtoken' how handle issue ?. i'm using xamarin studio os x according documentation, dynamodbcontext.saveasync takes type t , , cancellationtoken . not take form of delegate type, @ all. what want is: public async task saveasync<t>(t entity, cancellationtoken ct) { await context.saveasync<t>(entity, ct); console.writeline("entity saved"); }

mysql - How can I store price of something for every day of the year in database? -

i working on project have problem designing of database. need store price of every day in year need able change prices specific day. do need create column every day, in approach must create 365 columns in table. do have better solution problem, appreciated, thank you. you should create table 6 columns. create table if not exists pricehistory ( `price` decimal(8,2) not null, `date` datetime, `productid` varchar(50), `id` int not null auto_increment primary key, `createdat` timestamp default now(), `updatedat` timestamp ) engine = innodb; now can insert date , price every day, columns created_at , updatedat , id automatically inserted (and updatedat automatically updated), don't need bother them more. if saving prices on daily base , access data later, don't need date column, use createdat which, again, automatically created on insert . once have data, can query select * pricehistory date(`date`) = '2015-02-29'; y...

MySQL: Selecting an entry's parent and grandparent names -

on site, have several articles, , each article assigned location category. how has been set quite time, can't change how works. the relationship between these set in 2 tables, categories , category_posts : categories +--------+------------------+------------------+-----------+ | cat_id | cat_name | cat_url_title | parent_id | +--------+------------------+------------------+-----------+ | 1 | toronto | toronto | 2 | | 2 | ontario | ontario | 3 | | 3 | canada | canada | 0 | | 4 | vancouver | vancouver | 5 | | 5 | british columbia | british_columbia | 3 | | 6 | montreal | montreal | 7 | | 7 | quebec | quebec | 3 | | 8 | san francisco | san_francisco | 9 | | 9 | california | california | 10 | | 10 | united states | united_...

ios - Error with segue: 'NSInvalidArgumentException', reason: 'Receiver has no segue with identifier -

Image
i'm getting error app: terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'receiver (<viewcontroller: 0x17e60c10>) has no segue identifier 'datetimestring'' . code this: viewcontroller.m -(ibaction) alarmsetbuttontapped:(id)sender { nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; dateformatter.timezone = [nstimezone defaulttimezone]; [dateformatter setdateformat:@"dd:mm:yyyy:ss:mm:hh"]; nsstring *datetimestring = [dateformatter stringfromdate: datetimepicker.date ]; nslog( @"alarm set : %@", datetimestring ); nsdateformatter *dateformatter1 = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"dd:mm:yyyy:ss:mm:hh"]; nsdate *datetimeseconds = [[nsdate alloc] init]; datetimeseconds = [dateformatter1 datefromstring:datetimestring]; nstimeinterval seconds = [[nsdate date] timeintervalsincedate:datetimepicker.date]; nsl...

sql - Transposing a column values into column headers -

i have table this: +-------------+-----------+------------+ | sample_name | test_name | test_value | +-------------+-----------+------------+ | s1 | t1 | 1.5 | | s2 | t2 | 3 | | s3 | t1 | 8 | | s4 | t3 | 5 | +-------------+-----------+------------+ and want put test_names column headers this +-------------+------+------+------+ | sample_name | t1 | t2 | t3 | +-------------+------+------+------+ | s1 | 1.5 | null | null | | s2 | null | 3 | null | | s3 | 8 | null | null | | s4 | null | null | 5 | +-------------+------+------+------+ i have come convoluted solution using temporary table, dynamic sql , while loops slow , know, there way select? thanks if there values test_name may use pivot within dynamic sql : declare @names varchar(max) select @names = coalesce(@names + ', ', '') + test_name (se...

c++ - Try-lock semaphore using standard libraries -

i'm building sokoban solver. since i'm doing depth-first search (yes, horrible idea, know) wish multithreaded. my function recursive. therefore semaphore (like suggested here ), need able attempt lock, , in case of no lock-ability proceed if nothing happened. the semaphores supposed control whether or not new thread should initiated. since using recursive function can imagine whole lot of overhead, implement linked semaphore , wait release. so: how try lock semaphore, skip waiting if no more semaphores available? or there better solution semaphores? my build chain supports c++14. have boost installed, avoid third party libraries. using ubuntu 14.04. (when have done want this, i'll have go @ ida*, focus on want achieve rather solving underlying enormous problem approach solving sokoban puzzle :-) ) so have add new method semaphore class ( try ) // boost needed no more #include <condition_variable> #include <mutex> using namespace std; ...

java - Entering int in a string variable -

i ask user enter name(string) , age(int), if user enters number in name space "crashes". can stop program crashing. im using java. are casting input int, or leaving string? once take in input need convert string int. int age = integer.parseint(ageinput);

excel - Calculate the standard deviation from a binned list -

Image
say have list of integer values, 1 through 10 . instead of having actual dataset, have quantities of each value. example: 1 | 73 2 | 121 3 | 155 4 | 149 5 | 187 6 | 180 7 | 166 8 | 148 9 | 120 10 | 81 as can see, it'd incredibly time consuming list out each value individually (73 1 s, 121 2 s et cetera) it's way know how use stdev(). how can calculate standard deviation of values? a custom user defined function (aka udf) might expedient route.        your values column have been exploded multiples in column b d2:d1381 (see below). the stdev , stdev.p , stdev.s formulas in e2:g2 are, =stdev($d2:$d1381) =stdev.p($d2:$d1381) =stdev.s($d2:$d1381) the udf formulas in e3:g3 are, =udf_stdev_exploded($a2:$a11, 1) ' or =udf_stdev_exploded($a2:$a11) =udf_stdev_exploded($a2:$a11, 2) =udf_stdev_exploded($a2:$a11, 3) the udf formulas based upon following module code. function udf_stdev_exploded(rng range, optional ityp long = 1) dim r...

haskell - Intercalate function giving Non-exhaustive patterns -

i'm trying intercalate 2 lists this: intercalate [0, 2, 4] [1, 3, 5] [0, 1, 2, 3, 4, 5] so created function: intercalate (x:xs) (y:ys) = x:(y:(intercalate xs ys)) intercalate [] [] = [] however error: exception: <interactive>:3:5-57: non-exhaustive patterns in function intercalate i can't understand why! a hint should enough here: you handle case in both lists empty. you handle case in both lists nonempty. can think 2 more cases?

Can casting in safe Rust ever lead to a runtime error? -

i'm fiddling bit any , casting deeper understanding of rust. c# i'm used fact casting can lead runtime exceptions because casting in c# means dear compiler, trust me, know i'm doing please cast int32 because know work. however, if you're doing invalid cast program blow exception @ runtime. wondering if casting in (safe) rust can equally lead runtime exception. so, came code try out. use std::any::any; fn main() { let some_int = 4; let some_str = "foo"; { let mut v = vec::<&any>::new(); v.push(&some_int); v.push(&some_str); // gives none let x = v[0].downcast_ref::<string>(); println!("foo {:?}", x); //this gives some(4) let y = v[0].downcast_ref::<i32>(); println!("foo {:?}", y); //the compiler doesn't let me cast (which lead runtime error) //let z = v[1] i32; } } my observation far compiler seems prevent me...

mysql - Querying many to many relation laravel -

im trying query many many relationship laravel 5 eloquent,with pivot table, i m trying retrieve "articles" has tag "a" , tag "b" together, not succeed, eloquent s bring articles have tag "a" , tag"b", there`s way this? nothing bellows works. $tags = [1,2,3]; $result = timetable::with([ 'tags' => function($query) use($tags){ foreach($tags $tag) { $query->where('id', $tag); } } ])->paginate(); $result = timetable::with(['tags']) ->wherehas('tags' => function($query) use($tags){ $query->wherein('tag_id',$tags); } )->paginate(); assuming followed laravel's naming rules relationships , foreign keys: get timetables have of tags $result = timetable::with('tags')->wherehas('tags', function($query) use ($tags) { $query-...

python - Django model with list of items -

i new django , writing simple model of phonebook. i have object person , contact every person can have multiple contacts. i have 2 approaches of modelling, not sure 1 correct. first approach: class contact(models.model): phone_number = models.charfield(max_length=20) name = models.charfield(max_length=100,blank=true) class person(models.model): owner = models.onetoonefield(user,unique=true,primary_key=true) phone_number = models.charfield(max_length=20,unique=true) name = models.charfield(max_length=100,blank=true) contacts = models.manytomanyfield('contact', blank=true) second approach: class contact(models.model): possessor = models.foreignkey(person,related_name='possessor') phone_number = models.charfield(max_length=20) name = models.charfield(max_length=100,blank=true) class person(models.model): owner = models.onetoonefield(user,unique=true,primary_key=true) phone_number = models.charfield(max_leng...

javascript - Wrong element focused in Chrome -

in javascript web application i've table custom cells, read mode (simple label) , edit mode on double-click (input). when i'm in edit mode, focus setted on div contains input (in td) , can use tab move cell. when i'm in read mode, focus setted ever on div contains label , can use tab , arrows move cell. works perfect in explorer, in chrome, in read mode, focus different: setted ever on table element , can't use tab , arrows move cell.. i've tried force focus setting interval: $("#iddiv").focus() the problem on chrome <table> <tbody> <tr> <td> <div class='...'> <label></label> </div> </td> ...... </tr> </tbody> </table> set attribute of tabindex="0" on <div> s (technique found in blog post ) $(function() { $('div[tabindex]').first().focus(); }); td { outline: 1px solid grey; } td label { display: inline-block; pa...

php - echo function and edit for permalink -

i want make change in function <?php function add_post($title,$contents,$category){ $title = mysql_real_escape_string($title); $contents = mysql_real_escape_string($contents); $category = (int)$category; mysql_query("insert `posts` set `cat_id` = {$category}, `title` = '{$title}', `contents` = '{$contents}', `date_posted`= now()"); } function edit_post($id,$title,$contents,$category){ $id = (int)$id; $title = mysql_real_escape_string($title); $contents = mysql_real_escape_string($contents); $category = (int)$category; mysql_query("update `posts` set `cat_id` = {$category}, `title` = '{$title}', `contents` = '{$contents}' `id` = {$id}"); } function add_category($name){ $name = mysql_real_escape_string($nam...

winforms - How to find the position of a single word of text in a form C# -

Image
i'm not sure if possible or not. i'm interested in being able find (x,y) position of word of text on winform . for example, in picture below, want able pull (x,y) coordinate of upper-left hand corner of letter h in "here". i know how position of textbox, can make rough estimate based off of word "here" inside textbox, able ask program word if possible. also, if there way position, i'd able length , height of word (basically want know coordinates of bounding box of word "here" if possible) not sure if matters, textbox richtextbox , , textbox populated string array in form1 class. thank in advance! you can use getpositionfromcharindex method, position of "here" within textbox or richtextbox (it works both). as know, position in window have sum position of richtextbox . this: int index = richtextbox1.text.indexof("here"); point textboxlocation = richtextbox1.getpositionfromcharindex(index); poin...

regex - Grammar LL(1) Dangling else and common left prefix -

i believe reads familiar dangling else ambiguity. therefore skip explanation. found on compilers book(the dragon book) not ambiguous grammar represents if , else. here is. stmt->matched_stmt | open_stmt matched_stmt->if exp matched_stmt else matched_stmt | other open_stmt->if exp stmt | if exp matched_stmt else open_stmt the problems is: open_stmt->if exp stmt | if exp matched_stmt else open_stmt in order make grammar work on ll(1) grammar, need eliminate left common prefix, , in case left common prefix is: if exp then when try factory again become ambiguous, tried. stmt->matched_stmt | open_stmt matched_stmt->if exp matched_stmt else matched_stmt | other open_stmt->if exp theno' o'->stmt | matched_stmt else open_stmt which ambiguous, can me make not ambigous , no common left prefix? thank much i don't believe possible write ll(1) grammar handle dangling else, although trivial write recursive descent parser so. ...

Upgrade clojure to the new version -

i want upgrade clojure version 1.6.0 1.7.0. how can this? can not remember how installed it, using leiningen. when using leiningen, clojure dependency on project.clj . can specify version there. so easy go , forth between clojure versions , can use different versions different projects without conflicts. the relevant leiningen documentation can found here

php - Best way to check if array is numeric -

say have 1 dimensional array of 500,000 cells , want know if array numeric, obvious options either iterate on whole array , use is_numeric() function or use array_shift. problem both of these options o(n) (correct me if i'm wrong) , more expensive data in array grow. i'm thinking of way i'm not sure of o, search non numeric values in array using regex , array_search. think , there less expensive options? would implode efficient? if have simple array, join elements string , run against is_numeric. @ least have numeric check once. $foo = array(1, 2, 3, 4, 5, 6, ....); $bar = implode('', $foo); var_dump(is_numeric($bar));

jquery - TinyMCE not initializing, but no JavaScript errors -

i have simple email form (for members-only page private club) send email blasts. code simply: <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="../../../tinymce/jscripts/tiny_mce/tiny_mce.js"></script> </head> <body> <h1>email blast</h1> <form method="post"> <input type="hidden" name="from" value="blast@club.com" /> <input type="hidden" name="to" value="blast@club.com" /> <input type="hidden" name="reply" value="from@club.com" /> <input type="hidden" name="bcc" value="tester <test@club.com>" /> <label for="subject">subject</label><br/> <input type="text" name="subject" id="subject" style="width: 600px...

html - Columns in row in bootstrap are not filling page width -

i have section of website has 2 rows inside container, both rows have 3 columns of class col-sm-4 , col-md-4. both rows have 1 image in each column. images same size @ 300px wide. top row displays accurately, bottom row condenses 3 columns , leave big area of wide space on right side. when using inspector, top row columns appearing class col-md-4, buttom row columns showing col-sm-4. i'm not sure if whats causing it. should mention top row columns have paragraphs below each image. when adding exact same paragraph content bottom row in 1 column, issue resolved, don't want paragraphs here. checked out bootstrap css , own try , find sore of style on <p> causing couldn't find anything. each row, , column have exact same css. code below: html: <div class="wrapper"> <div class="row customer-options"> <div class="button-container"> <div class="col-sm-4 col-md-4"> ...

In C position of ++ in regards to pointers -

so code runs differently when have: *ptr++; , ++*ptr i know part ++ being in front add first , when in add @ end. pointer increment @ end of method. clarify i'm trying move pointer next character. character type pointer. *ptr++ processed *(ptr++) ; increments ptr returns original value, dereferenced. ++*ptr processed ++(*ptr) dereferences pointer, increments value points to ( not pointer). to preincrement pointer, value @ incremented location, want *++ptr , increments pointer, dereferences @ new location.

How do I subtract two dates that are in rows (not given in the query) Mysql -

say you're designing system library , want 2 dates subtracted - checkout date , checkin date. have file both of these dates along video id , customer id. want sort 7 or more days (the book due today or past due). i had this, worked until date parts: select customers.first_name, customers.last_name, video_checkout.checkout_date, video_checkout.checkin_date video_rental, customers, video_checkout video_checkout.checkout_date - video_checkout.checkin_date >= 7; so decided try date_sum , timestampdiff, after 2 hours of googling, doesn't seem date_sums or timestampdiffs support subtracting 2 dates tables. is there anyway subtract dates in tables? can create query return subtracted dates, video id , customer id many entries? using mysql workbench 6.3.4 the dates in video checkout file this: delete video_checkout; insert video_checkout values ( '1', '1', '2015-08-20', '2015-08-30' ); insert video_checkout values ( '1'...

ios - TextField overlaid on ScrollView "Adjust to Fit" TextField not working -

Image
i have scroll view overlaid 2 text fields, 1 near top , 1 near bottom. when text in text field reaches side constraints app freezes , not adjust size fit width. initially, had image view overlaid 2 text fields , working properly. think has relation scroll view. in interface builder, adjust fit checked , min font size set. have used following statements , no avail. toptextfield.adjustsfontsizetofitwidth = true bottomtextfield.adjustsfontsizetofitwidth = true below screen shot of app when freezes , screen shot of layout in xcode. looks todo auto layout constraints. double check constraints scrollview .follow tutorial explained step step how handle constraints scrollview.

node.js - MongoDB: Concatenate Multiple Arrays -

i have 3 arrays of objectids want concatenate single array, , sort creation date. $setunion precisely want, i'd try without using it. schema of object want sort: var chirpschema = new mongoose.schema({ interactions: { _liked : ["55035390d3e910505be02ce2"] // [{ type: $oid, ref: "interaction" }] , _shared : ["507f191e810c19729de860ea", "507f191e810c19729de860ea"] // [{ type: $oid, ref: "interaction" }] , _viewed : ["507f1f77bcf86cd799439011"] // [{ type: $oid, ref: "interaction" }] } }); desired result : concatenate _liked, _shared, , _viewed single array, , sort them creation date using aggregate pipeline. see below ["507f1f77bcf86cd799439011", "507f191e810c19729de860ea", "507f191e810c19729de860ea", "55035390d3e910505be02ce2"] i know i'm suppose use $push , $each , $group , , $unwind in combination or other, i'm ...

android - Can I re-use a DialogFragment instance or should I create I new one for a DatePickerDialog? -

so create datepickerfragment user enter date on edittext line when edittext empty: @override public void onclick(view v) { if (xedittext.gettext().length() == 0) { datepickerfragment newfragment = new datepickerfragment(); newfragment.show(getsupportfragmentmanager(), "datepicker"); } later, if edittext not empty (because user entered date) want send date in bundle fragment: else { ... bundle argsbundle = new bundle(); argsbundle.putint("year", c.get(calendar.year)); ... my question should create new instance of datepickerfragment named newfragment in else { statement: else { ... bundle argsbundle = new bundle(); argsbundle.putint("year", c.get(calendar.year)); datepickerfragment newfragment = new datepickerfragment(); newfragment.setarguments(argsbundle); newfragment.show(getsupportfragmentmanager(), "datepicker"); or should creating newly named fr...

C++ Help (Integer Pattern) -

the question : if sequence of digits in x forms substring of sequence of digits in y, outputs "x substring of y"; otherwise, if sequence of digits in x forms subsequence of sequence of digits in y, outputs "x subsequence of y"; otherwise, outputs "x neither substring nor subsequence of y". do not use arrays or strings in program the output should follows enter y : 239847239 enter x : 847 x substring of y enter y : 239847239 enter x : 3923 x subsequence of y enter y : 239847239 enter x : 489 x neither substring nor subsequence of y and below got far... (haven't coded subsequence clueless) i know coding unefficient , suitble use above model output. improvements or comments how fix appreciated. #include <cmath> #include <iostream> using namespace std; int main() { cout << "enter y: " ; int y; cin >> y; cout << "enter x: "; int x; ...

php - How to create a table in MySQL from the sql dump of a table taken from other database instance? -

i'm using mysql via phpmyadmin. i've exported 1 table 1 database instance in mysql. now want create same table data instance of mysql database downloaded sql dump. can create it? if yes, how? if no, why? you have import dump database done terminal using mysql -u<username> -p<password> <database> < <dump.sql> assuming dump file contains create table query , associated data table or table exist in database. you phpmyadmin. first select database click import button select file import clicking file import finally click go start import

Change Android wear weather to Celsius? -

how change temperature 'celsius' on android weather native app? there not around particular issue so, decided post own solution. i know sounds straight forward it's quite hidden. you need set language english (uk) on android device. settings > language & input > language android wear app should display temperature in celsius.

java - Jedis and Lettuce async abilities -

i using redis akka need no blocking calls. lettuce has async-future call built it. jedis recommended client redis. can tell me if using both of them right way. if 1 better. jedis using static jedis connection pool con , using akka future callback process result. concern here when use thread (callable) result thread going block result. while lettuce might have more efficient way of doing this. private final class onsuccessextension extends onsuccess<string> { private final actorref senderactorref; private final object message; @override public void onsuccess(string valueredis) throws throwable { log.info(getcontext().dispatcher().tostring()); senderactorref.tell((string) message, actorref.nosender()); } public onsuccessextension(actorref senderactorref,object message) { this.senderactorref = senderactorref; this.message=message;...

Searching date and time in Lucene query string in Cloudant -

i trying write index , search using date , time in index in cloudant nosql database. when pass date in query string, works fine created_date:[2015-08-16 2015-08-27] this returns correct results when include time in parameter: created_date:[2015-08-16 07:38:00 2015-08-27 07:38:02] i error: cannot parse 'created_date:[2015-08-16 07:38:00 2015-08-27 07:38:02]': encountered " "to" "to "" @ line 1, column 50. expecting 1 of: "]" ... "}" i have more query parameters before above gist of error. this apache lucene query string. causing happen? according lucene java doc, date format should looks this: a date field shall of form 1995-12-31t23:59:59z trailing "z" designates utc time , mandatory this format derived standards compliant (iso 8601) , more restricted form of canonical representation of datetime xml schema part 2. examples... 1995-12-31t23:59:59z 1995-12-31t23:59:59.9...

htmlunit driver - Error:org.openqa.selenium.ElementNotVisibleException: You may only interact with visible elements using htmlunitdriver? -

i getting error: org.openqa.selenium.elementnotvisibleexception: may interact visible elements when use htmlunitdriver . works url, after when start driver.findelement(by.cssselector("#from_city_typeahead")).sendkeys("bangalore"); such statements, gives above error. me solve issue. you can same action javascript: webdriver.executescript("document.getelementbyid('elementid').setattribute('value', 'new value element')"); visibility matter in case of standard visible browsers. it's doesnt matter javascript in case of of browsers.

r - RStudio Shiny: The confliction between an action button and a submit button -

in r shiny app, have action , submit button. server <- function(input, output) { x = reactive(data.frame(x=rnorm(10),y=rpois(10,10),z=runif(10))) y = eventreactive(input$flush, { x()[,sample(1:3)] },ignorenull=false) output$distplot <- rendertable({ y() }) } ui <- fluidpage( actionbutton("flush","flush order"), submitbutton("update"), tableoutput("distplot") ) shinyapp(ui = ui, server = server) what want: order of variables randomly changing when click action button. what happens: have click action button first , subsequently click submit button execute. question: how can desired behavior while keeping submit button. there many tabs more submit buttons in app. it's desirable add action button without affecting rest of contents.

scala - Include Dependencies in JAR using SBT package -

apparently project dependencies not being packaged jar generated by: sbt package how can dependencies included? there's project called onejar package project , dependencies single jar file. there sbt plugin well: https://github.com/sbt/sbt-onejar however if you're looking create standard package (deb, rpm, etc.) there sbt-native-packager: https://github.com/sbt/sbt-native-packager it can place dependencies linux package , add appropriate wrappers load dependencies , start program or service.

What is the default Amazon EMR hive password? -

i'm connecting amazon emr hivethriftserver2. got information: could not open client transport jdbc uri: jdbc:****:10000: peer indicated failure: error validating login what right password validate login? empty username : '' password : ''. however, if planning on running map-reduce jobs remotely, use following configuration :- username : hadoop password : ''

javascript - Materialize Parallax Initialization on Meteor -

i'm using materializecss front-end framework personal website developing. used starter parallax template , works, reason parallax images not showing. believe has initialization. snippet of 1 of parallax html: <template name="parall"> <div class="parallax"><img src="/public/background1.jpg"> </div> </template> js: if (meteor.isclient) { template.parall.onrendered(function(){ $(".parallax").parallax(); }); } if (meteor.isserver) { meteor.startup(function () { // code run on server @ startup }); } have tried rendering images css? .parallax { background-image: url("/background1.jpg"); }

c# - Jquery currency validation according to current thread culture -

Image
i making control currency giving list of currency types in drop down , when user select currency in drop down. text box(of currency) validation should according currency , if type drop down not selected validation should according current culture. my code doing server side is protected override void onload(eventargs e) { // take currency info using currency code given user foreach (var culture in getcultureinfosbycurrencysymbol(this.currencyisocode)) { console.writeline(culture.name); system.threading.thread.currentthread.currentuiculture = cultureinfo.getcultureinfo(culture.name); currentculture = cultureinfo.currentuiculture; culturecurrencysymbol.text = currentculture.numberformat.currencysymbol; regioninfo currentregion = new regioninfo(currentculture.tostring()); culturecurrencycode.text = currentregion.isocurrencysymbol; } } /// <summary> /...

video - Access iOS device's camera stream by using web application -

my aim able access ios device's camera stream , transmit server in real time. important point not trying access photo/video library, neither take photo/video. (like using <input type="file" accept="video/*" capture="camera"> ) i trying access video stream in safari browser. other modern browsers, can use webrtc not valid safari flash. there other option me capture ios device's camera stream web application in real time? (like equivalent of flash / webrtc? )

Why is the System class declared as "final" in Java? -

this question has answer here: java — private constructor vs final , more 3 answers as per understanding, class declared final prevent being extended/inherited. see there can security , performance gains in regard. but there specific design decision behind this? eg: realize kind of design pattern? did go around similar thread here ! answer not looking for singleton pattern: -private constructor -only static methods -no need have more 1 object of class or object @ all -no need extend fundamental class

java - Lazy loading working in non-transactional class/method in Hibernate -

i working in spring-hibernate application. flow usual: controller --> service --> dao . i have annotated service layer class @transactional , thereby marking every method transactional in class.in service class, made dao call domain object , converting dto/vo object passed controller.for converting domain object dto , have written custom static class(class having static methods) objectmapper conversion. now, domain object has child object( one many ) lazily loaded. so, when in objectmapper , access child getter method, database call issued, working fine. don't understand since objectmapper not transactional , expecting exception thrown session closed while making database call fetch child object database.i using getcurrentsession of session factory in dao . can please explain me behavior? i suppose either call objectmapper transactional service method (you should) or if not, maybe enabled "hibernate.enable_lazy_load_no_trans" keeps hibern...

ruby - rake db:migrate cause StandardError - uninitialized constant CreateObjects::Object -

i have migration 20150930051523_create_objects.rb: class createobjects < activerecord::migration def change create_table :objects |t| t.text :name t.timestamps null: false end object.create :name => "a" object.create :name => "b" object.create :name => "c" end end $ rake:db migrate --trace cause output: ** invoke db:migrate (first_time) ** invoke db:environment (first_time) ** execute db:environment ** invoke db:load_config (first_time) ** execute db:load_config ** execute db:migrate == 20150930051523 createobjects: migrating ==================================== -- create_table(:objects) -> 0.0010s rake aborted! standarderror: error has occurred, , later migrations canceled: uninitialized constant createobjects::object/db/migrate/20150930051523_create_objects.rb:8:in `change' /var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:605:in `exec_migration' /var/lib/gems/2.1.0/gems/a...

java - Initial SessionFactory creation failed.org.hibernate.HibernateException: Missing column -

expected result: how print data college role shared screen shot link screen shot: http://imgur.com/h3wolab project structure: http://imgur.com/irxgjeq working on simple login , show user type data created hibernate project in eclipse juno using 2 classes 1) college_userlogin 2) college_role and trying data 2nd class usertype (say student) using common key 'roleid' mentioned in both classes. getting exception , stuck, stacktrace initial sessionfactory creation failed.org.hibernate.hibernateexception: missing column: college_userlogin in cerpdevnew.dbo.college_role note: college_userlogin table not column compiler understanding column problem @entity @table(name = "college_role") //@inheritance(strategy = javax.persistence.inheritancetype.table_per_class) //@discriminatorvalue("college_role") //@primarykeyjoincolumn(name="roleid") public class college_role implements serializable { ...

How to make Internet Explorer 8 to support nth child() CSS element? -

i want give zebra stripe effect table rows. in other browsers can done using css nth child element. want ie 8 also. how can it? you can use http://selectivizr.com/ js support css3 selector ie.

c# - .Net Set Class Constant to it's Namespace at compile time -

is there nice way set constant of classes namespace? namespace acmecompany.acmeapp.services { public class myservice { private const string whatwedo = "acmecompany.acmeapp.services"; private const string wouldbenice = typeof(myservice).namespace; ... } } so if class if moved namespace don't need worry these constants. more info constant used logging - passed log method. legacy code wont changing in short term. aware of runtime ways information such this question we're using .net 4 upgrading .net 4.5. you're not going set constant variable non-constant value. understandable, isn't it? btw, c# has readonly keyword, turn class field work constant once object construction time ends. can or can't static: public class myservice { static myservice() { wouldbenice = typeof(myservice).namespace; } private static readonly string wouldbenice; } or... public class myservic...