Posts

Showing posts from February, 2011

c# - I use the following code to capture image from camera. But I cant record the video by this -

cameracaptureui capture = new cameracaptureui(); capture.photosettings.format = cameracaptureuiphotoformat.jpeg; capture.photosettings.croppedaspectratio = new size(1, 2); capture.photosettings.maxresolution=cameracaptureuimaxphotoresolution.highestavailable storagefile storefile=await capture.capturefileasync(cameracaptureuimode.photo); if (storefile != null) { var stream = await storefile.openasync(fileaccessmode.read); bitmapimage bimage = new bitmapimage(); bimage.setsource(stream); image imageitem = new image(); imageitem.source = bimage; my_canvas.children.add(imageitem); just use standard sample recording video capture photos , video cameracaptureui cameracaptureui captureui = new cameracaptureui(); captureui.videosettings.format = cameracaptureuivideoformat.mp4; storagefile videofile = await captureui.capturefileasync(cameracaptureuimode.video); if (videofile == null) { // user cancelled photo capture return; }

awk - Bash directories going in the wrong place -

i'm bash noob great! in advance! what i'm trying take first column students.txt file in input folder , create directories them in output folder. my problem when execute script 1 (the first $stuid ) directory gets made inside output folder. rest goes main folder. #!/bin/bash filecontent=`awk '{print $1}' input/students.txt` stuid in "${filecontent[*]}"; mkdir -p ./output/$stuid done use while read loop extract first field each line , create directory: while read -r stu_id junk; mkdir -p ./output/"$stu_id" done < input/students.txt

c# - Microsoft.Office.Interop.Word reference in Visual Studio 2015 and MS Office 2016 -

i have visual studio 2012 update 1 , office 2010, git cv system, , autobuild system based on teamcity enterprise. there project contain references "microsoft.office.interop.word". on new workplace have installed vs 2015 (update 1) , ms office 2016. gave issue type or namespace 'office' not found in microsoft . deleted old references , add new references "microsoft office 16.0 object library" , "microsoft word 16.0 object library". now, in new visual studio 2015 project compiles ok. .csproj-file has been changed not compiling on other programmers computers, have vs 2012 or vs 2013. is there way combine both references different office versions? alternatively, how can configure moment work fine on workplaces? can copy old .dll (from office 2010) computer , add project outer .dll? or bad idea? always program against oldest version of word (any office program) solution needs support. compiled against version 2016 isn't going ru

javascript - PHP MySQl Chained Select -

i have 2 drop downs populated mysql tables. in mysql tables have foreign key restraints table "assets" has column "department" linked department table. each asset has associated department. my first dropdown "department" , want second dropdown show results selected department. here's code. <select id="location" name="location"> <option value="">select asset location</option> <?php $pdo = new pdo('mysql:host=localhost;dbname=maintlog', 'root', '*******'); #set error mode errmode_exception. $pdo->setattribute( pdo::attr_errmode, pdo::errmode_exception); $stmt = $pdo->prepare('select id,name location'); $stmt->execute(); while ($row = $stmt->fetch(pdo::fetch_assoc)) { echo "<option value='$row[id]'>$row[name]</option>"; } ?> </sele

angularjs - Chrome complaining about html tags in app.js -

i trying make simple spa angular , node. when try test if spa working in chrome, chrome gives me peculiar error. complaining html tags in demoapp.js, though not contain html code. how can be? error: demoapp.js:1 uncaught syntaxerror: unexpected token < test.html <html ng-app="demoapp"> <head> <title>my angular app</title> </head> <body> <h2>demoapp demo</h2> <div> <a href="#/partial1.html">partial 1</a> <a href="#/partial2.html">partial 2</a> <div ng-view></div> </div> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.js"></script> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-route.js"></script> <script src = "demoapp.js"></scri

typescript - Subscribe Observable value -

when i'm logging value of variable inside subscribe have value when doing outside undefined ???: this._postservice.getconf("app/conf/conf.json") .subscribe(res =>{ this.home = json.stringify(res); console.log("value :" + this.home); i want initialise home varibale value i'm doing on ngoninit value undefined when i'm trying outside: this fonction : getconf(url){ return this._http.get(url). map(res => {return res.json()}); } //ngoninit : ngoninit(){ this._postservice.getconf("app/conf/conf.json") .subscribe(res =>{ this.home = json.stringify(res); console.log("hahowaaaaaaaa" + this.home); } ); //// acount this._postservice.getposts(this.home) .subscribe(result =>{ this.loading = false; this.actionsg = result; var count = json.stringify(result); this.acount = count.substring(count.indexof(','),23); },err

multithreading - MFC/CLI mixed mode 'System.AccessViolationException' -

i running mfc dialog based application. have serial-comms thread running in reference class (outside code snippet) sends string^ dialog (so can put comms in window). problem (as see commented code) every time try string (except assign local variable) "an unhandled exception of type 'system.accessviolationexception' occurred in dlp_printer_control.exe additional information: attempted read or write protected memory. indication other memory corrupt." in snippet, atoi crashes. using atoi because had idea of trying copy each string element ascii , copying value member cstring. didn't work. every commented line produces exception. sue trying access originated in managed memory. workarounds suggested? bool cdlp_printer_controldlg::updatecommswindow_right(string^ strcommsline) { cstring strtemp = strcommsline; lpwstr chartemp; int = 0; int i_len = strtemp.getlength(); if (i_len == 0) return false; chartemp= strtemp.getbuffer(i_

c# - Update GUI components from Begininvoke -

so have basic windows application want count 1 10000 , show numbers in label: private void button1_click(object sender, eventargs e) { thread thread = new thread(() => { (int = 0; < 10000; i++) { begininvoke((methodinvoker)delegate () { label3.text = i.tostring(); }); } }); thread.start(); } the problem label text doesn't update , shows last loop counter i.e. 9999. begininvoke called on ui thread? why not label updated correctly? thanks. because begininvoke asynchronous call, you're sending many updates text box update fast enough, time text box has got around drawing, it's counted 10000! you can synchronously update text, is, calling loop halt until text box has updated , finished, use invoke instead of begininvoke.

java 8 - CompletableFuture in the Android Support Library? -

so migrating android studio project java 8, android api level 24 , jack toolchain today check out new features, lambdas , completablefuture . unfortunately, completablefuture seems available api level 24 on (my minimum api level project being 16). do know of plans on bringing completablefuture android support library? looks nice solution promises pattern. the streamsupport project provides backport of completablefuture in streamsupport-cfuture component can used android development, supported on devices.

Git rev-list cannot find commit -

when run: git verify-pack -v .git\objects\pack\pack-*.idx one of lines in output contains: 651302358b781ab60f364416272e1c35107c974f blob 23980089 23987383 699599322 but if try lookup blob with: git rev-list --all --objects | grep 651302358b781ab60f364416272e1c35107c974f or: git rev-list --all --reflog --objects | grep 651302358b781ab60f364416272e1c35107c974f i empty result. should not able blobs returned verify-pack ? based on below have tried to: create fresh clone, run git repack run git gc same result. the object may abandoned, i.e., last reference(s), whatever were, gone. because object in pack file, however, cannot removed. git must build entirely new pack. if use git repack build new pack files, unreferenced objects omitted new packs. (note git gc automatically. however, .keep files may keep old packs around, if have created .keep files.) edit : jthill points out in comment , must repack -a or -a consolidate older packs. while au

Java applet turtle -

Image
so got turtle applet , saw code on web. private void tree(int s) { if (s < 8) return; forward(s); left(45); tree(s / 2); right(90); tree(s / 2); left(45); back(s); } this result should like, in mind turtle stops red circle is... can explain why turtle going further and why turtle starts 2 subtrees ? because if understood code right turtle move forward s steps , turn left 45 degrees not right... the turtle should end started. let's dissect code line-by-line: forward(s); this draws vertical trunk of tree. left(45); we turn left we're pointing upper-left corner. tree(s / 2); we recursively call tree half base length, causing new tree branch off our trunk in direction specified (45 degrees left). notice tree continue recursively branch out until base length becomes less 8 units (pixels?) long. afterwards, returns place split from, base of branch. right(90); after finish drawing left branch, turn right 90 deg

python - Unpacking list of lists generated by a zip into one list -

i again manipulating dataframes. here concatenate multiple dataframe using row common reference. want reorder columns "pairing" first 1 columns of each df together, , on. sake of data readability here code: df_list=[df_1,df_2,df_3] return_df=pd.concat(df_list,axis=1, join='outer') dfcolumns_list=[df_1.columns,df_2.columns,df_3.columns] print (return_df.columns) print(dfcolumns_list) list_columns=np.array(list(zip(*dfcolumns_list))).reshape(1,-1)[0] print (list_columns) list_columns=np.array([x x in zip(*dfcolumns_list)]).reshape(1,-1)[0] print (list_columns) return_df=return_df[list_columns] my question related to: list_columns=np.array(list(zip(*dfcolumns_list))).reshape(1,-1)[0] or alternatively list_columns=np.array([x x in zip(*dfcolumns_list)]).reshape(1,-1)[0] it takes list of indexes, unpacks in zip, takes first element of each column index, outputs tuple/sublist contained in list, transforms array ,then reshapes rid of sublists cause

dynamic programming - minimum path from top left to bottom right cell, where we can traverse in north, south, east, west directions -

how find minimum path top left bottom right cell in 2d-matrix costs can traverse in north, south, east, west directions. if cost values constrained nonnegative, problem can solved dijkstra's shortest path algorithm. otherwise, problem not well-defined since cycles of negative length occur. more specific, weight edge cell a b set weight of a ; weight of terminal cell in bottom right corner included in every path.

Ruby, adding multiple objects to an array at once -

i have shop class, , want add multiple items @ once. want this: shop1 = shop.new product1 = product.new("dress", 50) shop1.add_products(product1, 5) to add 5 dresses warehouse def add(product, qty) @products << product * qty end so later can use @products.select{|p| p.name == "dress"}.count and 5. possible? the easiest way think is: def add(product, qty) @products += [product] * qty end but comes down syntax preferences.

java - Can't get website using jsoup on Android -

i have problem getting website jsoup on android. public class parser { parser() { new parser1().execute(); } class parser1 extends asynctask<void, void, void> { string website1 = "http://google.com"; document doc; @override protected void onpreexecute() { super.onpreexecute(); } this code not execute doinbackground method. @override protected void doinbackground(void... params) { try { doc = jsoup.connect(website1).get(); } catch (ioexception e) { e.printstacktrace(); } return null; } and rest of code. @override protected void onprogressupdate(void... values) { super.onprogressupdate(values); } @override protected void onpostexecute(void result) {

mysql - Updating a MySQLi database using php and HTML5 forms -

on website have admin page want able update information in database, using form. this code im using enter information , update in database: adminform.php <html> <head> <link rel="stylesheet" href="assets/css/main.css" /> </head> <body> <header id="header"> <h1><a href="home.php">safetnet</a></h1> <nav id="nav"> <ul> <li>admin page only</li> <li></li> <li><a href="logout.php" class="button">logout</a> </li> </ul> </nav> </header> <h1> select member </h1> <br /> <select name="members" onchange="showuser(this.value)"> <option value=""

swift - iOS why system kills the app using location in backround -

i have app uses location updates when in foreground in background. using corelocation framework, have implemented app location updates sent server after every 5 minutes, using this code reference. this works fine in foreground, when app goes background, getting killed os after 30 minutes hour. want app updates @ least 8 hours, in background. also, app using 10% of battery per hour. related app being killed in background? if so, how can resolve battery problem? otherwise, can tell me issue is? below crash log device: exception type: 00000020 exception codes: 0x000000008badf00d exception note: simulated (this not crash) highlighted thread: 2 application specific information: <bknewprocess: 0x17e74840; com.app.app; pid: 560; hostpid: -1> has active assertions beyond permitted time: {( <bkprocessassertion: 0x17d78740> id: 560-c9e81e97-90d9-4f95-871e-3dc53372f302 name: called uikit, <redacted> process: <bknewprocess: 0x17e74840; com.app.example; pid: 5

c++ - Loading OpenGL > 1.1 functions Windows -

i'm having trouble setting opengl msvs 2013. i'm aware opengl32.dll on windows platform located @ c:\windows\system32 implementation of opengl 1.1. what i'm trying load newer opengl > 1.1 functions such glbindbuffer , glbufferdata . have read it's possible getting pointer function using wglgetprocaddress . when using function returned pointer null, original functions in dll using getprocaddress(opengl32dll, "...") work except newer functions don't seem load. i'm hoping here can me go through setup , point out did wrong or if have missed something. so here go: i have downloaded opengl extensions viewer 4.4 points out i'm able run upto opengl 2.1 should more enough use or load glbindbuffer , glbufferdata . i downloaded microsoft sdks/v7.1 includes headers: gl/glu.h , gl/gl.h ; downloaded glext extensions api here , linked glext.lib + included headers. files in linker: c:\program files\microsoft sdks\windows\v7.1\lib\o

xquery - BaseX: correct syntax to place multiple 'replace ' -

declare function local:stripns($name xs:string?) xs:string? { if(contains($name, ':')) substring($name, functx:index-of-string($name, ':') + 1) else $name }; $x in doc("test.xml")//*[@ref] let $tmp:=local:stripns($x/@ref) return replace value of node $x/@ref $tmp i want strip namespace value of ref , type attribute. <test ref='haha:123' type='hehe:456'/> should become <test ref='123' type='456'/> . don't know correct syntax, below ideal .xqy file want: declare function local:stripns($name xs:string?) xs:string? { if(contains($name, ':')) substring($name, functx:index-of-string($name, ':') + 1) else $name }; $x in doc('test.xml')//*[@ref] let $tmp:=local:stripns($x/@ref) return replace value of node $x/@ref $tmp, $x in doc('test.xml')//*[@type] let $tmp:=local:stripns($x/@type) return replace value of node $x/@ref $tmp but contains syntax error: [xud

python - Scrapy not parsing response in make_requests_from_url loop -

Image
i'm trying scrapy grab url message queue, , scrape url. have loop going fine , grabbing url queue, never enters parse() method once has url, continues loop (and url comes around though i've deleted queue...) while it's running in terminal, if ctrl+c , force end, enters parse() method , crawls page, ends. i'm not sure what's wrong here. class my_spider(spider): name = "my_spider" allowed_domains = ['domain.com'] def __init__(self): super(my_spider, self).__init__() self.url = none def start_requests(self): while true: # crawl url queue yield self.make_requests_from_url(self._pop_queue()) def _pop_queue(self): # grab url queue return self.queue() def queue(self): url = none while url none: conf = { "sqs-access-key": "",

How can I use regex to capture this specfic set of ages? -

i have set of age data, below; 1 2 3 4 5 6 7 8 9 10 1,1 1,2 1,3 2,12 11,13,15 7,8,12 12,15 14,16,17 15,6 13,11,10,2 and on... trying use regex in target 'mixed' range of childrens ages. logic requires @ least combination of 2 childen (so requires 1 of lines comma), @ least 1 aged under 10 (min 1), , @ least 1 aged equal or greater 10 (max 17). my expected results above return these lines below, , nothing else; 2,12 7,8,12 15,6 13,11,10,2 any advice appreciated on how resolve? in advance, continuing try correct. you can use regex meet requirements: ^(?=.*\b[1-9]\b)(?=.*\b1[0-7]\b)[0-9]+(?:,[0-9]+)+$ regex demo there 2 lookaheads assert 2 numbers 1 between 1-9 , between 10-17 ([1-9]) matches number should between 1 , 9 1[0-7] matches number should between 10 , 17 [0-9]+(?:,[0-9]+)+ in regex matching 1 or more comma separated numbers in middle.

php - Regex - get elements to render if statement -

i'm designing script , trying if construct without eval in php. still incomplete blasting through, it's templating engine , "if" part of engine. no assignment operators allowed, need test values without allowing php code injections , precisely not using eval it'll need individual operations between variables preventing injection attacks. regex must capture [if:(a+b-c/d*e)|(x-y)&!(z%3=0)] output [elseif:('b'+'atman'='batman')] output2 [elseif:('b'+'atman'='batman')] output3 [elseif:('b'+'atman'='batman')] output4 [else] output5 [endif] [if:(a+b-c/d*e)|(x-y)&!(z%3=0)] output6 [else] output7 [endif] the following works if, elseif, else , endif blocks along condition statements: $regex = '^\h*\[if:(.*)\]\r(?<if>(?:(?!\[elseif)[\s\s])+)\r^\h*\[elseif:(.*)\]\r(?<elseif>(?:(?!\[else)[\s\s])+)\r^\h*\[else.*\]\r(?<else>(?:(?!\[e

c++11 - Strange behaviour of for_each and push_back() -

i doing testing for_each , use of lambda functions , i'm stuck on (compiled g++ -std=c++11, gcc version 5.3.1) #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { vector<int> vi = {1,1,1,1}; int end =0; cout << "vi contains: "; for_each(vi.begin(), vi.end(),[](int i){ cout << << " "; }); cout << endl; for_each(vi.begin(),vi.end(),[&](int i){ cout << "i="<<i<<" "; if(i==1){ vi.push_back(1); end++; } }); cout << endl; cout << "end=" << end << endl; cout << "now vi contains: "; for_each(vi.begin(), vi.end(),[](int i){ cout << << " "; }); cout << endl; return 0; } and output of code vi contains: 1 1 1 1 i=1 **i=0** i=1 i=1

file - Python: AttributeError: 'str' object has no attribute 'readlines' -

i trying copy text mobilebuildsettings , use replace text abproject . getting following error , don't understand it. attributeerror: 'str' object has no attribute 'readlines' below code: with open("c:/abproject.build", "r+") script, open ("c:/tempfile.build","w+") newscript: abproject = ("c:/abproject.build") line in abproject.readlines(): if line == "@appidentifier@" : newabproject.write('"' + "appidentifier : " + '"' + appidentifier.get() + '"' + "\n") else: newabproject.write(line) abproject.close() newabproject.close() os.remove("abproject.txt") os.remove("tempfile.buil","abproject.txt") in order give answer jill1993's question , take moseskoledoye's answer : abproject = ("c:/abproject.build") abproject string object. furthermore, write : with open

mysql - SQL query left join issue -

i making query not working properly. my table details follows: subarea: id fieldsofstudy student_subarea: id primary key, student_id , student_subarea foreign key subarea id , student_subarea. ask: want accomplish obtain fields of study in 1 column , in column id of student if in class. otherwise, show null or something. select a.`id` , a.`name` , a.`area_id` , u. * `subarea` left join student_subarea u on u.subarea_id = a.id u.student_id =50 or u.student_id null doing not helping @ all. tried use functions , subqueries without success. me. the general rule left join , filtering put filtering clauses in on clause first table. may want: select a.`id`, a.`name`, a.`area_id`, u. * `subarea` left join student_subarea u on u.subarea_id = a.id , u.student_id = 50; how remember logic? left join returns rows first table when there no match on second table. appears want. the problem logic students other than student 50 match logic.

java - Permutation of array -

for example have array: int a[] = new int[]{3,4,6,2,1}; i need list of permutations such if 1 this, {3,2,1,4,6} , others must not same. know if length of array n there n! possible combinations. how can algorithm written? update: thanks, need pseudo code algorithm like: for(int i=0;i<a.length;i++){ // code here } just algorithm. yes, api functions good, not me much. if you're using c++, can use std::next_permutation algorithm header: int a[] = {3,4,6,2,1}; int size = sizeof(a)/sizeof(a[0]); std::sort(a, a+size); { // print a's elements } while(std::next_permutation(a, a+size));

r - Creating multiple plots in ggplot with different Y-axis values using a loop -

i trying create multiple scatter plot graphs in ggplot have same structure different y-value. need them separate (and therefore not use facet_wrap) because in later step use grid_arrange arrange different combinations of graphs onto single layout. because of this, need create new names each plot reflect y-value being plotted. below sample code, month variable on x-axis , want 3 separate plots of month vs. 3 additional variables (lag1_var, lag3_var , lag9_var). df <- data.frame (month= c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), lag1_var= c (10, 20, 30, 40, 10, 40, 30, 50, 70, 90, 100, 100), lag3_var= c(90, 70, 50, 40, 70, 50, 20, 50, 70, 90, 10, 10), lag9_var = c(50, 20,90, 100, 90, 10, 40, 90, 100, 20, 30, 70)) my approach create list of values differ between y-values , loop on list below: loop.list <- c("1", "3", "9") (val in loop.list) { yval<- paste0("lag", val, "

Fall-through Switch Case with For Loop PHP -

please help. for($i=0; $i<12; $i++ ){ switch($i) { case 0: case 1: case 2: case 3: case 4: echo ("i less 5 <br>"); break; case 5: case 6: case 7: case 8: case 9: echo ("i less 10 <br>"); break; default: echo ("i 10 or more <br>"); } } this example code got in java book , translated code above php. the output of following code: i less 5 less 5 less 5 less 5 less 5 less 10 less 10 less 10 less 10 less 10 10 or more 10 or more my question how come case 0 case 3 outputs "i less 5" though doesn't have following code , case 4 1 echo statement? i'm confused, can explain me. in advance. that's how switch supposed operate. in order stop falling through next cas

php - how can I center my text on fpdf -

i have finding on internet how center text on fpdf or 1 way center text didnt find it. way it's title need center <?php require('../fpdf/fpdf.php'); class ticket extends fpdf{ private $conexion; public function __construct(){ require_once('../model/conexion.php'); parent::__construct(); $this->conexion = new conexion(); $this->conexion->conectar(); } } $pdf = new fpdf('p','mm',array(114,76)); $pdf->addpage(); $pdf->setfont('arial','',10); $pdf->cell(0,0,'storelte'); $pdf->ln(2); $pdf->output('test.pdf', 'i'); ?> the cell method includes optional var alignment http://www.fpdf.org/en/doc/cell.htm you can include additional options variables , define alignment center. $pdf->cell(0,0

swift - Cannot convert return expression type to return type with closure? -

hello have func pagination messages. class func listmessages() -> (int, int, ([chatitemprotocol]) -> void) { let service = messageservice() func list(count: int, offset: int, comp:([chatitemprotocol]) -> void) { let params : [string : anyobject] = ["offset" : offset, "limit" : count] service.listmessagesforroom(params) { (messages) in comp(messages.map({$0})) } } return list } and have error : cannot convert return expression of type '(int, offset: int, comp: ([chatitemprotocol]) -> void) -> ()' return type '(int, int, ([chatitemprotocol]) -> void)' (aka '(int, int, array<chatitemprotocol> -> ())') listmessages(...) expects following tuple return type (int, int, ([chatitemprotocol]) -> void) the function list(...) , on other hand, uses above argument implicitly contain void (/empty tuple type () ) return type. i.e., full signature lis

Add A Callback To A Prebuilt Asynchronous Function Swift iOS -

i'm messing around pdfs @ moment. i'm attempting load pdf system , write out same pdf gain understandings of the whole procedure. the problem i've got i'm having load pdf web , because webviewui.loadrequest asynchronous, isn't completed in time. override func viewdidload() { super.viewdidload() let filepath = getdocumentsdirectory().stringbyappendingpathcomponent("output.pdf") let url : nsurl! = nsurl(string: "http://www.nhs.uk/nhsengland/healthcosts/documents/2014/hc5(t)%20june%202014.pdf") loadtemplate(url, completion: {(webview: uiwebview) -> void in print("callback started") let pdf = self.topdf(webview) { pdf!.writetofile(filepath, atomically: true) } catch { // failed write file – bad permissions, bad filename, missing permissions, or more can't converted encoding } print(&

mysql - INNER JOIN COUNT on same table -

here's trying achieve. have users table want join itself. query users no parentuserid , want additional field called childrencount can find count of users parentuserid = userid. select p.*, count(*) childrencount users p left join users q on q.userid = p.parentuserid p.parentuserid = 0 , p.categoryid = 2 order p.userid desc limit 10 offset 0 i not getting error query isn't working expected. not count of related children. database mysql. if understood correctly, can use correlated query : select p.*, (select count(*) users s s.parentuserid = p.userid) childrencount users p p.parentuserid = 0 , p.categoryid = 2 order p.userid desc limit 10 offset 0

javascript - Only one dropdown open at a time -

i noob i'm trying learn js. been toying around menu have been having trouble issue: using code, how implement behaviour of having 1 dropdown open @ time, on mobile? $(".menu > ul > li").click(function () { if ($(window).width() <= 943) { $(this).children("ul").fadetoggle(150); } }); this demo of code: http://jsbin.com/sesuda/edit?html,output the way template works keeps dropdowns open. what have tried: using not(this) open clicked dropdown item. also, using next(element) make next sibling (the dropdown content next dropdown link) visible. any appreciated. disclaimer: sorry broken english, it's not native language , haven't slept 24h. thank you. you should fade out elements, , fade in clicked one $(".menu > ul > li").click(function () { if ($(window).width() <= 943) { $(".menu > ul > li > ul").fadeout(150); $(this).children("ul").fadetog

Rails application getting 500 error page on production -

i'm migrating working rails 3 application server type of service. firstly had issues static files (e.g. application.css, application.js) not being rendered (404 status). resolved issue turning config.assets.enabled true. now i'm having problem of error 500 no matter go in application. assume it's asset problem. don't error in log/production. follow: started "/" 187.39.38.147 @ 2016-06-14 12:33:05 +0000 processing bookscontroller#index html rendered myapp/layouts/500.html (0.7ms) completed 404 not found in 16ms (views: 10.0ms | activerecord: 1.9ms) i have no idea of how find out what's wrong fix that. can find out what's wrong ?

Get X amount of latest entries with different attributes SQL Server -

let's have following table: userid | fileid | version | date ------------------------------------- usera | filea | version1| 1.1.2016 usera | filea | version2| 2.1.2016 usera | filea | version3| 2.1.2016 usera | filea | version3| 3.1.2016 usera | filea | version3| 4.1.2016 usera | filea | version4| 5.1.2016 userb | filea | version2| 3.1.2016 and want latest 2 versions each user , file created before 4.1.2016, result should this: userid | fileid | version | date ------------------------------------- usera | filea | version2| 2.1.2016 usera | filea | version3| 3.1.2016 userb | filea | version2| 3.1.2016 what correct sql statement result? at moment, trying this with findnewestversion ( select distinct date cdate, userid uid, fileid fid, version ver, row_number() on (partition userid, fileid, version order created desc)rn table created <= [date] ) select * table q inner join (selec

visual studio - C# - Reading NewLine characters from reading a string character by character -

so have program loop, reading every character 1 one , replacing 4 digit number correlating particular letter using case statement. my problem is not reading newline characters ('\n') , don't know how fix this. here code: (int = 0; < inputtextbox.text.length; i++) { //encryption switch (inputtextbox.text[i]) { // got rid of rest of cases // not relevant case '\n': encryptedstring = encryptedstring + "8024"; break; } } and since not accept new line character, doesn't add encryptedstring. this might seem duplicate question other posts found in different situations. edit ---------------------------------------------------------------------------------------------------------------------------- after debugging, turns out reading '\n' not writing string when decoding it. here'

javascript - React Native Endless Loop -

i using react-native iostabbar following example: render: function() { return ( <tabbarios tintcolor="white" bartintcolor="#d7df01"> <tabbarios.item title="all" icon={require('./x.png')} selected={this.state.selectedtab === 'x'} onpress={() => { this.setstate({ selectedtab: 'x', }); }}> {this._rendercontent(this.state.selectedtab)} </tabbarios.item> <tabbarios.item icon={require('./y.png')} title="incoming" selected={this.state.selectedtab === 'y'} onpress={() => { this.setstate({ selectedtab: 'y' }); }}> {this._rendercontent(this.state.selectedtab)} </tabbarios.item> <

swift - Providing specialized initializers for a generic struct -

i have simple generic struct defined - requirements stored properties comparable : struct bounds<a: comparable> { let lower: let upper: } however, i'd provide couple of specialized initializers struct, use math operations set properties. init(value: double, tolerance: percentage) { self.lower = value * ( 1 - tolerance ) self.upper = value * ( 1 + tolerance ) } init(value: measurement, tolerance: percentage) { self.lower = value.value * ( 1 - tolerance ) self.lower = value.value * ( 1 - tolerance ) } the result should 2 different structs, double or measurement . but how do this? i can't provide specialized init methods in definition compiler complain double not convertible a . ok... i can't provide init methods in individual extensions constrained specific types ( where == double ) compiler complains: same-type requirement makes generic parameter 'a' non-generic maybe should usi

Shiny in R: How can I pass a value from a reactive environment in server.R to ui.R? -

i have locally defined vector of values in server.r , use in ui.r. idea following: server.r values <- rep(na, 10) reactive{( values[i] <- ... (where index defined input ui.r) }) global.r pass <- values so can use vector pass in ui-environment. however, not work. guess, global.r , ui.r know initial state of vector values , not updated one. appreciate help!

bash - Rename a folder with a variable in the center -

i trying rename folder. current folder name = apple. want rename apsomeple. the "some" in centre of new name variable. i tried following doesn't work. please advice. if add end testing, works. name="some" mv apple ap$nameple # doesn't work mv apple apple$name # works - testing you can use {} delimit name of variable: mv apple ap${name}ple if there chance variable contain space character, unlike example provided, in addition need put double quotes around enter new filename: mv apple "ap${name}ple"

linux - syntax error near unexpected token while executing a python file -

i trying execute python file not saved in python directory in different 1 in linux (fedora) terminal. tried was: $ exec(vsh1.py) which resulted error: bash: syntax error near unexpected token 'vsh1.py' could find solution please... in advance locate python's source file find / -name vsh1.py and once located run python /path_you_found/vsh1.py if want script seen location interpreter have add pythonpath: pythonpath=$pythonpath:/path_you_found/vsh1.py if script in same directory can run python ./vsh1.py

android - How to put delay for out going calls -

is there option put delay make call in android? once user click call button below method called public class dialbroadcastreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { log.v("dilebroadcastreceiver","in onreceive()"); if (intent.getaction().equals(intent.action_new_outgoing_call)) { string number = intent.getstringextra(intent.extra_phone_number); log.v("dialbroadcast receiver","number is: "+number); } } } then opponent user receiving call. what need when user clicks call button should put delay second or 2 second, there option that. i new developer, can please me. try { //set time in mili thread.sleep(3000); }catch (exception e){ e.printstacktrace(); } or new handler().postdelayed(new runnable() {

jquery - How can i give numbering for option values -

the below code want give number every value <option value="1" />vijay but apple+ should there because want assign values using jquery thats want add + value can modify <option value="1" />vijay but due template design want give <option value="1" value=vijay+/>vijay dont think correct correct format. <select id="cmbcolumn"> <option value="" />columns <option value="apple+" />apple <option value="berry+" />berry </select> <select id="cmbsidebar" name="cmbsidebar"> <option value="" />sidebars <option value="grapes+" />grapes <option value="mango+" />mango </select> my main aim achieve example values apple+ , apple , giving number values. this other code want give numbering values like above said need grapes+ values them <select id=&