Posts

Showing posts from July, 2015

How to properly configure Unbound DNS Resolver? -

what short of configurations should make in order tell computer redirect 127.0.0.1 every time visit domain1.com or www.domain1.com through web browser when request content of pages through curl ? 1st step: sudo apt-get install unbound 2nd step: ??? try step 1: echo '127.0.0.1 domain1.com www.domain1.com' | sudo tee --append /etc/hosts

android - Get width and Height from URI of picture -

i trying widht , height of picture able load canvas on activity. when try print height , width 0. not understand why ? here code: private void openpicture() { bitmapfactory.options options = new bitmapfactory.options(); options.injustdecodebounds = true; try { inputstream stream = context.getcontentresolver().openinputstream(uri); bitmapfactory.decodestream(stream); int width = options.outwidth; int height = options.outheight; log.d("debug", ""+ width); loadpicture(width, height); } catch(ioexception e) { log.e("fingerpainterview", e.tostring()); } } private void loadpicture(int w, int h) { try { // attempt load uri provided, scale fit our canvas inputstream stream = context.getcontentresolver().openinputstream(uri); bitmap bm = bitmapfactory.decodestream(stream); ...

android - FirebaseRecyclerAdapter only loads 1 item -

json { "country" : { "cabana" : "sydney", "pub" : "china", "skygarden" : "indonesia", "tito" : "vietnam" } } main activity code. mdatabasereference=firebasedatabase.getinstance().getreference().child("country"); recyclerview=(recyclerview)findviewbyid(r.id.recyclerview); recyclerview.setlayoutmanager(new linearlayoutmanager(this)); firebaserecycleradapter<string, viewholder>adapter= new firebaserecycleradapter<string, viewholder>(string.class,r.layout.xyz,viewholder.class,mdatabasereference){ @override protected void populateviewholder(viewholder viewholder, string model, int position) { viewholder.name.settext("name + "+model); // viewholder.serial.settext(string.valueof(model.serial)); } }; recyclerview.setadapter(adapter); the recycler view shows 1 item. name + aus...

Why do I get different compilation result depending on java imports and static imports sequence order? -

i've faced issue compilation, cannot understand why occurs. time spent understand reason (it far obvious in "crap" project), after reproducing error simplifies code show little example you: package structure: com.company | ----main.class | ----maker | ----maker.class maker.class package com.company.maker; public interface maker { } main.class package com.company; import static com.company.main.makerimpl.strategy.strategy1; import static com.company.main.makerimpl.strategy.strategy2; import com.company.maker.maker; public class main { public static void main(string[] args) { system.out.println(strategy1.name() + strategy2.name()); } static class makerimpl implements maker { enum strategy { strategy1, strategy2 } } } and got compilation error in main class: error:(15, 39) java: cannot find symbol symbol: class maker location: class com.company.main and if change import sequence im...

html - How can I position this DIV in exactly the middle and it isn't moved while resizing the browser? -

you'll need this, in advance. how can text inside div positioned in middle? body { margin: 0; } #questiond { width: 1080px; height: 675px; background-color: white; position: relative; margin: auto; } #frage1 { position: absolute; left: auto; font-family: 'roboto', sans-serif; color: #f09b72 } <body background="img/bg.jpg"> <div id="questiond"> <h1 id="frage1">frage 1</h1> </div> </body> hello hope looking 1 below #questiond { position: absolute; top: 50%; left: 50%; margin-left:auto; margin-right:auto; width:960px; <div id="questiond"> <h1 id="frage1">frage 1</h1> </div>

oracle - how to use dbms_scheduler to run the job every 30 minutes -

i using oracle db , monitoring performance of oracle db connected java application , rite have monitor count of active connections in db @ regular intervals lets after every 30 minutes below query return me count of active users along there name , count select osuser, count(osuser) active_conn_count v$session group osuser order active_conn_count desc now please advise how can make schedule job in scheduler in oracle db triggered @ every 30 minutes . there pretty examples dbms_scheduler. it's easy submit recurring job. not need that! oracle stores tons of data database performance, easier , more accurate use these statistics. take @ active_session_history on here. hope looking for.

java - What is the right way to create thumbnail charts? -

Image
i'm trying create chart of thumbnails of data using jscrollpane , encounter performance difficulties. example has 100 thumbnails charts 5000 samples in each one. when i'm trying scroll down , multiple times, scrolling occurs delay, cpu load increasing, application memory usage reaches on 500 mb. is there way avoid performance problem without reducing data? import java.awt.color; import java.awt.eventqueue; import java.awt.gridlayout; import java.util.random; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.jscrollpane; import org.jfree.chart.chartfactory; import org.jfree.chart.chartpanel; import org.jfree.chart.jfreechart; import org.jfree.chart.plot.plotorientation; import org.jfree.chart.plot.thermometerplot; import org.jfree.data.general.defaultvaluedataset; import org.jfree.data.xy.xyseries; import org.jfree.data.xy.xyseriescollection; public class thumbnailchartstest extends jpanel { private static final int w = 200; private static fin...

Visual Studio Team Services build Typescript error -

i have angular2 webapplication i'm using typescript 2.0. have install locally in vs version 2.0 , changed tag typescript version in vs project. locally vs build works fine. in cd pipeline on visual studio team services vnext build build fails this: 2016-11-05t16:10:22.0371090z c:\program files (x86)\microsoft sdks\typescript\1.8\tsc.exe --project "c:\a\1\s\src\emersy\tsconfig.json" 2016-11-05t16:10:22.7095466z ##[error]vstsc(0,0): error ts5023: build: unknown compiler option 'strictnullchecks'. looks build server using typesript version 1.8 possible? typescript 2.0 not available in hosted build agent. use microsoft.typescript.msbuild package instead, after build project on hosted agent typescript 2.0. add/install microsoft.typescript.msbuild package project edit project file (.csproj) a.) configure msbuild use nuget package's props file. <import project="..\packages\microsoft.typescript.msbuild.2.0.6\build\microsoft.typescri...

javascript - How to extract information out of multi-line string? -

i have string: 1970/11/05 18:40:06 transferred: 484844 bytes (4745455 bytes/s) errors: 46 checks: 5550 transferred: 5450 elapsed time: 8.6s i want extract information (except data) out of string , save object. problem regex indent of value, because spaces between label , value smaller if value gets bigger. way regex? i think shouldn't use regex, simple split() , map() . parsed data map find nice use stuff that, though use object... var str = `1970/11/05 18:40:06 transferred: 484844 bytes (4745455 bytes/s) errors: 46 checks: 5550 transferred: 5450 elapsed time: 8.6s`; var splitted = str.split("\n"); splitted.shift(); var data = new map(splitted.map(v => { var f = v.replace(/\s/gm, "").split(":"); return [f[0], f[1]] })); console.log(data.get("errors")); // 46 if prefer solution parse object: var obj = {}; spli...

javascript - How can I remove a dynamically generated class with jQuery? -

i creating dynamically generated html grid following javascript code , html: <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <link rel="stylesheet" href="./css/colorwalk.css"> </head> <body> <div> <div id="colorgrid"></div> </div> <div id="colorbuttons"> <button class="buttonsize white"> <button class="buttonsize red"> <button class="buttonsize green"> <button class="buttonsize orange"> <button class="buttonsize pink"> <button class="buttonsize purple"> </div> <script src="js/main.js"></script> </body> $(document).ready(function() { const colors = array.of('red...

c# - Xamarin.Form XamlCompilation error: Value cannot be null, Parameter name: method -

i'm using vs 2015 on windows 10, xamarin vs latest version updated few day ago, around 02/11/2016 when add xaml compilation namespace in app.cs [assembly: xamlcompilation(xamlcompilationoptions.compile)] namespace mynamespace { public class app:application{...} } all .xaml file build error message: value cannot null parameter name: method even create new empty xaml, error still included. experience issue , knowing how fix it. ps: purpose adding line try improve performance after updated latest version of xamarin form (currently 3.3.2.1). gone.

javascript - convert markdown to json object -

i have markdown file imported in node module through webpack loader import mardownfile './markdownfile.md' this file text book chapters separated ## / h2 tag now, i'm looking way convert json object each h2 tag (or other possible wrapper) in separate chapter chunks use react page component page content props.children. more details on i'm trying solve i have in markdown.md file #title ##chapter 1 text text text ##chapter 2 text etc ##chapter 3 more text image i read markdown , convert object, this... var atext = { pages: [ { "title": "chapter 1.", "text": "text", }, { "title": "chapter 2.", "text": "text", }, { "title": "chapter 3.", "text": "text", "img": "cat-stevens.png", } ]} then in javascript react component render page component this <page page={atext.pages[0]} /> i'm on mac osx computer per...

Dynamic SQL SQL Server 2012 Get Result into a #temp table -

i using sql server 2012. final result @sql temp table.here code far. help. if object_id ('tempdb.dbo.#my_dt_cte') not null drop table #my_dt_cte create table #my_dt_cte ([rowid] int not null identity (1,1) ,[yyyymm] int ) ; my_dt_cte ( select convert(int,convert(varchar(6),eomonth(getdate(),-1),112)) [yyyymm] union select convert(int,convert(varchar(6),eomonth(getdate(),-2),112)) [yyyymm] union select convert(int,convert(varchar(6),eomonth(getdate(),-3),112)) [yyyymm] union select convert(int,convert(varchar(6),eomonth(getdate(),-4),112)) [yyyymm] union select convert(int,convert(varchar(6),eomonth(getdate(),-5),112)) [yyyymm] union select convert(int,convert(varchar(6),eomonth(getdate(),-6),112)) [yyyymm] ) insert #my_dt_cte select [yyyymm] my_dt_cte order [yyyymm] desc; -- select * #my_dt_cte declare @columns nvarchar(max), @sql nvarchar(max); set @columns = n''; select @columns += n', p.' + quotename(yyyymm) (select p.yyyymm #my_dt_cte p group p.yyyymm...

database design - Django many to many relations -

i have 3 models, i'm not sure how design best. 1 song model, 1 artist , show model class artist(models.model): name = models.charfield(max_length=255) label = models.charfield(max_length=255, null=true) def __str__(self): return self.name class show(models.model): name = models.charfield(max_length=255) def __str__(self): return self.name class song(models.model): title = models.charfield(max_length=255) artist = models.manytomanyfield('artist') show = models.manytomanyfield('show') duration = models.floatfield() def __str__(self): return '%s - %s (%s)' % (self.title, [artist.name artist in self.artist.all()], self.duration) the things wasn't sure relations. artist has songs, song can have multiple artists, , show can (or has) multiple songs , songs can in multiple shows essentially. right design here manytomany fields? on database level it's pretty obvious: ar...

c# - Set CultureInfo in Asp.net Core to have a . as CurrencyDecimalSeparator instead of , -

i'm going mad. want culture used in entire asp.net core application set "en-us". nothing seems work. set culture entire application? i'm not interested in client browser cultures , not. thing seems change changing language settings of windows. want culture determined within application itself, not client. what have tried far: set <system.web><globalization uiculture="en" culture="en-us" /></system.web> in web.config set system.threading.thread.currentthread.currentculture = cultureinfo; , currentuiculture in startup.configure , in controller. use app.userequestlocalization(.. shown below var enusculture = new cultureinfo("en-us"); var localizationoptions = new requestlocalizationoptions() { supportedcultures = new list<cultureinfo>() { enusculture }, supporteduicultures = new list<cultureinfo>() { enusculture ...

If/else syntax on password verification in javascript -

i'm new javascript , trying list out characters missing failed password tell users need input. window.onload = function() { var info = document.getelementbyid("info"); var test = document.getelementbyid("myform").test; test.onclick = function(e) { e.preventdefault(); var pw = document.getelementbyid("myform").pw.value; var formula = /(?=.*[a-z])(?=.*[a-z])(?=.*[0-9]).{6,}/; if(formula.test(pw)) { document.getelementbyid("myform").submit(); } else if pw.match(/\d/g) == null { info.innerhtml = "you need number"; console.log(pw.match(/\d/g)) } else { info.innerhtml = "you need number." } }; }; the above first run through of checking if user inputted password numbers. keep getting uncaught syntaxerror: unexpected identifier in chrome dev tools pw.match portion underlined. i've looked elsewhere online , syntax l...

c++ - Dynamically allocated object producer -

look @ class: //hpp class { public: a(); ~a(); b *fetchnew(); private: b *currentvalue; } //cpp a::a() {} a::~a { delete currentvalue; } b *a::fetchnew() { delete currentvalue; currentvalue = new b(); //apply magic currentvalue return currentvalue; } this class holds pointer instance of class b. every time fetchnew() called, old 1 gets deleted, new 1 allocated , magic applied it, after new , shiny currentvalue returned. this method called (in real life, it's method returns view matrix in game's main loop, it's called once every frame, 60 times second). once object gets deleted, deletes current currentvalue , otherwise leak. is there prettier way achieve this? edit: here's actual code, since has twist (just fetchnow() method): glm::mat4x4 *camera::getviewmatrix() { //transformation <<-apply shiny , fancy magic; delete viewmatrix; viewmatrix = new glm::mat4x4(); *viewmatrix *= glm::...

compiler construction - Explanation of Left/Right Associative Grammar -

i've been reading compiler design two-three months. think need little explanation left/right associative grammar. i'm talking grammar : f-> f + e | e e-> e * r | r r -> [0-9] could please give me definitions of lag/rag 1 example each please?

c# - Method for create new instance of form -

i beginner in programming. try create small application many forms. explain, how open form creating instance of form using method. i have this: private void firtstoolstripmenuitem_click(object sender, eventargs e) { if(myform == null) { myform = new myform(); myform.mdiparent = this; myform.formclosing += myformform_formclosing; myform.show(); } else { myform.activate(); } } void myform_formclosing(object sender, formclosingeventargs e) { myform = null; } i want handle many tool strip menu, , dont want wrtite code in each of them, want write method opening form type. this allows display @ 1 mdi child form of each class: // stores references form of each type: private dictionary<type, form> _childwindows = new dictionary<type, form>(); private form showform<t>() t : form { var formtype = typeof(t); //...

instance - Specifying that a type can only exist in one class if it already exists in other classes in Haskell -

i working on problem involving unification, user-defined type subst a. problem reads: "define type class unifiable specifies function unify::a -> -> maybe (subst a) must defined type inside class. type can in unifiable class if in eq , substitutable classes, , should represented in definition." this how have defined substitutable , unifiable far: class substitutable subst :: subst -> -> class unifiable unify :: -> -> maybe (subst a) however, i'm not sure how go specifying type can in unifiable class if in eq , substitutable classes. i'm not looking answer specific problem, in general, how go specifying type can in 1 class if in other classes? thanks. the class definition can contain constraints, function. class (eq a, substitutable a) => unifiable unify :: -> -> maybe (subst a)

Can word movement in vim skip the symbols? -

for example, want: http://vimdoc.sourceforge.net/htmldoc/motion.html ------>------>-----------> w w w what vim behaves: http://vimdoc.sourceforge.net/htmldoc/motion.html --->-->----->>---------->> w w w w w w you this: nnoremap w /\v(^\|\a)\zs\a<cr> onoremap w /\v(^\|\a)\zs\a<cr> xnoremap w /\v(^\|\a)\zs\a<cr> it maps 'w' key search. search looks alphabetic character preceded either non-alphabetic character, or start of line. various different mapping modes ( nnoremap , onoremap , xnoremap ) works in visual mode , argument operator, e.g. dw delete our custom word rather default meaning of word.

python - Pattern of regular expressions while using Look Behind or Look Ahead Functions to find a match -

i trying split sentence correctly bases on normal grammatical rules in python. the sentence want split s = """mr. smith bought cheapsite.com 1.5 million dollars, i.e. paid lot it. did mind? adam jones jr. thinks didn't. in case, isn't true... well, probability of .9 isn't.""" the expected o/p mr. smith bought cheapsite.com 1.5 million dollars, i.e. paid lot it. did mind? adam jones jr. thinks didn't. in case, isn't true... well, probability of .9 isn't. to achieve using regular , after lot of searching came upon following regex trick.the new_str jut remove \n 's' m = re.split(r'(?<!\w\.\w.)(?<![a-z][a-z]\.)(?<=\.|\?)\s',new_str) in m: print (i) mr. smith bought cheapsite.com 1.5 million dollars,i.e. paid lot it. did mind? adam jones jr. thinks didn't. in case, isn't true... well, aprobability of .9 isn't. so way understand reg ex first selecting 1) characters i.e ...

java - Two JsonArray`s Comparing missing keys -

i have 2 jsonarrays datas api api 1 [ { "id":1, "value":270 }, { "id":2, "value":1432493 }, { "id":3, "value":63 }, { "id":5, "value":412 }, { "id":6, "value":371 }, { "id":7, "value":824 }, { "id":9, "value":266 } ] api 2 [ { "id":1, "name":"name", "description":"description" }, { "id":2, "name":"name", "description":"description" }, { "id":3, "name":"name", "description":"description" }, { "id":4, "name":"name", "description":"d...

c# - How do I delete all content for a given facet? -

i'm trying delete content aloglia index in c# api. i can't seem find examples online show how facets work. before attempt deletebyquery command trying search same criteria working. algoliaclient searchclient = new algoliaclient("xxx", "xxx"); index purgeindex = searchclient.initindex("mytestindex"); query purgequery = new query(""); jarray facetfilters = new jarray("versions", "6.12.2"); purgequery.setfacetfilters(facetfilters); jobject res = purgeindex.search(purgequery); but res object undefined when run code. am close? once know filtering working can pass same query delete function. i got working. here syntax in case else needs delete index content given facet. algoliaclient searchclient = new algoliaclient("x", "x"); index purgeindex = searchclient.initindex(paramindex); query purgequery = new query(""); jarray facetfilters = new jarray(); jtoken facettoken ...

c++ - Negative value not being added to Array -

problem i have 2 arrays, 1 positive numbers, 1 negative numbers. reason, if first number added negative number, creates array space add number yet number inserted 0. code adding here add method, determines if value negative or positive , adds value appropriate array: bool myclass::addint(int valuetobeinserted){ if (valuetobeinserted >= 0){ if (posarrayiterator >= sizeofmyarray){ return false; } else { cout << "added " << valuetobeinserted << "\n" << endl; myparray[posarrayiterator] = valuetobeinserted; posarrayiterator ++; return true; } } else { if (negarrayiterator >= sizeofmyarray){ return false; } else { cout << "added " << valuetobeinserted << "\n" << endl; mynarray[negarrayiterator] = valuetobeinserted; negarrayiterator ++; return true; } } } output with following test: b.ad...

osx - iCaldendar - How will PHP apply the timezone, start, end time correctly on ics file? -

why following starttime , endtime in outlook , mac calendar not inserting exact time below? input: $timezone = 'europe/luxembourg'; $starttime = "2016-11-03 18:00:00"; $endtime = "2016-11-03 19:00:00"; icalender.ics: $icalender_for_outlook_n_osx = 'begin:vcalendar' . "\r\n" . 'version:2.0'. "\r\n" . 'prodid:-//hacksw/handcal//nonsgml v1.0//en'. 'begin:vevent'. "\r\n" . 'dtend:' . date("ymd\this", strtotime($endtime)) . "\r\n" . 'uid:'. uniqid() . "@".$domain . "\r\n". 'dtstamp:'. time() . "\r\n". 'location:' . $location . "\r\n". 'description:'. $uri . "\r\n" . 'url;value=uri:' . $uri . "\r\n" . 'summary:'. $subject . "\r\n" . 'dtstart:'. date("ymd\this", str...

python - Looking for a pandas function analogous to DataFrame.nafill() -

i apply function acts fillna() takes different value nan. unfortunately dataframe.replace() not work in case. here example: given dataframe: df = pd.dataframe([[1,2,3],[4,-1,-1],[5,6,-1]]) 0 1 2 0 1 2.0 3.0 1 4 -1.0 -1.0 2 5 6.0 -1.0 3 7 8.0 nan i looking function output: 0 1 2 0 1 2.0 3.0 1 4 2.0 3.0 2 5 6.0 3.0 3 7 8.0 nan so df.replace() to_replace=-1 , 'method='ffill' not work because requires column-independent value replace -1 entries. in example column-dependent. know can code loop looking efficient code applied large dataframe. suggestions? thank you. you can replace value nan , call ffill : in [3]: df.replace(-1, np.nan).ffill() out[3]: 0 1 2 0 1 2 3 1 4 2 3 2 5 6 3 i think you're on thinking this edit if have nan values create boolean mask , update elements again ffill on inverse of mask: in [15]: df[df == -1] = df[df !...

windows - Bulk insert line into text files -

i have folder containing 400 text files formatted, need insert specific line of text of them them. need insert line of text in between lines 32 , 33. i'm looking whatever simplest way accomplish this. you can write simple stand alone program in java or other language quickly.

python - search a word in a file and print only the text betwen two separator -

i'm trying code searching fonction gonna read file , print name it, without other of information on line, found out how print complete line yet.. title = input("\n enter movie name: ") open("data_film") f: line in f: if title in line: print(line) here file must search in : 1;avatar;science fiction;3;2;3.99 2;little frog;horror;2;3;3.99 ... so if search title, want check first ";" second ";" movie name , print it. thanks, hope question clear enought, english not native language. assuming data file in format, , title after second ';', can use native split function using semicolon delimiter. splits line @ semicolons array, , title second element. title = input("\n enter movie name: ") open("data_film") f: line in f: if title in line: print(line.split(';')[1])

python - How to convert Period string to actual Period type -

i have column of data such '1971q1' , '1972q2' , etc. (year followed quarter) when do: print(type(df.quarterly)) the answer series what need "cast"/convert column genuine pd.period type can simple time algebra it. thank you you can use pd.periodindex() method. assume have following df: in [517]: x out[517]: str_col 0 1971q1 1 1971q2 2 1971q3 3 1971q4 4 1972q1 5 1972q2 6 1972q3 7 1972q4 in [518]: x.dtypes out[518]: str_col object dtype: object let's create new 'period' column: in [519]: x['period'] = pd.periodindex(x.str_col, freq='q') in [520]: x out[520]: str_col period 0 1971q1 1971q1 1 1971q2 1971q2 2 1971q3 1971q3 3 1971q4 1971q4 4 1972q1 1972q1 5 1972q2 1972q2 6 1972q3 1972q3 7 1972q4 1972q4 in [521]: x.dtypes out[521]: str_col object period object dtype: object now can "time algebra", example let's subtract 1 quarter each period: in [525]: x.period...

linux - How can I use awk for modify a column based in the first column? -

i have data this, , need automatize simple task. need make second value of row, become same first cell in next row in sequence this: first second 1 2 4 6 10 12 25 28 30 35 become first second 1 4 4 10 10 25 25 30 30 35 $ awk 'nr==1; nr>2{print p[1], $1} {split($0,p)} end{print p[1], p[2]}' file first second 1 4 4 10 10 25 25 30 30 35

php - Why is array_combine not returning an array? -

this question has answer here: reference: variable scope, variables accessible , “undefined variable” errors? 3 answers when try print array returned function, blank screen. my array $terms , $definitions both same length , exist before , after call make_associative_array() . function make_associative_array() { return array_combine($terms, $definitions); } $c = make_associative_array(); print_r($c); $terms: array ( [0] => nock (verb) [1] => end [2] => serving [3] => nock (noun) ) $definitions: array ( [0] => place arrow against string prior shooting. [1] => group of arrows shot during tournament. 6. [2] => thread wound around bow string protect string. [3] => notch @ rear of arrow. bow string placed in nock. ) i using php 5.6.27 in case - array_combine returns null because both $terms ...

c - How to configure codeblocks? -

Image
why doesn't codeblock find compiler? tried install codeblocks(without mingw setup) c: , tried configure cygwin , since unsuccessful, uninstalled codeblocks , downloaded codeblocks mingw setup , installed on e:, thought have been preconfigured, settings older 1 remained: had downloaded mingw setup , installed on e: : since had cygwin gcc selected compiler, site mentioned mingw setup had gcc/g++ compiler , debugger, i(thought) have select 1 list there many, selected one: compiler produces error message: if compiler included within installer, shouldn't had configured path itself? how configure codeblocks can start compiling c codes? if codeblocks installer failed setup mingw you, here's how can manually add it. in global compiler settings dialog you're showing above: select "gnu gcc compiler" (it should first option). select "toolchain executables" tab try hitting autodetect button. may or may not work if have multiple...

exception occured in C++ function -

when given number "n" , radix "d", function followed used calculate reversed number under radix d, , convert decimal , return. the problem that, method 1 can work succefully while method 2 comes exception. there tell me what's problem method 2 ? much. int getrevn(int n, int d) { //-------method 1-------------------------// int revn = 0; while (n) { revn = revn * d + n % d; n /= d; } return revn; //------method 2-------------------------// string s; while (n) { s = char(n % d + '0') + s; n /= d; } int rev = 0; (unsigned int = s.size() - 1; >= 0; i--) rev = rev * d + s[i] - '0'; return rev; } in last loop, you're declaring i unsigned. i >= 0 , , loop won't terminate. instead, i wrap around large number, causes crash. change i signed.

dotnetnuke - 2sxc Blog app search only index page 1 -

using 2sxc blog app, dnn indexes whatever on first page of blog page. second page onwards not indexed, hence doesn't show in search results. can help? this looks question, , it's haven't thought yet. google doesn't care, internal search "respect" paging , pick first page. i can think of few quick-fixes tricky explain here. please open issue on blog app on github.

Display from SQLite database and collection in an android app? -

click here see display related xml file posted i dont errors when running application in emulator, , there no error message when open testactivity... problem cant see text displayed supposed be. here xml file of activity: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/relatively" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fdb913" android:orientation="vertical" android:paddingbottom="16dp" android:paddingleft="20dp" android:paddingright="20dp" android:paddingtop="16dp" tools:context="com.slbw.stoplookandbewarned.testactivity" android:weightsu...

javascript - Userscript Angular-js search -

i trying use user-script automatically search me. find value, change desired search term, , have script click search button. however, website has strange search thingy. uses called angular-javascript, according research. code inspect-element: <input class="form-control im_dialogs_search_field no_outline ng-pristine ng-untouched ng-valid ng-empty" placeholder="search" ng-model="search.query" autocomplete="off" type="search"> please let me know if know how can use userscript search this. thanks! sail

scala - Is it possible to use IN clause in plain sql Slick for integers? -

there similar question here doesn't answer question. is possible use in clause in plain sql slick? note part of larger , more complex query, need use plain sql instead of slick's lifted embedding. following good: val ids = list(2,4,9) sql"select * coffee id in ($ids)" the sql prefix unlocks stringcontext can set sql parameters. there no sql parameter list, can end opening sql injection here if you're not careful. there (and dangerous) suggestions dealing problem sqlserver on this question . have few options: your best bet use #$ operator mkstring interpolate dynamic sql: val sql = sql"""select * coffee id in (#${ids.mkstring(",")})""" this doesn't use parameters , therefore might open sql-injection , other problems. another option use regular string interpolation , mkstring build statement: val query = s"""select * coffee id in (${ids.mkstring(",")})"...

loops - Split data frame to multiple data frame and apply lag to each data frame -

i have data frame 14 column (first 4 year, month, day, date; , next 10 10 variables). need split data frame each variable keeping 4 first columns (i.e., year, month, day, date) , naming each data frame according variable name. , need create 10 columns in each separated data frame filled 1 10 days lag respective variable column name q1,q2,…q10. new in r, therefore, not comfortable in looping through data frame. attaching data here. csv file . i managed split data frame, produced data frame 1 column. but, said before, need keep first 4 columns in each separated data frame. , need add lagged value in each data frame. df <- read.csv("df.csv", header=true) indx <- names(df[5:ncol(df)]) list2env( setnames( lapply(split(colnames(nc[,5:ncol(df)]), indx), function(x) df[x]), paste(sort(unique(indx)))), envir=.globalenv)

html - Uploading XML file to 000webhost through WinSCP corrupted -

whenever upload xml file on winscp 000webhost server (for school project, not use them personal use not want pay host if it's school project), becomes corrupt. here's source on firefox shows. http://i.imgur.com/qvl1idr.png for thousands of characters. however, when opening file on winscp, appears normal , uncorrupted. i 98% sure it's wrong 000webhost. used able delete xml file , reupload , fix doesn't work anymore reason. please me out?

javascript - Why my ajax request always throws error? -

here code: php: public function export(request $request){ $file = "export.txt"; if(isset($_post["type"])){ file_put_contents("$file",$_post["text"]); } if (file_exists($file)) { header('content-description: file transfer'); header('content-type: text/plain'); // appropriate header type txt file header('content-disposition: attachment; filename="'.basename($file).'"'); header('expires: 0'); header('cache-control: must-revalidate'); header('pragma: public'); header('content-length: ' . filesize($file)); readfile($file); exit; } } js: $(document).on('click', '#export', function () { var names = ['علی','فرید']; var namess = names.join('\n'); $.ajax({ type: "post", u...

how to work with css and html android -

Image
i have 1 html file , 1 css file css imported , linked in html works in pc browser not in android. m code show m html webview wv; wv = (webview) findviewbyid(r.id.webview1); wv.loadurl("file:///android_asset/barg.html"); what should not show these figures instead of leaves this html , css codes #leaves {position:relative;top:-50px;width:100%;text-align: right;} #leaves { display: inline-block; width: 200px; height: 150px; background: linear-gradient(to bottom right, #309900, #005600); transform: skew(20deg); border-radius: 5% 40% 70%; box-shadow: inset 0px 0px 1px #222; border: 1px solid #333; z-index: 1; -webkit-animation: falling 5s 0s infinite; } #leaves i:nth-of-type(2n) { -webkit-animation: falling2 5s 0s infinite; } #leaves i:nth-of-type(3n) { -webkit-animation: falling3 5s 0s infinite; } #leaves i:before { position: absolute; content: ''; top: 117px; right: 9px; height:...