Posts

Showing posts from May, 2013

How to Make Existing PDF Text Searchable using any Java Library? With OCR -

any java library? how make searchable text using java library? open source or paid. how apply ocr pdf using pdfbox? how make pdf text searchable programmatically using pdfbox searched alot. didn't find solution. can paste code ocr pdfbox. try apache pdfbox . to extract text: textextraction .

ios - How can I find out if an SKTexture is the placeholder image -

in spritekit, if load image [sktexture texturewithimagenamed:] method, first search bundles, atlases, if fails find texture, create placeholder image , load it. is there way find out (without visually checking) if loaded image placeholder? this doesn't seem "cocoa" way handle type of error. developer.apple.com down now, figured pose question so. sktexture has private properties helpful (see e.g. https://github.com/luisobo/xcode-runtimeheaders/blob/master/spritekit/sktexture.h ), in swift , during development i'm using this: extension sktexture { public var isplaceholdertexture:bool { if size() != cgsize(width: 128, height: 128) { return false } return string(describing: self).contains("'missingresource.png'") } } attention! : this works, if using sktextureatlas : let t1 = sktextureatlas(named: "mysprites").texturenamed("nonexistingfoo") // t1.isplaceholdertext...

wordpress theming - get_template_part works on one server/host, but not another -

on own server, worked fine: query_posts(array('post_type'=>'events', 'paged' => get_query_var('page'), 'posts_per_page' => 10, 'orderby' => 'meta_value', 'order' => 'asc', 'meta_key' =>'details_date')); get_template_part( 'event-loop', 'events' ); go launch, move on client's server, , won't work. breaks page actually, , sidebar , footer don't show up. no error whatsoever, blank space. "view source" confirms html ceases after "get_template_part" call. same happening "news" page, uses "get_template_part". moved these files on own server confirm worked there, , do. when remove "get_template_part", sidebar , footer appear. is there kind of server configuration might prevent get_template_part functioning correctly? when using get_template_part(), second parameter optional. need filename of t...

php - Get eloquent model and all its relationships with one query in Laravel -

the problem is there way eloquent model , all relationships using 1 query? example scenario: you have both post , comment eloquent models. add relationships in model class using hasmany('comment') , belongsto('post') respectively. now i've been doing retrieve both post , comments: $post = post::find($id); $post->comments; return $post; this returns beautiful json object. problem is, way, using 2 queries. that's not great. workaround two alternatives come mind: using join statements in order make query want. eloquent more elegant. leveraging cache class in order make fewer queries in future (this, anyway later on). any ideas? in eloquent can this $post = post::with('comments')->find($id); return $post; edit: not run query join in mysql single query in eloquent.

javascript - Date Object toLocaleString not working properly -

why date , time not work syntax? <script> date.prototype.addhours = function (h) { this.sethours(this.gethours() + h); return this; }; $(document).ready(function () { $("#countdown").countdown({ date: date.addhours(1).tolocalestring(), format: "on" }, function () { // callback function }); }); </script> but work fine: <script> date.prototype.addhours = function (h) { this.sethours(this.gethours() + h); return this; }; $(document).ready(function () { $("#countdown").countdown({ date: "4/5/2014 12:13:16 pm", format: "on" }, function () { // callback function }); }); </script> the change on date property. fyi date constructor, , need new instance of it $...

Function with parameters in Haskell -

i'm trying write few functions have parameters in haskell. for example: make list kinds of colors, want function color orange list, how specify in function? getcolor :: -> getcolor = orange you want function takes list of many colours , returns single colour (presumably of choosing). should start data type represent colours. data colour = red | orange | yellow | green | blue now want function getcolour type getcolour :: colour -> [colour] -> colour which takes colour , list of colour , picks out desired colour list. however, lists can empty, or list might not contain colour want! getcolour return in case? in haskell handle function may not return result using maybe . new type of getcolour is getcolour :: colour -> [colour] -> maybe colour which means getcolour either return nothing , or just colour colour list. lastly, i'll mention there few ways write body of getcolour , using pattern matching , explicit recursion, or sta...

ajax - JTable with annotation in Java -

how can create jtable in java using annotation? this: jtable table=new jtable(products.class). can i? products class several attributes like:id,price,productname. there article , source code in codeproject this: http://www.codeproject.com/articles/36170/simple-and-powerfull-tablemodel-with-reflection there no such annotations comes java runtime (at least now). can implement own method. define annotation mark columns given object: public @interface tablecolumn { string name(); int index(); } mark fields want display in model object annotation: class product { @tablecolumn(name="product name", index=0) string productname; .... } create new tablemodel class -you can inherit defaulttablemodel- , check given annotation given object. class objecttablemodel extends defaulttablemodel { private object[] objects; private string[] columns; public objecttablemodel(object[] objects) { field[] fields = object.class.getdec...

.net - Web Api Caching and "Can't Access Closed Stream" -

i trying use caching library asp.net web api ( https://github.com/filipw/aspnetwebapi-outputcache ) after installing got error , narrowed down class in xmlmediatypeformatter class. cannot access closed stream i believe has task.factory.starnew() or xmltextwriter closing steam somewhere in writetostreamasync method. there way handle code? public class customxmlformatter : xmlmediatypeformatter { public customxmlformatter() { supportedmediatypes.add(new mediatypeheadervalue("application/xml")); supportedmediatypes.add(new mediatypeheadervalue("text/xml")); encoding = new utf8encoding(false, true); } protected utf8encoding encoding { get; set; } public override bool canreadtype(type type) { if (type == null) return false; return true; } public override bool canwritetype(type type) { if ...

opengl - Blend two images using GPU -

i need blend thousands of pairs of images fast. my code following: _apply function pointer function blend. 1 of many functions can pass, not one. function takes 2 values , outputs third , done on each channel each pixel. prefer solution general such function rather specific solution blending. typedef byte (*transform)(byte src1,byte src2); transform _apply; (int i=0 ; i< _framesize ; i++) { source[i] = _apply(blend[i]); } byte blend(byte src, byte blend) { int resultpixel = (src + blend)/2; return (byte)resultpixel; } i doing on cpu performance terrible. understanding doing in gpu fast. program needs run in computers have either nvidia gpus or intel gpus whatever solution use needs vendor independent. if use gpu has opengl platform independent well. i think using glsl pixel shader help, not familiar pixel shaders or how use them 2d objects (like images). is reasonable solution? if so, how do in 2d? if there library great know. edit: receiving image ...

php - Trouble setting interval -

function crimemaketime($until){ $now = time(); $difference = $until - $now; $days = floor($difference/86400); $difference = $difference - ($days*86400); $hours = floor($difference/3600); $difference = $difference - ($hours*3600); $minutes = floor($difference/60); $difference = $difference - ($minutes*60); $seconds = $difference; $output = "$minutes minutes , $seconds seconds"; return $output; } hi, im looking set , interval no refreshing need timers. this have above works fine output, im unable work setinterval. ive searched internet few hours , nothing has seemed work or maybe im doing wrong. any appreciated, many thanks.

php - .com / .se / de - loading same main folder. htaccess -

i have 4 domains, each different extension (.com / .de / .se / .no) i want domains load same main website folder on server, depending on extension language change on site. the domain names not same. eg. ostemad.dk cheeseflavour.com fromage.fr what question here? not need .htaccess style files @ all. files should avoided anyways wherever possible: considerably slow down server, error prone , hard debug. use real server configuration section instead: more clear , secure. you create 1 virtual hosts per domain , assign same document root each. for language switching can either rely on phps superglobal variables , switch depending on request host, or, more elegant, set environment variable inside virtual hosts definition means of apaches mod_setenvif.

asp.net - Correctly Salting a Hash in .NET -

i implementing new password stored procedure companies current product. asp.net application ms sql server. before used 3des encryption off same common seed encrypt, , check users authentication decrypted password using same seed. i implementing sha256 hash, salt can not decrypted. firstly, understand every salt should different per user, don't understand salt stored? if stored in database, doesn't void purpose? my idea creating salt taking first 4 letters of username, first 3 letters of first name, , first 3 letters of last name, , converting md5 hash , using salt without storing in database. this sequence server side no hacker know sequence without source code. is there issues doing here? also sha256 acceptable or should looking @ sha512. thanks "is there issues doing here?" yes, there is. obscurity not security. because salt hard find out doesn't mean it's secure. figuring out how created salt piece of cake compared forci...

latex - Synchronise pdf to Rnw in Knitr with texshop -

would know how synctex work pdf rnw in knitr texshop? work rnw pdf. many thanks. this how worked out. not tried on multiple .rnw files. in texshop preferences, make sure "sync method" set "synctex (tex ≥ 2010)". on mac, make directory "~/library/texshop/rscripts" , put r file "patchknitrsynctex.r" downloaded https://github.com/jan-glx/patchknitrsynctex in directory. create executable file "knitr.engine" including following shell scripts , put in "~/library/texshop/engines/": #!/bin/bash # export path=$path:/usr/texbin:/usr/local/bin # on path! rscript -e "library(knitr); knit('$1')" latexmk -pdf -pdflatex='pdflatex -shell-escape -synctex=1 -file-line-error' "${1%.*}" rscript -e "source('~/library/texshop/rscripts/patchknitrsynctex.r', echo=false, encoding='utf-8'); patchknitrsynctex('${1%.*}')" in r, install package "patchdvi...

c++ - Efficient string to key matching in an unordered_map? -

the efficient way of mapping these strings functions hash-table: std::string a="/foo/", b="/foo/car/", c="/foo/car/can/", d="/foo/car/haz/"; unfortunately things more complicated when want match on simple pattern: /foo/[a-z|0-9]+>/ /foo/[a-z|0-9]+>/bar/[a-z|0-9]+/ i have been told <regex> library overkill needs; , it's overhead considerable. using hash-table ( std::unordered_map ) here might efficient option; [a-z|0-9]+ being checked in single parse within switch/case. number of arguments (split on / ) , using number of / number of arguments decide path take: "/foo/" => {<function>, "/foo/can/", "/foo/[a-z|0-9]+/bar/"} "/foo/xflkjkjc34v" => {<function>, "/foo/can/", "/foo/[a-z|0-9]+/bar/"} "/foo/can" => {<function>, "/foo/can/", "/foo/[a-z|0-9]+/bar/"} "/f...

arrays - Custom index operator C++ -

i having trouble building class makes sure user not access element off end of array, building class mimics behavior of array, adds check. is, class create sequence of elements of given type, , allow access these elements [] bracket operator, check make sure user not try element doesn't exist. here instructions on building it. i have no idea how make index operator case. please me. thanks! here 3 files have far... dvd.h class dvdarray{ dvd *elt; int size; static int defaultsieze; int getsize(); void display(); dvdarray(unsigned int sz); dvdarray(); dvdarray(dvdarray &obj); ~dvdarray(); }; dvd.cpp dvd::dvd(){ id =0; int n=5; title = new char [n]; director = new char [n]; title[0] = '\0'; director[0] = '\0'; } dvd::~dvd(void) { } dvdarray::dvdarray(unsigned int sz){ elt = new dvd[sz]; } dvdarray::dvdarray(){ size = defaultsieze; elt = new dvd[defaultsieze]; } dv...

.htaccess - htaccess append missing .html to URL -

i'm trying check if url ends .html , append if it's missing. i've tried solution past question i'm having no luck testing site: htaccess tester previous questions: here , and here so here's couple tries i've attempted: method 1 rewriteengine on rewritecond %{request_uri} !^/some/thing/(.*)\.html rewriterule ^/some/thing/(.*)$ /some/thing/$1.html method 2 rewriteengine on rewriterule ^/some/thing/(.*)$ /some/thing/$1.html any tips or pointers? quite new .htaccess, in advance! try rule: rewriteengine on rewritecond %{the_request} !\s/+.+?\.html [nc] rewriterule ^(.+?)/?$ /$1.html [l,ne,r]

ios - Getting _detailItem and changing Label data before display -

i have been banging head against desk hour. need detail item passed 1 view controller next, , update view before displaying it. life of me, cannot work properly. here code using: vc#1 (passing data from): -(ibaction)notowed:(id)sender{ inputviewcontroller *input = [[inputviewcontroller alloc]init]; self.tdmodal = input; uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main_iphone" bundle:nil]; inputviewcontroller *viewcontroller = (inputviewcontroller *)[storyboard instantiateviewcontrollerwithidentifier:@"vdi"]; [self presentviewcontroller:viewcontroller animated:yes completion:nil]; [self.tdmodal setdetailitem:@"notowed"]; // setup need mynewvc [self dismisssemimodalviewcontroller:self]; } -(ibaction)owed:(id)sender{ inputviewcontroller *input = [[inputviewcontroller alloc]init]; [self.tdmodal setdetailitem:@"owed"]; self.tdmodal = input; [input setdetailitem...

sublimetext2 - Change HTML + Tab autocomplete (Sublime Text 2) -

Image
when type out word so and press tab autocompletes so... but want more along lines of this this 1 of sublime's built in snippets. can edit default 1 or create new one. edit existing, preferences > browse packages open html folder edit html.sublime-template the default snippet below: <snippet> <content><![cdata[<html> <head> <title>$1</title> </head> <body> $0 </body> </html>]]></content> <tabtrigger>html</tabtrigger> <scope>text.html</scope> </snippet> the content want edit between <![cdata[ , ]]> . $0 , $1 variables placeholders content , once sublime text renders snippet, can move between placeholders pressing tab.

What keeps a php session alive? -

are sessions kept alive each time access page session_start(); or other pages keep alive too? example (with 30 minute timeout): 1 user accesses page session_start(); 25 mins later access session_start(); page session stays alive 2 user accesses page session_start(); 25 mins later access non-session_start(); page session stays alive is 2 true ? there session cookie set in browser whenever access page has session_start() . cookie name phpsessid if website using php(although name can changed). session cookie contains session id helps browser maintain session server. you can check manually browsing website has session , delete browser cookies, session lost. in case both 1 & 2 correct. 2 correct because user has accessed page has session_start() , session id set next 30 mins , present if accesse page not have session. note: page visiting if contains session_destroy() , session destroyed.

javascript - Responsive jQuery script load -

i have script fades in logo based on scroll position (based on daniel stuart's solution: http://danielstuart.ie/2010/09/20/my-jquery-mini-logo/ ) <script> var $scrolled = new boolean(false); jquery.noconflict(); jquery(window).scroll(function () { position = jquery(window).scrolltop(); if(position >=250 && $scrolled == false){ $scrolled = new boolean(true); jquery('.small-logo').fadein('normal', function() { }); }else if(position <250 && $scrolled == true){ $scrolled = new boolean(false); jquery('.small-logo').fadeout('normal', function() { }); } }); </script> the issue site responsive , don't want load when browser width less 768px. how can make happen, or not happen were? $(window).width() need : jquery(window).scroll(function () { if ...

makefile - Make dummy target that checks the age of an existing file? -

i'm using make control data flow in statistical analysis. if have raw data in directory ./data/raw_data_files , , i've got data manipulation script creates cleaned data cache @ ./cache/clean_data . make rule like: cache/clean_data: scripts/clean_data i not want touch data in ./data/ , either make, or of data munging scripts. there way in make create dependency cache/clean_data checks whether specific files in ./data/ newer last time make ran? if clean_data single file, let depend on data files: cache/clean_data: data/* scripts/clean_data if directory containing multiple cleaned files, easiest way write stamp file , have depend on data files: cache/clean_data-stamp: data/* scripts/clean_data touch cache/clean_data-stamp note regenerates clean_data files if 1 data file changes. more elaborate approach possible if have 1-to-1 mapping between data , cleaned files. gnu make manual has decent example of this . here adaptation: datafiles:=...

MySQL PDO Connection Security -

up until point have never had setup users can access mysql (actually mariadb) instance other localhost . however, need setup slave access database on master on private network. issue network in question not that private given fact 2 servers vms , private network shared machines @ location (potentially imagine 100s or 1000s). unclear me if need secure access database private network. is pdo connection string bearing form new pdo("mysql:host=masterprivateip;dbname=dbname;charset=utf8", "slaveuser",'slaveuser@slaveprivateip',... sufficiently secure if use strong passwords or need take other measures ensure integrity of database? should mention in case slaveuser have select grants on database in question.

php - Error with mysql_fetch_array() (CLOSED) -

this question has answer here: mysql_fetch_array() expects parameter 1 resource problem [duplicate] 7 answers reference - error mean in php? 29 answers i trying select multiple data rows database this: $db = mysql_connect("example.example.com","username","password"); mysql_select_db("database", $db); $data = mysql_query("select * users activated = 1", $db) or die("problems database: ".mysql_error($db)); $row = mysql_fetch_array($data); but gives me error: mysql_fetch_array() expects parameter 1 resource although when var_dump($data); tells me resource(6) of type (mysql result) . i have tried various workarounds none of them have worked. tell me what's wrong? thanks in advance. please try ...

angular ui - Next view in AngularJs -

i creating application in angularjs. have created demo application implement feature http://plnkr.co/edit/zzapdzygutpd2m8ju4jr?p=preview in application there 2 link mobile view , desktop view when click on mobile view showing interface shown in mobile devices ( i.e first interface override second one.) when click on desktop view showing interface shown in desktop devices ( i.e left menu having detail in middle of page.) but think config.js can written in more better way , redirection other pages should in other possible way of using $state.current.data != undefined && $state.current.data.parent == 'desktop' i new angularjs please suggest standard way this. check angular-responsive responsive design directives, video present how use it.

c# - Setting nvarchar length to maximum in table valued parameters -

i want pass table valued parameter variable stored procedure , in constructor of class sqlmetadata 1 can specify length (long maxlength) of string 1 wants add in column of table. microsoft.sqlserver.server.sqlmetadata[] tvpdefinition = { new sqlmetadata("valueone", sqldbtype.nvarchar, 100), new sqlmetadata("valuetwo",sqldbtype.nvarchar, 100) } how can 1 go specifying 'max' length corresponds column valueone (nvarchar(max), not null) as opposed length value of 100 example in article on msdn specified can set max size in way sqlparameter myparam = new sqlparameter("@paramname", sqldbtype.nvarchar, sqlmetadata.max ); see last example on above mentioned article. so, without knowing how sqlmetadata class defined, , supposing last parameter size propery of underlying sqlparameter, think write microsoft.sqlserver.server.sqlmetadata[] tvpdefinition = { new sqlmetadata("valueo...

java - JavaScript injection into WebView not working on Android 2.3.6 -

the problem i'm having injecting javascript webview. have problem on android version 2.3.6 , below i'm assuming, don't have test device lower though. code works fine in android 4+ i'm not quite sure why it's failing. seems "submit" form doesn't fill out username , password field in 2.3.6 fails. main goal simulate form fill-out , submit in webview 2 edittexts user doesn't have interact webview itself. when user hits login button runs code: //set needs filled out in webview string javascript = "(function(){ " + "document.getelementbyid('user').value = '" + musername + "'; " + "document.getelementbyid('password').value = '" + mpassword + "'; " + "document.getelementbyid('form').submit(); " + "})()"; //load javascript here mwebview.loadurl("javascript: " + javascript); i'm se...

Gradle project sync fails on new install of Android Studio 0.4.6 -

Image
can't resolve error. gradle project sync fail, android studio 0.4.6 download the following set up, please ask more info if needed. had working 3 months until upgrade 0.5.4 can't resolve on reinstall scratch. os windows 7 x64 gradle build: buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.8.+' } } allprojects { repositories { mavencentral() } } gradle build project: apply plugin: 'android' android { compilesdkversion 19 buildtoolsversion "19.0.3" defaultconfig { minsdkversion 8 targetsdkversion 19 versioncode 1 versionname "1.0" } buildtypes { release { runproguard false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:support-...

io - Echo class in Java -

please me hw assignment. supposed modify echonumber class extends echo class count number of characters in every line in text file in addition displaying text. here echo class: import java.util.scanner; import java.io.*; public class echo{ string filename; // external file name scanner scan; // scanner object reading external file public echo(string f) throws ioexception { filename = f; scan = new scanner(new filereader(filename)); } // reads lines, hands each processline public void readlines(){ while(scan.hasnext()){ processline(scan.nextline()); } scan.close(); } // real processing work public void processline(string line){ system.out.println(line); } } here echonumber class, notice says "your code goes here": import java.io.*; public class echonumber extends echo { // current line number private int linenumber; public echonumber (string datafile) throws ioexception { super( datafile); li...

mpmovieplayer - External Media Player suppport for ios application -

the developer documentation says new api, apps can receive , respond events sent external media players using media player apis using mpplayablecontentmanager class, control interactions between app , external media player. here reference external media players points app's movie player? when app starts, loads data source, either device or server, contains available media items , provides information media player. media player reads , displays information user. can done out new api right? advantages new additions make? the media player interacts app sending events app has registered for. app responds event , changes behaviour based on event received. the mpplayablecontentmanager class use in carplay apps - apple class reference important : class used carplay. using requires special entitlement issued apple. apps without correct entitlement not appear on carplay home screen. see http://www.apple.com/ios/carplay/ more information. this class provide...

vb.net - Regex.Replace unable to make it work -

i expect following code replace every occurence of whitespace+digit+whitespace replacing anything+digit+anything. nswapfirstpart = regex.replace(nswapfirstpart, "\w[0-9]\w", " _ ") thanks you using \w refers non-word character , denoted by [^a-za-z0-9_] so match special characters, spaces, not alphabet, digit or underscore. you need use \s denotes whitespace characters , denoted by [ \t\r\n\v\f] as such, use: "\s[0-9]\s" instead of "\w[0-9]\w"

php - Change css class for the first 3 records extracted from mysql -

i have query extracts product categories , lists them in div. add margin-bottom css class of first 3 records extracts. css .icons-box {padding: 20px 10px 10px 10px;} php: $cat_list = "select * tbl_category cat_parent_id >0 order cat_id asc"; $result_list = dbquery($cat_list); while($row_list = dbfetchassoc($result_list)) { extract($row_list); ?> <div class="icons-box"> <h3><?php echo $cat_name; ?></h3> <p><?php echo $cat_description; ?></p> </div> <?php } ?> how can that? thanks if understand code correctly, add below css: .icons-box p:nth-child(-n+3) { margin-bottom:20px; } more on nth-child mdn the :nth-child(an+b) css pseudo-class matches element has an+b-1 siblings before in document tree, given positive or 0 value n, , has parent element. this can more described...

android - Find the location name where the user is setting -

i'm making small personal application , want know how detect/find user setting, mean example if i'm setting in mcdonald "a" , want have location "mcdonald a" not address or else. tried geocoder gives me many locations address not name example. there others possibility find out name of locations? i don't have code , don't need, didn't find solution, tell me how , make rest. you need find service have places stored in database , have functionality search places. unfortunately there not services cover possible places, might need search ones give place categories want use. one places service recommend here places service, has rest service api defined it. check developer.here.com more info

c++ - Can the expression "(ptr == 0) != (ptr == (void*)0)" really be true? -

i read claim in a forum thread linked in comment @jsantander : keep in mind when assign or compare pointer zero, there special magic occurs behind scenes use correct pattern given pointer (which may not zero). 1 of reasons why things #define null (void*)0 evil – if compare char* null magic has been explicitly (and unknowingly) turned off, , invalid result may happen. clear: (my_char_ptr == 0) != (my_char_ptr == (void*)0) so way understand it, architecture null pointer is, say, 0xffff , code if (ptr) , compare ptr 0xffff instead of 0. is true? described c++ standard? if true, mean 0 can safely used architectures have non-zero null pointer value. edit as clarification, consider code: char *ptr; memset(&ptr, 0, sizeof(ptr)); if ((ptr == (void*)0) && (ptr != 0)) { printf("it can happen.\n"); } this how understand claim of forum post. there's 2 parts question. i'll start with: if true, mean 0 can safely used arc...

javascript - translate a variable amount of input values into a select -

var namelist = editnamebox.children.value; (var f = 0; f < namelist.length; f += 1) { slotname.innerhtml = '<optgroup><option>' + namelist[f] + '</option></optgroup>'; } editnamebox div containing avariable number of inputs want generate value of each editnamebox input option. the code above no work, tried namelist[f].value instead of in namelist var not run. wrong here? full page: http://powerpoint.azurewebsites.net/ set timeslot. "undefined" should content of empty text fields above you should build string loop , update innerhtml. (assuming other portions correct without seeing markup) var namelist = editnamebox.children, slotnamehtml = ''; //build html string (var f = 0; f < namelist.length; f += 1) { slotnamehtml += '<optgroup><option>' + namelist[f].value + '</option></optgroup>'; } ...

asp.net - Web Deploy deleting IIS website custom configuration -

i'm using web deploy (from vs2013) publish asp.net mvc site iis 7.5. i added url rewrite rules , custom http response headers through iis manager. the problem everytime deploy new version of site, configuration deleted. is expected behaviour or there wrong? how can keep these custom settings on each deploy? update so understood need put these changes in web.config . i'm trying put them in web.release.config it's not being added deployed web.config . guess i'm missing xdt:transform rule. this got in web.release.config (yes, publishing profile using release config). <configuration> <!-- other stuff --> <system.webserver> <rewrite> <rules> <rule name="redirect www" patternsyntax="wildcard" stopprocessing="true"> <match url="*" /> <conditions> <add input="{http_host}" patte...

javascript - How to slide/grow a tile to position with 90x90px with CSS -

i want make grid[row1][col1] slide grid[row2][col2] make grow 90x90px any ideas how this? style : <style type="text/css"> #grid { background-color: #ccc0b3; width: 400px; height: 400px; position: relative; border-radius: 5px; } .box { width: 80px; height: 80px; border-radius: 5px; font-family: arial, sans-serif; font-size: 35px; font-weight: bold; display: inline-block; position: absolute; padding: 5px; margin: 5px; text-align: center; line-height: 80px; } </style> javascript : creating class named box function makenew(row, col) { var number = math.random() < 0.9 ? 2 : 4; var color = pikcolor(number); var textcolor = textcolor(number); return grid[row][col] = $('<div>') .css({ background: color, color: "blue...

c# - Getting Error while Inserting the Query -

please me find error in below statements getting error in code. create table statement cmmd.commandtext = "create table users([user_id] autoincrement primary key, username text(50), userpwdtext(200), [isactive] yesno, [modby] long references users (user_id), [moddate] date)"; cmmd.executenonquery(); in database table created successfully. here inserting values through code. cmmd.commandtext = @"insert users ([username], [userpwd], [isactive], [modby], [moddate])values('admin','kov1ozykajas8awoej3oijhrqoi6q=', 'true', '1', 'datetime.now.date')"; cmmd.executenonquery(); the exception data type mismatch in criteria expression update: the recommended way use parameters. using parameterized query not steps around sql injection issues, solves sql server date localization issues well. sqlcommand cmd = new sqlcommand(@"insert users ([username], [userpwd], [isactive], [modby], [...

ruby - Rails 4, create multiple objects - how to permit it? -

how permit parameters: contacts: [ {:value => 'value', :contacts_type => 'contact_type'}, {:value => 'value', :contacts_type => 'contact_type'}, ] to create many objects controller action in 1 json request? like below, contacts array of resources specific attributes value , contacts_type : params.permit(contacts: [:value, :contacts_type])

c# - Unity3d - How to get Animator's Layer -->Sub-State --> State namehash? -

Image
i'm using following structure: (layer) "base layer" --> (sub-state) "jump_fall_roll" --> (state) "roll" static int rollstate = animator.stringtohash("what put here??"); private animator anim; private animatorstateinfo currentbasestate; void start () { anim = getcomponent<animator>(); } void fixedupdate () { currentbasestate = anim.getcurrentanimatorstateinfo(0); if (currentbasestate.namehash == rollstate) { debug.log ("roll namehash worked"); //not working } if (currentbasestate.isname("roll")) { debug.log ("roll isname worked"); //working....... } } i tryed every possible combinaison of parents/states namehash, never worked... the name should in form layer.name, example "base.idle". animatorstateinfo.isname doc unity so, why first case not working? , how can second case work?? i'm confused. edit screenshot of...

c - 2 Functions in 1 main program(Visual Studio 2013) -

i wanna add 2 variables.in main program 2 functions. use visual studio 2013.there appears error c2660: 'function2': function not accept arguments 1 #include "stdafx.h" #include <stdio.h> #include <stdlib.h> double funktion1(); double funktion2(); int main() { double c; { c=funktion1(); funktion2(); //line 14 } return 0; } double funktion1() { double a, b, c; printf("add 2 numbers!"); scanf_s("%lf%lf", &a, &b); c = + b; return c; } double funktion2(double c) { printf("\n result: %lf", c); //line 29 } thx help! you use variable double c in statement printf . @ point, haven't assigned value c . warning, or error in case, telling you. update: when need return value of funktion1 in funktion2 , must pass parameter, e.g. int main() { double c; c = funktion1(); funktion2(c); } /* ... */ void funktion2(double c) { printf("\n result: %lf", c); //l...

c# - XDocument will not parse html entities (e.g. &#xC;) but XmlDocument will -

i converting our old parsers run on xmldocument xdocument. linq querying , added linenumber info. my xml contains element this: <?xml version="1.0"?> <fulltext> hello failed textnode &#xc; , don't know how parse it. </fulltext> my problem while xmldocument seems have no problem reading node with: var xmldocument = new xmldocument(); var physicalpath = getphysicalpath(uploadfolderfile); try { xmldocument.load(physicalpath); } catch (xmlexception xmlexception) { _log.warn("problems document", xmlexception); } the example above parses document fine when try do: xdocument xmldocument; var physicalpath = getphysicalpath(uploadfolderfile); var xmlstream = new system.io.streamreader(physicalpath); try { xmldocument = xdocument.load(xmlstream, loadoptions.setlineinfo | loadoptions.setbaseuri); } catch (xmlexception) { _log.warn("trying clean document hexadecimal", xmlexception); } it fails read...

android - How to repeat a background texture in libgdx -

i developing small game in android libgdx. have given background actor , added scrolling effect. want repeat image in background. thanks in advance what searching called "parallax background". in libgdx forums there thread 2 classes support several layers , different scrolling speeds. furthermore there test uses different approach, modifying camera. i think first classes more clean way it. use myself , works pretty well.

mysql - Order by descending then ascending same column -

how sql order same column differently depending on conditions? in example below, if n/s n , order distfromc desc , if not order distfromc asc , appear table below. name n/s distfromc bh n 2 fv n 1 c c 0 rs s 1 mtn s 2 select tablename.* tablename order `n/s` = 'n' desc, case when `n/s` = 'n' distfromc end desc, case when `n/s` != 'n' distfromc end asc please see fiddle here .

c# - Write Date of last password change -

i in process of making asp.net c# website , need output last time user has changed password label. do need create seperate tabel in database this? or there function can call somewhere? i did research , believe have use: public virtual datetime lastpasswordchangeddate { get; } but cannot find out how implement website examples find use create system force users change password after set amount of time , not write current value string. any appreciated. problem solved, membershipuser u = membership.getuser(); pwchangedatelabel.text = u.lastpasswordchangeddate.tostring("d/m/yyyy"); i'm guessing using sqlmembershipprovider membership provider? you should able use this: membershipuser u = membership.getuser("example@example.net"); txtpasswordchanged.text = u.lastpasswordchangeddate.tostring("m/d/yyyy");

android - How to navigate to previous fragment using back-button within NavigationDrawer? -

i know similar questions have been asked before, can't seem find i’m looking for. problem button exiting app. i’m trying make navigate previous fragment. if open fragment1 - > fragment2 , press button take fragment1. my current code looks this. public class mainactivity extends fragmentactivity { private drawerlayout mdrawerlayout; private listview mdrawerlist; private actionbardrawertoggle mdrawertoggle; private charsequence mdrawertitle; private charsequence mtitle; private string[] mpagetitles; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mtitle = mdrawertitle = gettitle(); mpagetitles = getresources().getstringarray(r.array.menu_array); mdrawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); mdrawerlist = (listview) findviewbyid(r.id.left_drawer); // set custom shadow overlays main content when drawer // opens mdrawerlayout.se...

jquery - remove class active from first parent in accordion -

i have following problem. when click li element adds class active when click li element expand second level menu adds class active , correct when click example second level link adds class active parent li ul inside still has class active how remove class??? <ul class="nav-stacked"> <li><a href="#">link</a> <li><a href="#">link 1</a> <li><a href="#">link 2</a> <ul class="dropdown"> <li><a href="#">second level link</a></li> </ul> </li> <li><a href="#">link 3</a></li> </ul> jquery $(".nav-stacked > li").click(function() { $(".nav-stacked > li").removeclass("active"); $(this).addclass("active"); }); why dont try removing active classes , after add again active class? $(".nav-stacked >...

java - Play Button on a Video Editing program I'm creating not working -

i'm creating video editor , it's going far. need figure out way of playing video frames have stored in array , displaying them on label. i've tried far, doesn't work expected. video frames not playback, instead label displays last frame. i'm wondering i'm going wrong or need take different approach playing these frames. frames captured javafx imageview (originally bufferedimage) @fxml public void playbutton() { (int = 0; < imagelist.size(); i++) { final int ifinal = i; //workaround allow value work in inner class task task = new task<void>() { @override public void call() { try { thread.sleep((long) (1000 / framerate)); previewboxlabel.setgraphic(imagelist.get(ifinal).getimage()); system.out.println("play"); } catch (exception e) { } return null; } ...

Why can't I parse this English date correctly in Java 8? -

i want execute simple example parse string date pattern. string input = "sep 31 2013"; localdate localdate = localdate.parse(input, datetimeformatter.ofpattern("mmm d yyyy")); it throws exception: exception in thread "main" java.time.format.datetimeparseexception: text 'sep 31 2013' not parsed @ index 0 @ java.time.format.datetimeformatter.parseresolved0(unknown source) @ java.time.format.datetimeformatter.parse(unknown source) @ java.time.localdate.parse(unknown source) @ lambda.datetime.main(datetime.java:78) i use java.time package java 8. i'm going assume have non-english locale . if want parse in english, use appropriate locale string input = "sep 31 2013"; localdate localdate = localdate.parse(input, datetimeformatter .ofpattern("mmm d yyyy").withlocale(locale.english)); or other english locale : us, canada, uk, etc. alternatively, locale , ru_ru , ...

ffmpeg - Rotate video, output maximum 1920 x 1080 pixels -

i used ffmpeg.exe -ss 310 -i "h:\_rec\100media\someavi.avi" -ss 0 -t 14 -vf "rotate='54*pi/180:ow=hypot(iw,ih):oh=ow'" -vf scale=1920:1080 "h:\_rec\100media\somemp4.mp4" which should rotate video(currently 1920 x 1080, mjpeg, 30fps) around 54° , fit 1920 x 1080 pixels. what is, ignores -vf "rotate='54*pi/180:ow=hypot(iw,ih):oh=ow'" -vf scale=1920:1080 , returns snippet. what change? ps: ffmpeg version n-59696-gc0a33c4 output: e:\ffmpeg\bin>ffmpeg -ss 310 -i "h:\_rec\100media\someavi.avi" -ss 0 -t 14 -vf "rotate='54*pi/180:ow=hypot(iw,ih):oh=ow'" -vf sca le=1920:1080 "h:\_rec\100media\somemp4.mp4" ffmpeg version n-59696-gc0a33c4 copyright (c) 2000-2014 ffmpeg developers built on jan 8 2014 22:07:06 gcc 4.8.2 (gcc) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --...