Posts

Showing posts from 2015

How to mention the localhost in android -

i trying call localhost in android application. unfortunately not possible used several methods emulator local host http://10.0.2.2/android/dbconnection.php and network ip address http://192.168.1.xx/android/dbconnection.php also http://localhost:8080/android/dbconnection.php but nothing connected localhost. purpose refer stackoverflow answers not working i facing same problem when worked on localhost. referred stackoverflow answer got solution create new emulator works fine in new emulator.

Best-practices sharding complete MongoDB -

we changed logic in our mongodb-setup follows: half of replica-sets in cluster contain databases , corresponding collections not sharded. other half contain sharded collections. while databases still spread around replica-sets curious know: there disadvantage in having database on server doesn't hold of collections? there kind of meta-data held mongodb waste ressources? is there disadvantage in having database on server doesn't hold of collections? this never case sharding. collections start on first (master) server, contains database (i think of enabling sharding on database level, do), , scale out across other shards (replica sets). the databases , collections made on other shards data needed moved them. as such further questions have been mad inert knowledge. edit "which contains database" i mean copy of database. this hinted next paragraph state databases , collections made on each shard needed. the shard, or rather replica set i...

How to get the Captured Image's Creation Dates in Android -

iam developing 1 android application, in iam using camera functionality. there way captured images's creation dates in android? thanks help. through exif interface, if camera write it. take here exifinterface exif = new exifinterface(pathtotheimage); string datetime = exif.getattribute(exifinterface.tag_datetime);

php - How i can return specified fields in mongodb find() coursor? -

i try: $fields = array('name'=>true); find (array(array(), $fields)) but it's not working (i nothing) , can't see mistake. sorry :( the php function find not work that. try: find(array(), array('name'=>1)) (basically omit surrounding array ) for reference here documentation page: http://php.net/manual/en/mongocollection.find.php

Coordinates-based text display upon an image with Django's template system -

Image
i trying update excel-map data fetched django , display on page linked admin. the excel-"map" : using xlrd & cie libs i'm working on fetching / updating data part fellow dev told me have used image instead. my question : how such thing ? displaying copy of above spreadsheet , using row-based coordinates write data want ? (text data) do guys know way work coordinate-based text display in django's templates ? thanks can give me ! i ended using pil library. quite easy , summarized following code : from pil import image pil import imagedraw pil import imagefont im = image.open('path/to/map.png') font = imagefont.truetype('/usr/share/fonts/dejavu/dejavusans.ttf', 7) draw = imagedraw.draw(im) draw.text((x, y), sentence, font=font, fill='black') response = httpresponse(mimetype='image/png') im.save(response, 'png') return response logic behind x , y irrelevant here, bear in mind start quite illogica...

c# - Winforms user control class accessible by all application -

i'm creating winforms application needs control class manage app components. i thinking class inherits component , glued in main form of application. how access control class point of application? correct way this? or should change mind architecture? you create static class or single instance class , use allover application. note: static class should inherit system.object using way not possible inherit component if require derive component can go single instance approach. check out singleton implementation hope helps

javascript - Load scripts in bootstrap modal when getting fragment of page -

i'm getting fragment of page , loading in bootstrap modal. this fragment of page includes jquery required load google maps when modal loads content, scripts getting stripped subsequently, maps don't load. even if directly insert scripts inside modal-body class, still stripped. is there workaround @ all? what we're using trigger modal is:- <a href="/stores .topclass" data-target="#storesmodal" data-toggle="modal">launch demo modal</a> i can provide further code in use if needed answer accurately. === edit: providing more code in use on request... so we're including sitewide link triggers bootstrap modal. link triggering modal can seen above , here rest of code in relation modal . what wish load in modal fragment of page @ /stores , code loaded @ url can seen here . page though, wish load inside .modal-container on line 192 necessary scripts reside outside of div in same file, aren't capturing when try lo...

c# - EF Multiple foreign keys only 1 required -

i have entity defines properties number of different entityies. eg. class user{ icollection<propertyentity> properties {get;set;} } class company{ icollection<propertyentity> properties {get;set;} } when delete propertyentity either user or company. myuser.properties.remove(someproperty); the propertyentity isn't deleted, has it's foreign key set null. i understand use [key] annotation define foreign key. presumably require both keys instead of either? how ef structure relationship either user or company can have many propertyentitys. propertyentity deleted if doesn't have user or company? if relationship optional there no way define relationship removing child navigation collection delete database. you have either call dbset<t>.remove child... myuser.properties.remove(someproperty); if (!someproperty.companyid.hasvalue) context.propertyentities.remove(someproperty); ... (which automatically remove child collection) o...

Using the Scala collections (immutable) from Java -

is possible use scala immutable collections (hashmap, list, vector, etc.) java code? realize of method names may end looking "funny" , contain "$". i have legacy application written in java. cannot convert code @ time, use immutable data structures improve concurrency (multiple reads every write). yes, need put scala-library.jar in classpath. see this thread example using scala immutable lists in java as alternative, clojure offers persistent data structures e.g. persistenthashmap come java source code, method names won't odd

php - How to know how many items a choice field has inside the controller - Symfony2 -

i want count choice's items after form has been created. field simple symfony's choice field query_builder create items. how can achieve this? <?php class mycontroller { public function indexaction() { $form = $this->createform(new myformwithchoicefieldtype()); // suppose field named "countries" $items = count(???); } } thanks in advance. here's how categories. notice have categoryrepository. can use methods repository inside query_builder options in formtype classes , in controller. my findallcategories() method returns query builder object, therefore can have method in repository called countcategories() returns scalar count of same query builder object. this allows me access count method in controller , makes sure couting consistent query builder using find categories. this simple example becomes more useful if have more complex finder methods joins , clauses. in controller: <?php ...

mysql - Database implementation of formatting -

i have database this: text_id | sentence_id | word_id | word | meaning 4 2 124 ja 4 2 124 lubiÄ™ 4 2 124 trains. pociÄ…gi where "ja", "lubiÄ™" , "pociÄ…gi" unique translation in particular context. the thing need sometimes, format text, example bold word "trains" in on website. or surround 1 of sentences with: <h1> </h1> tag. i have no idea how save information formatting in not obtrusive way. thanks help. ps: need no fancy formatting, need save information new paragraphs "p" headers "h1" "h2" , on. maybe save information image between particular sentences. ps2: use mysql. from understand take information in database , export out html file of sort. in order must: 1) retrieve information database using query similar following. $query = select word, meaning $dbname 2) s...

javascript - getAttribute printing in console but causing errors -

i'm parsing xml feed , seems working fine. encountering problem when trying extract attribute within tag. i using titanium , getting error debug on line declare str3, however , console is printing correct data?? how be? code below: var str3=items.item(i).getelementsbytagname("enclosure").item(0).getattribute("url"); console.log("mp3 test 2-------------"+str3); i tried include test if (str3 null) i'm still getting error when trying test it. appreciated! var str3=items.item(i).getelementsbytagname("enclosure")[0].getattribute("url");

java - How to mention URL while submitting ajax form? -

i using html/jquery/ajax call servlet. submitting form servlet. gives 404 saying resource not found. have maven project. i have servlet in src/main/java package : com.mycompany.sample i have jsp in webapp/public folder. in web.xml registered servlet using url pattern /mycontroller in jsp gave action form below: <form action="mycontroller" ............... and have separate .js file mentioned ajax call below" $.ajax({ type: "post", url: "mycontroller", data: datastring, success: function(msg) { alert('success'); }, error: function(ob,errstr) { alert('onfailure'); } }); but 404 error saying /mycontroller resource not found , onfailure alert. am giving correct reference mycontroller in form , in ajax call? thanks! like other say, try full path because think cause of 404 missing application context. i don't k...

java - JTable, refreshing rowData vector in static context -

i've declared jtable (inside class extended jpanel constructor) such as data_table = new jtable(info, header) { @override public boolean iscelleditable(int row, int column) { //disable table editing return false; } }; where info , column declared static string[][] info = new string[row][cols]; static string[] header = {"h1", "h2", "h3"}; now need update, when events occours, table content invoke static method. how can it? i don't have tablemodel, i've matrix of string all tables use tablemodel. when create table matrix of strings used tablemodel. to update data like: table.setvalueat(...); this cause model updated , model tell table repaint itself. read swing tutorial on how use tables more information tables. also, should not using static variables or method. if program poorly designed. again read tutorial better example of how structure code.

In sqlite3: copy a column from one table to another table -

there several other stackoverflow inquiries topic, none of them have satisfactory answer. i have table beerreviews, missing column (review_text), , table beerreviewswithtext missing different column (brewery_name). otherwise table rows ordered same way, append brewery_name column beerreviews beerreviewswithtext. i launch sqlite3 as: sqlite3 beer_rewiews_with_text.sqlite then attach beer reviews table via: attach 'beer_reviews.sqlite' br i added empty column beerreviewswithtext via: alter table beerreviewswithtext add column beer_brewername varchar; multiple other questions suggest using insert fill column, appends new rows table, populating beer_brewername column. insert beerreviewswithtext(beer_brewername) select brewery_name beerreviews; instead, update seems fill in null values, when run following (similar another question's answer ) of beer_brewername values identical: update beerreviewswithtext set beer_brewername=(select brewery_name br.bee...

asp.net mvc - Issue regarding posting data to controller using jquery $.post -

Image
i have 2 dropdown 1 country , 1 state. when first time form render country dropdown populated , state dropdown disable. when user select country partial post occur jquery , controller action method called return json data. problem occur when user select country saw overloaded index method called , return json firebug showing error network error. here giving controller code , cshtml code. please tell me wrong there cshtml code @{ viewbag.title = "home page"; } <script src="@url.content("~/scripts/jquery-1.5.1.min.js")" type="text/jscript"></script> <script type="text/jscript"> $(function () { // $('#countryid').change(function () { // var url = $('#formid'); // alert(url); //// $.getjson('/ddl/districtlist/' + $('#state').val(), function (data) { // }); // }); ...

c# - Visual Studio displaying errors even if projects build -

i have problem visual studio 2013 on c# solution. displays totally random errors, projects build. right now, have 33 files errors, , can see red squiggly lines in of them. i tried cleaning / rebuilding solution, closing visual studio , restarting computer. made sure steps described in debugging runs compiler's errors in visual studio . can modify .cs files , see changes in solution. does have idea why that? apparently, emptying resharper cache: in menu, resharper > options > environment > general > clear caches and disabling , re-enabling resharper: in menu, tools > options > resharper > general > suspend / restore did trick me. not sure if both operations necessary, solved problem.

php - jQuery AJAX return 404 error -

i try use ajax send form data server, returns me 404 time. here code: $(function() { var datastring ='name: '+conditionname+"&desc: "+conditiondescription+'&condition: '+condition; //alert (datastring);return false; $.ajax({ type: "post", url: "savecondition.php", data: datastring, success: function(response) { alert ('data saved: '+datastring); }, error: function (xhr, ajaxoptions, thrownerror) { alert(xhr.status); } }); return false; }); "savecondition.php" in same folder .js file use wamp server on local machine. update: when changed path "savecondition.php" relative html page, got error 500 the path of url requested ajax relative root of page you're on, i.e. if page in root directory (let's call index.html) along ajax script (data.php), , jquery script in js directo...

r - How to perform RMSE with missing values? -

i have huge dataset 679 rows , 16 columns 30 % of missing values. decided impute missing values function impute.knn package impute , got dataset 679 rows , 16 columns without missing values. but want check accuracy using rmse , tried 2 options: load package hydrogof , apply rmse function sqrt(mean (obs-sim)^2), na.rm=true) in 2 situations have error: errors in sim .obs: non numeric argument binary operator. this happening because original data set contains na value (some values missing). how can calculate rmse if remove missing values? obs , sim have different sizes. how simply... sqrt( sum( (df$model - df$measure)^2 , na.rm = true ) / nrow(df) ) obviously assuming dataframe called df , have decide on n ( i.e. nrow(df) includes 2 rows missing data; want exclude these n observations? i'd guess yes, instead of nrow(df) want use sum( !is.na(df$measure) ) ) or, following @joshua just sqrt( mean( (df$model-df$measure)^2 , na.rm = true ) ) ...

java - Template recursive structure with apache velocity -

i have recursive data structure, tree, node may have child nodes , on. i'm trying generate json-like file of structure. thought of using #parse directive. in context store root node , in templatename template's name. { "name" = "$node.name", "value" = "$node.value" #if ($node.childrens.size() > 0) , "childrens" = { #foreach ($child in $node.childrens) ## next statement not work #parse ($child.type + ".vm", $child) #end } #end } the apache velocity documentation states #parse directive only takes 1 argument . in examples have seen use of #set directive before calling template, if depth of tree higher 2 not work because variable used in #set directive stored in same context when going depth 1 2 variable overwritten. the reason use #parse instead of macro suggested @sergiu dumitriu because each node may rendered in different way depen...

bi publisher - PHP sending data to BIPublisher plugin -

i asked study proof of concept , can't find telling me following can solution. indeed, have process data find .docx or .rtf template have use , build xml file can loaded oracle bipublisher plugin in ms word . getting , processing data isn't quite difficult but, browser's security can't open ms word on client-side. thinking making them download * .docx or .rtf file *s have been modified bipublisher conditional structures written in templates. do know if can interact presintalled ms word plugin bip using php script ? actually can interact bi publisher word plugin in php. first make sure java, word , bi publisher plugin works, think have done. create xml file this: <tb> <type>pdf</type> <template>absolute path rtf template</template> <data>absolute path xml data</data> <xlifffile></xlifffile> <tmppath>c:\users\<user name>\appdata\local\oracle\bipublisher\templatebuilderforw...

Skip the pause command in a batch from a java process -

i'm using java process class execute batch files. i'm using processbuilder create process , part run fine. problem deal pause command in batch file i'm running. pause command hanging execution of batch, need batch finish, can resume pending operations. currently, i'm starting batch code equivalent this: import java.io.bufferedreader; import java.io.file; import java.io.inputstreamreader; import java.util.arrays; import java.util.list; public class batchenter { public static void main(string[] args) throws exception { list<string> params = arrays.aslist(new string[]{"cmd", "/c", "c:/test/test.bat"}); processbuilder builder = new processbuilder(params); builder.directory(new file("c:/test")).redirecterrorstream(true); process p = builder.start(); bufferedreader wr = new bufferedreader(new inputstreamreader(p.getinputstream())); string line = ""; ...

javascript - How can I get the country and region code using geolocation instead of full country and region names -

i'm building website uses geolocation in html5 provide service specific region in user is. here have been doing: use javascript in so question country , administrative region names. search country , region names in database , returns location-specific data can display. here script: <script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> <script> var region = ""; var country = ""; function getlocation() { if (navigator.geolocation) { navigator.geolocation.getcurrentposition(showposition,nogeolocation); } else { ... } } function showposition(position) { var geocoder = new google.maps.geocoder(); var latlong = new google.maps.latlng(position.coords.latitude,position.coords.longitude); geocoder.geocode({'latlng': latlong}, function(results, status) { if (status == google....

How to execute another exe from a C++ program in Windows -

i want c++ program execute .exe, in windows. how this? using visual c++ 2010. here code #include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _tchar* argv[]) { unsigned int input; cout << "enter 1 execute program." << endl; cin >> input; if(input == 1) /*execute program here*/; return 0; } you can use system function int result = system("c:\\program files\\program.exe");

Codeigniter - PHP - encode and decode session userdata before is store and when is returned -

i extend session.php library in codeigniter. i use base64 encoded/decoded session values . so encode globally session data before setted (session->set_userdata()) , decode when returned (session->userdata('item')) is possible? i'm in trouble how fire moment session data gonna setted , moment when data gonna returned? i'm using codeigniter session db , planning write my_session.php library can't go on, i'm blocked here: class my_session extends ci_session{ } any appriciated, thanks you need override session library's implementations of session->set_userdata() , session->userdata() . class my_session extends ci_session{ public function set_userdata($data, $singlevar = null) { if(is_array($data)) { foreach($data $key => &$value) { //encode $value } parent::set_userdata($array); } else { //encode $singlevar ...

validation - Ember How validate form? -

i research validate form. understand ember not know how work attributes validation html5(required, pattern ). need created functions algorithm validation in model each form. , run function when click submit button i have question: have possibility show standard html5 error message not valid input? for example: check fields(in ember model) , 1 field not valid. need field show notice field not valid @ html5(maybe run element valid() function) how that? have @ project ember-easyform , introductory blog post . makes creating forms in ember lot easier, , includes validation. hope helps.

iphone - Should I have multiple AFHTTPClients to organize my code -

we're using afnetworking make versioned api requests our mobile app. in order target specific versions of our api, our app sends special accept header. i've organized codebase each resource (user, session, image, etc.) has it's own afhttpclient sets accept header upon initialization. + (usersapiclient *)sharedclient { // removed singleton setup code brevity // here's version gets set requests pertaining users __sharedclient = [[usersapiclient alloc] initwithbaseurl:url andversion:2]; return __sharedclient; } i set way each request (create user, edit user, user) wouldn't have worry version call; done when specific apiclient created. this system working great i'm questioning if how should doing this? have 9 objects, that's 18 files (.h, .m) on top of baseapiclient class inherits from. should of networking code dropped in 1 file, , each request sets appropriate accept ...

Undefined reference Android NDK -

i'm working android ndk , code appears when compiling undefined reference avi_open_input_file , , eclipse appears could not find symbol avi_open_input_file in index , library have in project, not take account if not exist, , been looking @ forums , not fix it local_path := $(call my-dir) include $(clear_vars) # local_module := main local_module := principalencoder local_src_files := principalencoder.cpp local_ldlibs := -lglesv1_cm -llog include $(build_shared_library) # second lib, depend on , include first 1 include $(clear_vars) local_module := avilib local_src_files := avilib.c local_whole_static_libraries := libstlport_static include $(build_shared_library) your android.mk builds 2 shared libraries, not declare dependencies between them. want use following: local_path := $(call my-dir) include $(clear_vars) local_module := principalencoder local_src_files := principalencoder.cpp local_ldlibs := -lglesv1_cm -llog local_shared_libraries := avlib incl...

rest - how to see httpS request & headers on win? -

i'm working on developing tests work rest api. have restclient in firefox , eclipse run requests through httpsurlconnection. problem when send same requests through restclient , java - different responses. i’ve been having problem forever.. i’d find way around after sometime. super helpful if see requests sent , compare it... i don't have adminrights on pc, looking portable apps. have wireshark wouldn't help. try tool, called burpsuite. can install cert burpsuite , once set able read requests. http://portswigger.net/burp/ hope helps.

optimization - calculating correlations efficiently in R? -

this optimization problem i'm hoping creative users may have answer to. i have large matrix (5 million x 2) 2 values: time , type. in essence, each "type" own time series -- below data represents 3 different time series (one a, 1 b, , 1 c). there 2000 different "types". mat time type [1,] 50 [2,] 50 [3,] 12 b [4,] 24 b [5,] 80 b [6,] 92 b [7,] 43 c [8,] 69 c what efficient way me find correlation between these 2000 time series? producing matrix there different bins each time event have occurred, , populate matrix how many events of each "type" occurred in time slot. after populating matrix, loop on each pair of "type"s , find correlations. extremely inefficient (~5 hours). my whole problem solved if there exists way implement by='type' feature in cor function of r? thanks insight. you can try this set.seed(1) df <- data.frame(time = rnorm(15), type = rep(c("a", ...

javascript - jquery not adding class when using eq() -

having bit of trouble when using this: $('.instrumentselect').click(function(){ var thiselement = $(this).index(); $('.instrumentselect').eq(thiselement).addclass('active'); $('.active').removeclass('active'); }); removes class fine, console logged var thiselement , returns correct index, not appending class it. fire bug not return error. i'm not sure you're trying do, removing class first , adding later makes more sense. also, why using index , eq() when can add class $(this) ? try this: $('.instrumentselect').click(function(){ $('.active').removeclass('active'); $(this).addclass('active'); });

php - Redirect website based on Geographical location in Magento store -

i have ecommerce store in magento framework, want display store based on geographical location. example if accessing store india url should read www.website.com.in , if accessing website url should read www.website.com.us , @ same time based on url store display content. please suggest. here small example on how can show different websites based on location. http://rosskendall.com/blog/web/using-geoip-with-magento-and-multiple-sites main idea use database ip geolocation. (maxmind). example shows how load specific store view depending on location, can changed redirect url if have different urls websites.

sys module giving different output when running Python script through IDLE and by double-clicking the script -

i trying python directory executing scripts there. found odd behavior. this sample code pointing out specific problem . place path variable further use. i placed code in script import sys print sys.executable[: - len('pythonw.exe')] raw_input() the output when run through idle c:\python27\ the output when run double clicking script c:\python27 i don't understand going on here. why different formats? should consistent or missing something? print os.path.dirname(sys.executable) is should use. when click it running through python.exe removing char w.

symfony - Passing object to custom voter? -

i've been reading creating custom voters in symfony 2. according this page , possible pass object isgranted method of securitycontext, have done in own controller: $page = new page(); if ( ! $securitycontext->isgranted('content_create', $page)) { throw new accessdeniedexception('fail'); } it looks vote method should accepting it, however, when call get_class on $object parameter, instead of getting page entity, get: symfony\component\httpfoundation\request public function vote(tokeninterface $token, $object, array $attributes) { print_r(get_class($object)); die(); return voterinterface::access_abstain; } my voter defined service in services.yml file: content_security.access.my_voter: class: my\bundle\security\authorization\voter\myvoter arguments: ["@service_container"] public: false tags: - { name: security.voter } where going wrong? any advice appreciated. ...

c# - Dynamically add filter to Linq queryable which calls a DataContext method -

i having trouble creating expression add queryable filter condition. replicate following: starting simple queryable: iqueryable<customer> query = customer in context.customer select customer; i dynamically add filter condition involves calling method on datacontext: iqueryable<customer> query = customer in context.customer customer.name == context.convertvalueforsearch(searchstring) select customer; so 'convertvalueforsearch' calls appropriate database function when evaluated. the above produces following sql: exec sp_executesql n'select [t0].[custname] [dbo].[customer] [t0] [t0].[custname] = [dbo].[fnconvertsearchstringvalue](@p0)',n'@p0 varchar(8000)',@p0='foo' we have number of datacontext derived types, convertvalueforsearch defined through interface (isearchvalueconverter) each of our datacontext types implement. i not sure how correctly create expression call convertvalueforsearch(string searchva...

asp.net mvc - jQuery Click Event Not Firing on Click -

i'm creating new view in mvc4 , ran issue. test out, made view master layout , 1 button. whenever click button, event handler doesn't fire. if manually call click in firebug via $("#btnsearch").click() works. have many many other pages written same master layout no issue. have no idea causing this, exists in ff , ie (i don't have chrome @ work) , no js errors thrown. feel i'm going nuts here , appreciate taking look. this view: @{ viewbag.title = "sp"; } <input type="button" id="btnsearch" class="btn btn-info" value="search"> @section scripts { <script type="text/javascript"> $(document).ready(function () { alert($("#btnsearch").length); $("#btnsearch").click(function () { alert("click"); }); }); </script> } entire rendered page (sorry!) <!doctype html> <html lang="en...

sql - Phone number issues -

i trying write report , in report there sub query pull phone numbers based on employee’s network_id. last 4 digits of network id same last 4 digits of 1 of phone number employee. issue if person has 2 phone numbers meeting first criteria - substr(phone_number, length(phone_number)-3, 4) = substr('dp2543',3, 4) ) ,then in error out saying single row sub query returns more 1 row. know how can fix this? here code phone_numbers:- select (decode((select distinct phone_number per_phones employee_id = 26022 , substr(phone_number, length(phone_number)-3, 4) = substr('dp2543',3, 4) ), null, (select distinct phone_number per_phones employee_id = 26022 , phone_type = 'h1'),(select distinct phone_number per_phones employee_id = 26022 , rownum=1) ) ) dual if don't care 1 pick, add top 1 in subquery select top 1 phone_number [etc, etc...] if care, end subquery order by select top 1 phone_number [etc, etc...] order phone_...

javascript - Focus the first input on load only if no input is focused -

i'm trying set default focus pages of site without changing focus on page reload. i mean: user opens page. focus automatically set on 1st input. user changes focus 3rd input. user refreshes page. focus must not change 1st input again. (this requirement fail accomplish). my current code follows: $(document).ready(function() { if($(':focus').length === 0) { $(':input:not([type="hidden"]):first').focus(); } }); the condition true every time! $(document).ready({ window.onload=function(){ if(session.storage.getitem("text3")){//if key= text3 set,then change focus 3rd text box. $('#your3rdtextid').focus(); } $('#your3rdtextid').focus(function(){ session.storaage.setitem("text3","selected")//here set key text3 , value selected later use. }); }); you can provide own custom conditions.this small example.hope helped you.good luck project. link--> html5 local s...

Removing all content between <style> tags inside a textarea with Jquery -

i'm working on jquery word counter show how many words user has typed textbox go. part fine. issue users able insert html posts style please (post templates/tables/etc). managed figure out how remove html tags being counted word counter, problem how handle tags. for example, insert post this: <style> .speech {color:#000;font-weight:bold;} .container {width:80%;} </style> <div class="container"> text text text <span class="speech">text</span> </div> the word counter should count 4 words (the 4 text's), instead, count .speech, color, .container, , width well. here code i've come far: http://jsbin.com/aneray/85/edit any or suggestions appreciated, thanks! i used div set text , remove not required word/char count. demo: http://jsbin.com/aneray/88/edit function count(){ var $t = $('<div />').html($('textarea').val()); $t.find('style').remove(); //remove style ...

php - Sendgrid will only send utf-8 attachments -

i've created employment application allows applicants upload resume in pdf, doc, or docx extensions. email information , resume human resources using sendgrid. i've found through testing when sending email receive error: parameter attachment[resume.pdf] not utf8 how can fix issues, should encode every file uploaded utf-8 before attaching email? create issues or severally modify users uploaded resume? here php curl code use send via sendgrid api: (note: have use rest api, smtp not configured on clients web server) <?php $mail['from'] = 'humanresources@email.org'; $mail['fromname'] = 'human resources'; $mail['to'] = 'person@email.com'; $mail['subject'] = character_limiter('employment: '. $application['position'], 50); $mail['html'] = '<p><strong>name:</strong> '.$...

scroll - Weird percentage computing with jQuery -

i have carousel on page acting little funny. though jsfiddle works without hitch, operates differently on site. here's site that's working funky: http://drainteractive.com/conceptstudio/ here's working jsfiddle: http://jsfiddle.net/exrr7/13/ the code in functions.js file same in jsfiddle: $('.move-left').click(function(){ $('.belt').animate({right: '-=50%'}, 0); }); $('.move-right').click(function(){ $('.belt').animate({right: '+=50%'}, 0); }); however, on site, second time click on 1 of arrows, things bizarre. after initial 50% jump, belt.div moves somewhere around 600% right. 3000%. anyone know causing this? edit: okay, jsfiddle has +/-=25% instead of 50%, that's not what's causing problem. i can't test should work var count = 0; $('.move-left').click(function(){ count -= 50; $('.belt').animate({right: count + '%'}, 0); }); $('.m...

android - Force close error -

what force close problem of program? public class myactivity extends activity { textview t=(textview)findviewbyid(r.id.textview1); button r=(button)findviewbyid(r.id.button2); private onclicklistener i=new onclicklistener(){ @override public void onclick(view arg0) { // todo auto-generated method stub t.settext("fghffghfhgf"); } }; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); r.setonclicklistener(i); } } you need textview , button after inflating layout. public class myactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //here inflate layout setcontentview(r.layout.main); //now can widgets final textview t= (textview)findviewbyid(r.id.textview1);...

javascript - Run jQuery slideDown complete function only after last item has completed -

this question has answer here: jquery $.animate() multiple elements fire callback once 2 answers i understand can pass function slideup/slidedown run once transition has completed: $('li').slideup({ complete: function(){ alert('done'); } }); with html alert shown 3 times. <ul> <li>[content here]</li> <li>[content here]</li> <li>[content here]</li> </ul> is there way have complete function fire once, when last list item has completed slideup? ( fiddle ) you can "redo" selector , check if this last : $('li').slideup({ complete: function(){ if($('li:last').is(this)){ alert('done'); } } }); fiddle : http://jsfiddle.net/5nqsu/ caching selector better : var $li = $('li'); $li.sl...

business intelligence - Error in QBE on SpagoBI Server -

i'm new spagobi please excuse ignorance. have configured spagobi studio , server on windows 7. have configured sql server 2005 data source using jdbc when try create data set using qbe, on datamart created in studio following error: an unexpected error occured while executing dataset: incorrect syntax near '`'. i have tried explained here ( http://www.spagoworld.org/jforum/posts/list/1557.page ) hasn't fixed issue. i've tried both 3.6 , 4.0 still error. can provide appreciated! thank you! i able work. file path needs edited (from link above) located in \webapps\spagobi\web-inf\lib, not \webapps\spagobiqbeengine\web-inf\lib

confide laravel Declaration of Zizaco\Confide\ConfideUser::save() should be compatible with Arde -

i've modified upon excellent laravel 4 bootstrap , getting error when go route user/login: declaration of zizaco\confide\confideuser::save() should compatible laravelbook\ardent\ardent::save(array $rules = array, array $custommessages = array, array $options = array, closure $beforesave = null, closure $aftersave = null, $force = false) i had added hybridauth composer , updated wonder if had caused incompatibility issues confide or ardent when remove , update (as reverting previous commits) still error. any ideas? thanks lot jon. ardent has added additional $force parameter save() method. the solution, now, require specific commit in composer file: "laravelbook/ardent": "dev-master#2d1d70ea835b8c53cfe4fc60315a8ee5c672ba19" you can follow discussion in issue #113 on github.

boot - How to get the log of apps that get started after starting the android device ? -

i trying understand concepts android device startup ,i want know there way can log of applications started on device boot-up ? how can ? i want know that, possible write application gets started @ first after boot-up , stop apps getting started on boot-up ? is there intentservice have write ? or not feasible unless have root access ? please me in understanding concepts. the device log kept in buffer, recent entries there. if enough before buffer gets overwritten since device booted. you can access using $ adb logcat

Redbean Updating Linking Values For Shared Lists -

i have 2 tables linked together: product , attributetype linked through attributetype_product. linking table has data relationship in it. cannot figure out easy way update data in linking table using redbean. setting initial data easy enough using link() function. cannot figure out how change relationship easily. know can use ownattributetype_product update record once i've loaded product bean, requires know id of linking record. any on how update link, potentially through shared list? the way have found make work load linked bean iterate on it's sharedattributetypelist until 1 has right primary bean id. $project = r::dispense( 'project' ); $project->name = 'useless'; $employee = r::dispense( 'employee' ); $employee->name = 'employee'; $project->link('employee_project', [ 'role' => 'director' ])->employee; r::store( $project ); $directors = $project ->with(' employee_project.ro...

asp.net mvc - Custom font color tool in Kendo Editor -

i want know if it´s possible remove colors in font color tool of kendo editor ... have this. @(html.kendo().editor() .name("editor") .tools(tools => tools.clear().fontcolor()) .htmlattributes(new { @class = "some_class" }) .events(e => e.change("someevent")) ) i need allow red , green colors. thanks in advance. try code, below code execute in page load event. in if condition have display color displayed $(".k-palette,.k-reset").find('ul.k-palette').find('li').each(function () { if ($(this).attr('aria-label') === "#ffccff") { $(this).css('display','block'); } else { $(this).css('display', 'none'); } });

Eclipse RCP: add external directories to classpath -

i have eclipse rcp application, need add external jar files. problem can't add jars plugin , add plugin rcp application. for several reasons must add paths directories jar files located. these jar files have added program's classpath @ startup. , paths directories variable (e.g. placed in file). is there possibility add external paths somehow classpath? add external directory classpath,there 3 method: > **1. system.setproperty("java.class.path", > system.getproperty("java.class.path")+";"+"directory");** file file = new file("/home/../my.jar"); urlclassloader classloader = (urlclassloader) classloader.getsystemclassloader(); method add = urlclassloader.class.getdeclaredmethod("addurl", new class[] { url.class }); add.setaccessible(true); add.invoke(classloader, new object[] { file.touri().tourl() }); configurate classpath variable in .bashrc

xamarin.ios - Using Sqlcipher with sqlite-net in MonoTouch -

i have ios app in monotouch have add encryption database. database created using sqlite-net libraries ( https://github.com/praeclarum/sqlite-net ). possible use sqlcipher sqlite-net? the sample found using ado.net. works fine.. how integrate sqlcipher sqlite-net? sqlcipher xamarin has included support sqlite-net. show usage example sqlite-net in getting started page.

javascript - Bind variables to callback function -

i have few functions in controller call database functions. of these database functions "error callbacks", meaning if database error occur separate callback handles error. example: exports.referralcomplete = function(req, res){ /*getting id etc.*/ db.startdatabaseconnection(function() { db.flagreferralasdone(id, function(success) { db.enddatabaseconnection(); /*doing stuff on success*/ }, onerror); }, onerror); function onerror(err, description) { logger.error(description + ": " + err); user.pagenotfound(req, res); } } i have multiple functions similar this, calling different database functions. problem @ moment have duplicated onerror() scope of each of them, since need req , res variables when handling error. of course pass res , req database function, , pass them arguments error callback, think there might better way. so question is: possible somehow bind res , req global onerr...

ASP.NET - How to retrive a variable from a Sub with VB? -

i using runat command within public sub in .aspx page follows: <% dim haslabel %> <script runat="server"> public sub button1_click(byval sender object, _ byval e system.eventargs) if fileupload1.hasfile dim fileext string fileext = system.io.path.getextension(fileupload1.filename) if (fileext = ".docx" or fileext = ".doc") try fileupload1.saveas("path_to_file" & _ fileupload1.filename) label1.text = "<div class='centertext'>statement received, thank you!<br /><br />file name: " & _ fileupload1.postedfile.filename & "<br>" & _ "file size: " & _ fileupload1.postedfile.contentlength & " kb</div>" catch ex exception ...