Posts

Showing posts from July, 2014

Android : Adding custom view to child of ScrollView -

i having problem scrollview when try add custom view child(relativelayout) of scrollview. it works correctly when remove scrollview. here's xml file <scrollview android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:id="@+id/scrollview"> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/relativelayout" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_alignright="@+id/relativelayout" android:layout_alignend="@+id/relativelayout" android:id="@+id/rlselectable"> <view android:layout_width="match_parent" android:layout_he...

javascript - Click on item to change background image of another -

trying use javascript create "button" of sorts using hovers on li items change background of li item (phonechange). items surround image of phone screenshots i'd change when hovering on related li item. i've been looking similar example here , haven't been able find works me. <ol class="list-b"> <li class="firstphone"><span class="title">first box</span> lorem ipsum sit dolor.</li> <li class="secondphone"><span class="title">second box</span> lorem ipsum sit dolor.</li> <li class="thirdphone"><span class="title">third box</span> lorem ipsum sit dolor.</li> <li class="fourthphone"><span class="title">fourth box</span> lorem ipsum sit dolor.</li> <li class="fifthphone"><span class="title">fifth box</span> lorem ipsum sit dolor.</li...

spring mvc view not rendered -

i'm beginner in spring mvc , trying create basic web app flow. have result.jsp clicking on submit should render submit.jsp . can see controller invoked view submit.jsp not being rendered. gives me http 404 status error no logs in tomcat. can please me figure out went wrong here. i observe when running app, being directed to testspring/ see result.jsp. rather expected be testspring/result.jsp on running app. please pardon ignorance. web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="webapp_id" version="2.5"> <display-name>testspring</display-name> <servlet> <servl...

Microsoft word any way to select from cursor to the end of file? -

i need delete cursor down end of doc. way? far can delete use cursor move down till end. big file. , takes long bottom. tried ctrl-end. not work. i think might help, try shift + ctrl + end

Unzip Code PHP error -

i have these lines of code upload unzip file. can upload file, cannot unzip it. doing in localhost in meantime. appreciated. thanks. have folders zipfiles , unzipfiles . //upload file if(isset($_post['submit'])){ $file_path = "zipfiles/"; $name = $_files['uploaded_file']['name']; $temp_name = $_files['uploaded_file']['tmp_name']; $file_path = $file_path . basename($name); $files = pathinfo($file_path,pathinfo_extension); $file_type = $_files['uploaded_file']['type']; $today = date("y-n-j"); if(move_uploaded_file($temp_name, $file_path)) { echo "success"; $zip = new ziparchive(); $x = $zip->open($file_path); if ($x === true) { $zip->extractto("unzipfiles/"); $zip->close(); } } else{ echo "fail"; } } i tested code , wor...

java - save working but persist not working in hibernate 4.1.1 -

i trying save data usign hsqldb , using hibernate 4.1.4.final. problem want save data using persist when tried it's showing following error: org.hibernate.persistentobjectexception: detached entity passed persist: main.java.entity.advocate @ org.hibernate.event.internal.defaultpersisteventlistener.onpersist(defaultpersisteventlistener.java:141) @ org.hibernate.internal.sessionimpl.firepersist(sessionimpl.java:835) @ org.hibernate.internal.sessionimpl.persist(sessionimpl.java:828) @ org.hibernate.engine.spi.cascadingaction$7.cascade(cascadingaction.java:315) @ org.hibernate.engine.internal.cascade.cascadetoone(cascade.java:380) @ org.hibernate.engine.internal.cascade.cascadeassociation(cascade.java:323) @ org.hibernate.engine.internal.cascade.cascadeproperty(cascade.java:208) @ org.hibernate.engine.internal.cascade.cascade(cascade.java:165) @ org.hibernate.event.internal.abstractsaveeventlistener.cascadebeforesave(abstractsaveeventlistener.j...

haskell - How do I create an arbitrary instance for a recursive datatype? -

i think creates arbitrary lists of length three, how create lists of arbitrary length? import test.quickcheck data list = nil | cons (list a) deriving (eq, show) instance arbitrary => arbitrary (list a) arbitrary = <- arbitrary a' <- arbitrary a'' <- arbitrary return $ (cons (cons a' (cons a'' (nil)))) with sized . enables manage size of generated arbitrary , although semantics instance: instance arbitrary => arbitrary (list a) arbitrary = sized go go 0 = pure nil go n = xs <- go (n - 1) x <- arbitrary return (cons x xs) for comparison, here [] 's arbitrary instance : instance arbitrary => arbitrary [a] arbitrary = sized $ \n -> k <- choose (0,n) sequence [ arbitrary | _ <- [1..k] ]

Modify Shopify Checkout page css -

Image
based on answers question, i've added both checkout.scss.liquid (for responsive checkout, using) , checkout.css.liquid (when scss 1 failed anything) assets. according answers found, shopify search these filenames , include them on checkout pages. doesn't work me. one of these answers included screenshot of checkout settings page (settings > checkout > customize checkout). screenshot shows lot more options see. see are: 1) "use logo" drop down 2) tagline 3) order summary , text entry fields - background 4) colors - accent for example, screenshot shows 3 options under colors - accent, buttons, call action. (would nice able change button color without trying css file work) you can't use custom css checkout unless you're in shopify plus plan. more details at: https://help.shopify.com/themes/development/templates/checkout-scss-liquid in other plans able use options see in theme customizer (like named).

asp.net mvc 2 - How to run a javascript before server code is run MVC2 -

ok, thing this, i have view wich renders chart ( .net charts ) , want chart same size web browser window ( browser ie 9 ). i have tried several examples none works me. since chart gets rendered image, need know size of browser before charts gets rendered ( happens on server side ). my intention people can create chart sending parameters thru url having values view or controller not option. is there way this? here view code <%@ page title="" language="c#" masterpagefile="~/views/shared/charts.master" inherits="system.web.mvc.viewpage<kpidatabase.models.chartmodel>" %> <asp:content id="content1" contentplaceholderid="titlecontent" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <%if (model.series != null) { system.web.ui.datavisualization.charting.chart chart1 = new syste...

python - How is "accuracy" calculated using Libsvm - SVM_Predict.exe -

i using libsvm first time. able train data(for images) , model ready "trainingdata.svm.model" now, when run classification against unknown test data giving me 2 files: 1. trainingdata.svm.prediction (this file contains 1's , 0's) against each of test data. 2. giving me accuracy = 8 % the question: 1. how interpret 1s , 0s in "trainingdata.svm.prediction". note: classifying genders 1 male , 0 female. how accuracy calculated? how can program calculate accuracy since test data unknown entity , not know labels yet. thanks the file "trainingdata.svm.prediction" predicting labels 1 , 0 set (1 means sample predicted male, 0 female). it assumes labels belong class index 0, believe.

c# - Start downloading partial azure blob before it's completed -

is there form of blob (block, page, etc) allow using c# api? machine x uploading file azure blob endpoint, , machine y reading file in real-time. seems me block blob won't work, because need put block list before can query http endpoint it, there way query uncommitted blocks , download beforehand? an example of in practice, user machine handshake server, gets write shared access token server , permission upload file. client #1 machine begins uploading - say, second client machine requests file server client #1 has not finished upload. in case, client #2 relevant details server, , read-only shared access token, , begin read file though upload has not been finished yet. with block blobs don't think possible start downloading blob while still being uploaded. because nothing stored @ time. when upload blocks blob, azure storage stores byte chunks someplace. it when commit block list, azure storage creates block blob arranging byte chunks based on request paylo...

Java code taking input is taking a long time to execute -

import java.util.*; public class main { public static void main(string [] args){ scanner input = new scanner(system.in); int x = input.nextint(); int sum = 0; for(int = 1; <= x ; ++){ if(x % ==0){ sum += ; } } system.out.println ("the sum of factors " + sum); } } the program supposed take in number , print out sum of factors. however, hanging. replaced input code simple (int x=10) code , got desired answer (18). this never finish executing until ctrl+d, because input here system.in , technically doesn't have end "out-of-the-box": new scanner(system.in);

android - Making DialogFragment window scrollable -

Image
i'm having problem dialogs don't scroll when content large screen. assume because dialogs not displayed within scrollable containers. screenshot contains content wrapped in scrollview - can see content scrollable extra fields added artificially increase dialog size example you can see android developer documentation dialogs should wrapped within dialogfragments (this gives benefit of having dialogs survive orientation change , response lifecycle events) , set i'm trying make work. much of other answers i've found similar 1 , revolve around ensuring window set "adjustresize". however, make parent view smaller on keyboard opening, wouldn't make view scrollable if wasn't in scrollable container. if let me know if have info make dialog scrollable or confirm cannot make dialog scrollable i'd appreciate it. this possibly dirtiest , break solution problem: after creating dialog in oncreatedialog() before returning can achiev...

BFS and DFS in java and making the graph -

i'm trying make graph , breadth-first search or depth-first search through graph. how implement graph in java? this abstract question, graph can represented in dozens different ways (different data structures). if you're not familiar graphs recommend start with: map<integer,arraylist<integer>> (adjacency list) sparse graph (when number of edges close minimal number of edges), vertices keys in map, , neighbor vertices values. int[n][n] (adjacency matrix) dense graphs (when number of edges close max number of edges), n - number of vertices.

Lock screen on iOS and Android -

i'm building app phonegap . want create button on screen , add lock-screen event onclick . searches on other posts tries check if screen locked , execute or before something. need event (lock screen) happen when clicking button. it's lock physical button on iphone happens clicking button. i need both ios , android if give me hint one, welcomed. thank you! for android side; as far know app need registered on device admin app. can use device administration api lock screen devicepolicymanager.locknow()

date - Check the timestamp value is in current month or not in PHP -

i want know, how check timestamp(any month, year, date) present in current month or not in php? for.eg 1456132659 example timestamp indicates last month date. want condition if(1456132659 in current month) { //true } else { //false } how can this? simply compare month - if(date('m', 1456132659) === date('m')) { //your code goes here }

cookies - Run javascript function once a week -

i have below javascript function runs on every visit. not want spam our visitors popup on every visit trying head around cookies , running once week. settimeout(function() { jquery(document).one('mouseleave', function() { console.log('mouse left'); jquery('.open-popup-link').magnificpopup('open'); }); }, 10000); i placed within cookie function found on here nothing runs , no errors in console. function setcookie(cname, cvalue, exdays) { var d = new date(); d.settime(d.gettime() + (exdays*24*60*60*1000)); var expires = "expires="+d.toutcstring(); document.cookie = cname + "=" + cvalue + "; " + expires; } function getcookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i<ca.length; i++) { var c = ca[i]; while (c.charat(0)==' ') c = c.substring(1); if (c.indexof(name) != -1) ret...

c# - Remote debug an external executable -

i've followed steps listed in https://msdn.microsoft.com/en-us/library/y7f5zaaa.aspx in order application on server run remotely. good, must debug through code remotely. in step 10 of instructions, specifies executable must built local computer, , copied remote computer. copy executable built visual studio computer newly-created folder on remote computer. my program doesn't run executable built, starts external program. i've place .dll , .pdb files in bin directory of external program. while can start program, , see code runs fine, can't debug code. symbols don't loaded, .pdb in bin directory. feel should possible debug code though starts external program. there step i'm missing? or because not remote debug executable built, not possible remote debug .dlls under external program? after you've built dll file(s), copy them destination computer, , run app on remote computer. after that, should able go debug -> attach process......

c++ - Check char at current/given position in PDCurses/NCurses -

is there way check char @ given position in console window? example if want check if there's asterisk (*) @ position (10, 12), how do that? or if use move(10, 12); , how check char @ current cursor position? i'm using pdcurses. the inch family of functions should that: chtype inch(void); chtype winch(window *win); chtype mvinch(int y, int x); chtype mvwinch(window *win, int y, int x);

ios - Small black bars at top and bottom sides in (6,6s,6plus simulators)when i load Launcher screen -

Image
hi new ios , in app loading launcher screens are(default-568h@2x.png,default.png,default@2x.png,default-414w-736h@3x~iphone.jpeg,default-375w-667h@2x~iphone.jpeg) ok that's fine when run app 4,5,5s simulators screen fitting see 5s simulator screen but when load app in 6,6s,6plus simulators small little bit gap coming @ top , bottom side see below 6 simulator screen what problem sumulator problem or other problem please guide me 5 inch simulator:- 6 inch simulator:- this simulator issue in real device, bars not appear.

algorithm - Verifying a Perceptron Learning Example -

i trying understand perceptron learning algorithm via example presented professor. here understanding. can 1 check if understanding correct? lets have inputs x1 x2 result(y) 1 3 +1 -1 -2 -1 1 -1 1 -2 1 -1 now use below algorithm weights w0=0 1)y1(w0x1)<=0 hence w1=w0+y1*x1=[1,3] 2)y2(w1,x2)<=0 hence w2=w1+y2*x2=[3,-1] 3)y3(w2,x2)>=0 hence no iteration 4)y4(w2,x4)<=0 hence w3=w2+y4*x4=[5,-2] hence weights x1 x2 result(y) weights 1 3 +1 [1,3] -1 -2 -1 [3,-1] 1 -1 1 [3,-1] -2 1 -1 [5,2] is understanding right?or making mistake weights selection /or mistake while making iteration . it looks did correct, there number of comments: you state that, initially, w0 = 0 . not make sense, later add vectors of dimension 2. i'm guessing meant w0 = [0, 0] . fyi: a more general perceptron learning algorithm not add/subtrac...

c++ - What exception handling model does the Clang x64 Windows compiler use? -

i've downloaded 3.7.1 llvm windows x64 (from here ), , wondering if clang++ inside uses seh exception handling or sjlj, or else? in particular, believe seh best on windows dealing c++ exceptions thrown while behind system call, compiler more useful me if uses seh.

office365api - OAuth token submitted with the request can not be parsed -

i'm trying implement client imports events user has in office 365 can display them in company's application. i managed user authenticate / office 365 account , approve application , accesstoken, when try use token retrieve events api, 401 http error code, no body , in headers have this: content-length →0 date →thu, 17 mar 2016 08:56:00 gmt server →microsoft-iis/8.0 www-authenticate →bearer client_id="00000002-0000-0ff1-ce00-000000000000", trusted_issuers="00000001-0000-0000-c000-000000000000@*", token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize", error="invalid_token",basic realm="",basic realm="" x-beserver →db4pr06mb522 x-backendhttpstatus →401 x-calculatedbetarget →db4pr06mb522.eurprd06.prod.outlook.com x-diaginfo →db4pr06mb522 x-feserver →am3pr06ca022 x-powered-by →asp.net request-id →de1963bc-36df-4473-81f6-66ec37e8b41...

android - Retrieving Media from a Content Resolver -

i new in android programming. trying figure out how use code this contentresolver contentresolver = getcontentresolver(); uri uri = android.provider.mediastore.audio.media.external_content_uri; cursor cursor = contentresolver.query(uri, null, null, null, null); if (cursor == null) { // query failed, handle error. } else if (!cursor.movetofirst()) { // no media on device } else { int titlecolumn = cursor.getcolumnindex(android.provider.mediastore.audio.media.title); int idcolumn = cursor.getcolumnindex(android.provider.mediastore.audio.media._id); { long thisid = cursor.getlong(idcolumn); string thistitle = cursor.getstring(titlecolumn); // ...process entry... } while (cursor.movetonext()); } i not sure how process entry or other block of code give out. long id = /* retrieve somewhere */; uri contenturi = contenturis.withappendedid( android.provider.mediastore.audio.media.external_content_uri, id); mmediaplayer = new mediap...

ios - writetofile always returns false -

i trying write content file in swift let jsonresult = try! nsjsonserialization.jsonobjectwithdata(response.data, options: nsjsonreadingoptions.mutablecontainers) as! nsdictionary let filemanager = nsfilemanager.defaultmanager() let urls = filemanager.urlsfordirectory(.documentdirectory, indomains: .userdomainmask) let documentdirectory = urls.first!.path let path = nsurl(fileurlwithpath: documentdirectory!).urlbyappendingpathcomponent("data.txt") let dict = jsonresult nsdictionary let status = dict.writetofile(path.path!, atomically: false) print(status) but content not written file , status false swift 2 let file = "file.txt" //this file. write , read let jsonresult : nsmutabledictionary = nsmutabledictionary.init(object: "08:00:00", forkey: "start_hour"); jsonresult.setvalue("10:00:00", forkey: "end_hour"); jsonresult.setvalue("30", forkey: "call_dur...

jquery - Javascript-Alert box -

i working on single page application using angularjs work on intranet. 1 of requirement after every 15 min have forcefully show message user if working on other program , once click on ok button automatically browser tab need shown. functionality need work on ie11/ie edge/chrome/mozilla firefox. when tried javascript alert box chrome works expected when tried firefox , ie highlight tab. unless user goes tab alert box doesn't shown up. there workaround this? there other solution? i have priority ie/edge. in advance. i haven't messed angularjs, if it's js should take normal js. code seems work me , tested , worked me (having set 1 second). first block function allow repeat, , second block allows code initialize loop. function alertboxtimer(){ window.settimeout(function() { alert('message goes here'); alertboxtimer(); }, 900000); //60*1000*15 = 900000 = 15mins } //initialize alert alertboxtimer();

I am unable to login to admin-dashboard application in WSO2 API manager -

i'm unable login admin dashboard in wso2 api manager. got error "unable log in! login failed " api manager configured ldap read primary user store. our ldap not have groups , roles not red ldap. additionally api manager configured work mysql db , wso2 key manager. think not reason of such behavior. if configure api manager standard user store (without changes user-mgt.xml) login admin-dashboard works ok. this problem resolved. in file /repository/deployment/server/jaggeryapps/admin-dashboard/conf/site.json i changed "admin" role name '"internal/admin": "allowedrole":"internal/admin", "allowedroles":"internal/admin,internal/subscriber" now can connect admin-dashboard. think internal necessary because of readonly ldap user store without groups.

redhat - Yum not updating on Red Hat Enterprise Linux Server release 6.2 (Santiago) -

i trying update server. using red hat enterprise linux server release 6.2 (santiago). if enter command such yum update yum , receive following error: [root@u15457812000001 ~]# yum update yum loaded plugins: rhui-lb not retrieve mirrorlist https://rhua-rcd-01.vic.svc.cloud.telstra.com/pulp/mirror//content/dist/rhel/rhui/server/6/6server/x86_64/optional/os error 14: peer cert cannot verified or peer cert invalid error: cannot retrieve repository metadata (repomd.xml) repository: rhui-rhel-6-server-rhui-optional-rpms. please verify path , try again can please help?

mysql - want the result of all employee even though he has not done any activity on particular day -

i have 4 tables; employee_details columns emp_code , emp_name actual_all_details columns emp_code , date , activity_id , card_id , , quantity activities columns activity_id (primary key) , activity cards columns card card_id (primary key) , card_type activities : activity_id activity 1 tape laying 2 embossing 3 courier packing 4 thermal cards card_id card_type 1 barcoding 2 big ribbon 3 biman employee_details emp_code emp_name 1 shraddha 2 mayuri 3 kishori actual_all_detalis table: emp_code date activity_id card_id quantity 1 2015-12-19 1 2 266 2 2015-12-19 1 3 300 3 2015-12-19 3 2 400 now query return emp_code activity though has not done employee on particular day , should return activity related card type. example, result sho...

Making a set data type with list data structure in Haskell -

write insert , member operations in haskell. make sure in ml , haskell set data type distinct list. in haskell, define set type instance of classes eq , show. let setadd l n = if (elem l n) l else l ++ [n] let setmember l = l !! the code written above makes have functions perform on lists. is there way make class? sorry, i'm learning functional programming. there way make set class has member variables such list? your data type here [a] , has such instances available, including eq , show (that way right thing). if want have write own instances, should newtype underlying type, in fashion similar to: newtype set = set { getset :: [a] } then can write: instance show => show (set a) show (set a) = ... instance eq => eq (set a) set == set b = ...

r - Check which words show up at least once within words from another vector -

let's have list of words: words = c("happy","like","chill") now have string variable: s = "happymeal" i wanted check word in words has matching part in s. s "happytime", "happyface", "happyhour", long there's "happy" in there, want result return index of word "happy" in string vector words. this question similar not identical question asked in post: find string in string in r . you can loop through each of words you're searching sapply , using grepl determine if word appears in s : sapply(words, grepl, s) # happy chill # true false false if s single word sapply grepl returns logical vector can use determine words matched: words[sapply(words, grepl, s)] # [1] "happy" when s contains multiple words, sapply grepl returns logical matrix, , can use column sums determine words showed @ least once: s <- c("happytime", "c...

progress - How to trigger Workflow Action one by one by approvers in Rollbase? -

i trying make application in progress rollbase platform, can - how configure approver action module in rollbase in way shows request immediate approver only(not approvers @ once selected approval of request) i.e. after approval of first, should ready approval second approver in list. - second issue facing how approval same 2 persons(approvers) twice @ 2 separate stages of approval of same request? any regarding appreciated. the approvals app feature not cater requirements. better off implementing approval process using workflows feature. need couple of fields created in object track status of approval (apart workflow's status field) , send next to. let me know if still need implement , can work our way through this.

android - How To Create App Folder Programatically? -

i want create app folder when 1 app come on app on home screen / app drawer (as default android system/launcher provides). i searched lot shows either livefolder or shows how can use it(using system default feature). want implement programmatically. if knows how make possible.

mysql - How can I prevent SQL injection in PHP? -

if user input inserted without modification sql query, application becomes vulnerable sql injection , in following example: $unsafe_variable = $_post['user_input']; mysql_query("insert `table` (`column`) values ('$unsafe_variable')"); that's because user can input value'); drop table table;-- , , query becomes: insert `table` (`column`) values('value'); drop table table;--') what can done prevent happening? use prepared statements , parameterized queries. these sql statements sent , parsed database server separately parameters. way impossible attacker inject malicious sql. you have 2 options achieve this: using pdo (for supported database driver): $stmt = $pdo->prepare('select * employees name = :name'); $stmt->execute(array('name' => $name)); foreach ($stmt $row) { // $row } using mysqli (for mysql): $stmt = $dbconnection->prepare('select * employees name = ?'); ...

Error installing ionic -

Image
thanks , interest :) λ npm install -g ionic c:\users\gueddou\appdata\roaming\npm\ionic -> c:\users\gueddou\appdata\roaming\npm\node_modules\ionic\bin\ionic node-sass@3.4.2 install c:\users\gueddou\appdata\roaming\npm\node_modules\ionic\node_modules\node-sass node scripts/install.js binary downloaded , installed @ c:\users\gueddou\appdata\roaming\npm\node_modules\ionic\node_modules\node-sass\vendor\win32-ia32-14\binding.node npm err! windows_nt 6.1.7600 npm err! argv "c:\program files\nodejs\\node.exe" "c:\program files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "ionic" npm err! node v0.12.7 npm err! npm v2.11.3 npm err! code elifecycle npm err! node-sass@3.4.2 install: node scripts/install.js npm err! exit status 1 npm err! npm err! failed @ node-sass@3.4.2 install script 'node scripts/install.js'. npm err! problem node-sass package, npm...

Ruby - Threads and Dir[] arrays -

i have built ruby script creates folders, moves file new folder , invokes system() call trigger ffmpeg. have turned 4 threads can 4 concurrent transcodes @ time. here example 2 threads (minus folder structure creation , file move functions): def transcode_process_1 dir["path/file/source/*.mxf"].each |f| random_folder = #code random folder creation file_move = #code move .mxf file random_folder processing system("ffmpeg -i #{random_folder} command 2> /path/file/#{random_filename}.txt") sleep(2) end end def transcode_process_2 sleep(3) dir["path/file/source/*.mxf"].each |f| random_folder = #code random folder creation file_move = #code move .mxf file random_folder processing system("ffmpeg -i #{random_folder} command 2> /path/file/#{random_filename}.txt") sleep(4) end end transcode_thread_1 = thread.new{transcode_process_1()} transcode_thread_2 = thread.new{transcode_process_2()} transcode...

Wrap links in text within hyperlinks - Ruby On Rails -

i have description news. display news text, used simple_format wraps new lines <p></p> tags. however, news text may contain links. need wrap links within text <a></a> tags. it helpful if give insights on how that. sample text: lorem ipsum dolor sit amet, consectetur adipisicing elit. ad, ea esse magni obcaecati quasi quis soluta velit. accusamus doloribus ea et ex officia, pariatur quia saepe sed tempore temporibus totam https://stackoverflow.com/posts/36058019/edit desired output: lorem ipsum dolor sit amet, consectetur adipisicing elit. ad, ea esse magni obcaecati quasi quis soluta velit. accusamus doloribus ea et ex officia, pariatur quia saepe sed tempore temporibus totam? <a src="https://stackoverflow.com/posts/36058019/edit">https://stackoverflow.com/posts/36058019/edit</a> my approach for solved following function. first split string newlines ensure simple_format insert appropriate p tags. then, match texts u...

asp.net mvc - How to Customize Bootstrap 3 Navigation Menu based on Identity 2 User Role? -

i've created asp.net web application using identity 2 , have defined several roles. role based authorization in place. controller class action methods have been decorated authorize commands specifying roles can use controller method. at point, need customize bootstrap 3 navigation menu administrators see menu options, members of role see theirs etc. in day, used use sitemap membership provider unsure how in plain ole mvc 5. guidance appreciated! you can use user.isinrole() render links conditionally. @if (user.isinrole("admin")) { @html.actionlink("admin dashboard", "index", "dashboard") } this might help.

mysql - Can anyone please rectify this error in the below SQL code? -

Image
create database android_api /** creating database **/ use android_api /** selecting database **/ create table users( id int(11) primary key auto_increment, unique_id varchar(23) not null unique, name varchar(50) not null, email varchar(100) not null unique, encrypted_password varchar(80) not null, salt varchar(10) not null, created_at datetime, updated_at datetime null ); /** creating users table **/ i'm running on mysql 5.5 add ";" create database android_api; /** creating database **/ use android_api; /** selecting database **/ create table users( id int(11) primary key auto_increment, unique_id varchar(23) not null unique, name varchar(50) not null, email varchar(100) not null unique, encrypted_password varchar(80) not null, salt varchar(10) not null, created_at datetime, updated_at datetime null ); /** creating users table **/

java - Creating and extending JPA entity classes at runtime from config file -

i have 3 entity classes , more stuff. want create tool in user can create new entity classes and/or add additional fields existing 3 entity classes including jpa annotations (eg. extend them). tool should use kind of textual format (like xml) , generate classes config file. is jaxb right tool this? since i'm new point me tutorial this? note not want serialize objects create new class xml file. if tool can use xml jaxb choice generate java classes. jaxb can convert xml schema , generate classes. here useful article understand how jaxb works , may understand how can solve problem: http://www.javaworld.com/javaworld/jw-06-2006/jw-0626-jaxb.html

android - Create Multiple Fragments Dynamically for Dynamic Tabs -

i have requirement , not know how accomplish this. can guys me out done. below flow is i have main category list, user can tap sub categories (fetch server) , based on result displaying list of subcategories child category well. next creating tabs based on child categories. now problem creating fragments number of tabs. childs can 1 n number, know best way create fragments dynamically. once each fragment have display list of items fetched server. thank you you can use following code snap you need create corresponding layout xml viewpager pager; viewpageradapter adapter; private list<fragment> fragments; arraylist<string> titles; @override protected void oncreate(bundle savedinstancestate) { fragments = new arraylist<fragment>(); titles= new arraylist<string>(); pager = (viewpager) findviewbyid(r.id.pager); adapter = new viewpageradapter(getsupportfragmentmanager(), tit...

javascript - Dynamic width for a disabled input data -

Image
first of did try researching how make input dynamic based from width of data answers see input not disabled. trigger key or onclick not applicable mine since input disabled. this screenshot of problem. can see amount in words in pesos cut , not dynamically expanding. this html: <table width="100%"> <tr> <td> <div style="height:35px"> <div style="float:left" class="controllabelbold">check number:</div> <div style="float:left"> <input type="password" name="checknumber" class="text ui-widget-content ui-corner-all" style="width:250px; height: 17px;" /> </div> </div> </td> <td> <div style="height:35px"> <div style="float:left" cl...

no viable overloaded '=' error C++ -

i'm trying store proper ticket variable (either t1 or t2) t3 can return main. when use "=" set either t1 t3, says "no viable overloaded '='". following code: using namespace std; class ticket { public: ticket(); double input(); double output(); friend ticket operator *(const ticket &t1, const ticket &t2); friend ticket operator /(const ticket &t1, const ticket &t2); private: void cost(); string name; double miles, price; int transfers; }; the variable c1 , literal '\0' of type char , not instances of character structure. the types char , character totally unrelated , can't convert between two. a simple solution create conversion constructors character structure, accepts single char argument , initialize structure character. or create character structure , explicitly set correct member character want.