Posts

Showing posts from April, 2015

SQL how to Count -

i have database phone , track on dates how many phone call or how many sms being period of 1 week example database:phone type | date/time calls | 04/01/14 0800hrs sms | 04/01/14 0850hrs sms | 04/01/14 0900hrs calls | 04/01/14 1230hrs sms | 04/01/14 1250hrs calls | 04/01/14 1300hrs sms | 08/01/14 1301hrs calls | 08/01/14 1330hrs how should create table , use count?which show -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -no. of calls || no. of sms- -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -4 || 4 - -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ i foget add in. lets got user 1, 2 , 3. want search user 1 made how many phone calls , how many sms, user 2 made how many phone calls , how many sms , on. how should write it? select type, count(*) phone [date/time] between x , y group type

javascript - Jquery error sending hex code through get -

here code below... var o_color ='<?php echo $o_color;?>'; //i have tried urlencode($o_color) var o_color1 =''; this code works fine.... window.location.href = site+"name="+$(this).attr('id')+'&o_color='+o_color; but code not work.... window.location.href = site+"name="+$(this).attr('id')+'&o_color='+o_color+'&o_color1='+o_color1; note:o_color in hexa code #e34343; i jquery error message on console log... uncaught error: syntax error, unrecognized expression: a[rel=123123&o_color1=] try remove double quotes "o_color" window.location.href = site+"name="+$(this).attr('id')+'&o_color='+ o_color +'&o_color1='+o_color1; accroding must be:- <script> var site='http://localhost/new/'; var o_color = '#e34343'; var o_color1 = ''; window.location.href = site+'name=dfg&o_co

What is the concept & idea behind AssetFileDescriptor in Android API -

what concept & idea behind assetfiledescriptor in android api? have referred: http://developer.android.com/reference/android/content/res/assetfiledescriptor.html didn't me understand concept , idea behind using it. since new android api , having difficulty in understanding many of concepts please slang possible.

regex - PHP preg_match_all matches correctly but only gives one match -

i'm using regex pull out sections content submitted user: preg_match_all("~\[section name=[\"|'](.*?)[\"|']\](.*?)\[\/section\]~", $content, $matches, preg_set_order); the purpose allow non-technical users create different named sections. far can tell, php's bbcode parser won't allow me pull out contents , attribute values array in way. i'm not sure why accepted answer @ preg_match_all parsing, 1 match accepted, because suggests preg_match_all doesn't globally match default, , suggested g flag seems invalid. the current function correctly matches that: [section name="one"]this section one[/section] gets put $matches : array (size=1) 0 => array (size=3) 0 => string '[section name="one"]this section one[/section]' 1 => string 'one' 2 => string 'this section one' this desired behavior. however, doesn't add furt

java - How to sort a 2-d array based upon column of dates in ascending order -

import java.util.comparator; import java.util.date; //class returns string columnn in ascending order public class datecompare implements comparator { int columntosort; datecompare(int columntosort) { this.columntosort = columntosort; } //overriding compare method public int compare(object o1, object o2) { date[] row1 = (date[]) o1; date[] row2 = (date[]) o2; //compare columns sort return row1[columntosort].compareto(row2[columntosort]); } } my 2-d array stores phone names , dates of manufacture. friends,i have made class named datecompare sorts 2-d array of records based upon column stores dates. not giving desired output.can rectify or give better substitute solution because couldn't find clear answer on site? in advance!!! input(for example): samsung 01/01/2014 iphone 09/02/2006 motorola 16/06/2009 output: iphone 09/02/2006 m

utf 8 - Firefox use another charset when send form -

i have problem firefox browser. on page have "form" , when submit "form" webpage change charset "utf-8" "windows-1250". when go place in page charset go "utf-8". problem in firefox in browser works fine (chrome, opera, ie - can check in safari etc..) search on internet lot of time, found nothing. way via ajax or change in firefox or plugin, need solution can work without change in browser. because clients must have correct default charset => no "alert" information must change on pc. have firefox 27.0.1. i have codes: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-language" content="cs" /> <form accept-charset="utf-8" action="poslat.html" onsubmit="this.action=''; return kontrola_udaju_vlozit_inzerat(this);" method="post" enctype="multipart/form-data">

cql - Trying to login to cassandra's console (cqlsh) and it rejects me -

i trying set user authentication cassandra when had following problem. first have updated cassandra.yaml with: authenticator: passwordauthenticator then created system_auth keyspace replication_factor of 3 as: create keyspace system_auth replication = { 'class' : 'simplestrategy', 'replication_factor' : 3}; then re-ran cassandra command: bin/cassandra then after that, proceeded , made sure repair node(s) (though not sure if understand why important/necessary): nodetool repair even after doing of steps cassandra/java yells @ me with: traceback (most recent call last): file "/home/tscobb/documents/bm/apache-cassandra-2.0.5/bin/cqlsh", line 2044, in <module> main(*read_options(sys.argv[1:], os.environ)) file "/home/tscobb/documents/bm/apache-cassandra-2.0.5/bin/cqlsh", line 2030, in main display_float_precision=options.float_precision) file "/home/tscobb/documents/bm/apache-cassandra-2.0.5/b

PHP: How can I separate this split this string correctly? -

i have bunch of url segments. i know either come in form of: mystring?var1=value or mystring/name.php?var1=value in either case need take url , mystring bit out of it. will: search either first / or ? turn whatever came before var , throw rest of string out. how can achieved? a simple way it $parts = explode('?', $str); $parts = explode('/', $parts[0]); $yourfinalstring = $parts[0];

php - does not show original product image in magento its show default image -

Image
i have enter product in magento image added, in frontend show default image on product, dont show original image have set base small default image. not show. why dont know. i have try debug using base image path show placeholder image.

emacs - Activate a single ELPA package out of many -

i want start emacs clean state , activate 1 package in ~/.emacs.d/elpa/ , not of them. specifically, need load bleeding-edge version of org-mode, while clean emacs loads built-in version. how do that? to run emacs clean state, provide -q option: emacs -q then run command eval-expression , m-: , , enter following lisp expression: (let ((package-load-list '((org t)))) (package-initialize)) package-load-list variable holds packages load , activate when package-initialize called. it's list of pairs in form of (package version) . can put t instead of version , , newest version loaded.

algorithm - How to visit vertices in undirected graph -

Image
what proper algorithms visit vertices of undirected graph, arbitrary position? example, given following graph 7 vertices, starting #6: there many possible sequences: 67645321, 676421235, 6453212467, ... how iterate vertices shortest path (the first one)? thanks. follow comment above, 1-2-3 | | 4-5 | 6-7 sort node value, smaller value go first, results: 6-+-4-+-2-+-1 `-7 `-5 `-3 transverse tree: 6-4-2-1-2-3-2-4-5-4-6-7 some more optimization can made, e.g. each node keep 'depth' or weight of each 'child', transverse shallow child / light child first. 6-+-(5)-4-+-(3)-2-+-(1)-1 `-(1)-7 `-(1)-5 `-(1)-3 thus transverse below: 6-7-6-4-5-4-2-1-2-3 may have more methods optimize, luck!

Having a few problems after recently starting Eclipse Java -

hello have start learning java coding on eclipse , have made few simple things. i trying make basic game random number 1-100 chosen program , have try , pick it, program telling whether higher or lower. i've encountered few problems. import java.util.scanner; import java.util.*; public class numbergame { /**number guessing game * calculates random number , has player guess */ public static void main (string[] args) { int mynumber, guess; system.out.println("what guess?"); scanner guessscanner = new scanner(system.in); random mynumber = new random(); int number = randomnumber.nextint(100); guess = guessscanner; if (guess<mynumber) { system.out.println ("the number less"); } if (guess>mynumber) { system.out.println ("your guess more"); } else{ if (guess==mynumber) system.out.println ("your number correct"); } } } thi

java - Mac OS Mavericks. JDK installer can't see JAVA_HOME -

yesterday bought new mac , trying configure on them jdk 7. apple jdk 6 package installed on path: /library/java/javavirtualmachines/1.6.0.jdk/contents/home /usr/libexec/java_home , echo $java_home print this /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home in ˜/.bash_profile have export java_home=$(/usr/libexec/java) . also have installed jre7 . java -version print this: java version "1.7.0_51" java(tm) se runtime environment (build 1.7.0_51-b13) java hotspot(tm) 64-bit server vm (build 24.51-b03, mixed mode) but! i'm trying launch jdk7 , have error: sudo sh downloads/java_ee_sdk-7-jdk7-macosx-x64.sh password: extracting installer archive... extracting installer runtime... unable find $java_home @ "/usr", continuing system-provided java... extracting installer resources... unable find $java_home @ "/usr", continuing system-provided java... extracting installer metadata... unable find $java_home @ "/usr"

android - my listview was empty -

i have listview using customadapter . first, try display listvew arrayadapter , item seems good. when try change them custom adapter item gone. here arraylist public arraylist<hashmap<string,string>> getallassignment() { arraylist<hashmap<string,string>> daftarassignment = new arraylist<hashmap<string,string>>(); cursor cursor = database.rawquery("select customer.name assignment, customer where"+ " assignment.customerid=customer.customerid , employeeid = '"+globals.salesid+"'", null); cursor.movetofirst(); if (cursor.movetofirst()) { { map1 = new hashmap<string,string>(); name=cursor.getstring(cursor.getcolumnindex(dbhelper.name)); map1.put("one",string.valueof(daftarassignment.size())); map1.put("two",name); daftarassignment.add(map1); } while (cursor.movetonext()); } cursor.c

c# - I am storing date in my table.I want to select data and in that if there is no date in table then corresponging field to date should be 0 -

tables : collegereview, fields - collegeid ,review desc, reviewdate, i have created report table shows: date no of reviews 12-jan-2012 10 13-jan-2012 8 15-jan-2012 2 this query not printing date - 14-jan-2012 i want report like... date no of reviews 12-jan-2012 10 13-jan-2012 8 14-jan-2012 0 15-jan-2012 2 there date field in table. if there no entry particular date should return 0. sql query select convert(varchar(20),cast(reviewdate date),100)as 'date',count(*) 'review(s)' reviews group convert(varchar(20),cast(reviewdate date),100) order convert(varchar(20),cast(reviewdate date),100) desc first need create additional table dates want. create table dates ([date] date) declare @stdate date, @enddate date, @insertdate date set @stdate='01.01.2000';--choose possible dates set @enddate='01.01.2020'; set @insertdate=@stdate; while (@insertdate<@e

java - Eclipse doesn't create Main Activity and layout -

i can't start new projects anymore. do... start eclipse. new android application min api 8 target api 18 compile api 19 create activity : checked activity name : mainactivity layout name : activity_main finish when open project (it doesn't open mainactivity.java should be) : - src folder empty - res/layout folder empty but androidmanifest.xml exists. working before , able create projects broke. i'm using apis 18 , 19 installed , date. i had same problem yesterday after updating latest packages on android sdk manager. fixed updating eclipse plugin: run eclipse > help > install new software > paste url https://dl-ssl.google.com/android/eclipse/ press enter . after updating plugin, created test project main activity , menu created default normal.

android - Background image and also background color in TableLayout -

Image
i'm developing android app , want create tablelayout white background , background image aligned @ top left, because 'bend effect'. this top left image: i defined tablelayout this: <tablelayout android:id="@+id/tablelayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginbottom="16dp" android:layout_marginleft="16dp" android:layout_marginright="16dp" android:layout_margintop="16dp" android:background="@color/white" > but don't know how put image @ top left, or if background images compatible background colors or if there better way thing... the best way define image go use imageview inside layout. can define placement of image using android:gravity

Python invert operator - visualizing the negative number -

in simple words, definition given ~n -n - 1. for example ~1 1 = 0001 ~1 = 1110 (which -2) for numbers say ~2 2 = 0010 ~2 = 1101 (which representation of -3 in twos complement) but question is 1110 = -2 can visualized -2 (the right 2 bits 10 , rest 1) 1101 = -3 can't visualized (going above logic should -5) so wondering there simple way see , tell twos complement binary negative number represents without doing calculations . ~n = -n - 1 equivalent -n = ~n + 1 . means figure out negative of number is, can invert (in head) , add one. pretend zeros ones , vice versa, add one. example: pretend this 1101 is this 0010 then add 1 0011 thus, 1101 represents -3 .

c++ - The function template specialization when using tempates as argument -

i want write function template deal vectors, lists, sets, ... , want write specialization function deal map separately , when wrote following code , compiler reports errors. could 1 me how modify it? #include <iostream> #include <string> #include <map> #include <unordered_map> using namespace std; // test() vectors, lists, sets, ... template <template <typename...> class t> void test() { t<string, int> x; //... } // specialize test() map template <> void test <map<> class t>() { t<string, int> x; //... } int main() { test<map>(); test<unordered_map>(); } the template specialization should be: template <> void test <std::map>() { std::map<string, int> x; } i changed template parameter map<> class t invalid syntax std::map . , changed t<string, int> std::map<string, int> because name t doesn't exist in specializ

How to delete dynamically-created controls in vb.net? -

i have program creates control(textboxes, progressbars, labels, timers) dynamically. created button when clicked, erase created controls on form. what's code this? when creating controls keep references around. example can use list global variable. dim mycontrols list(of control) when create controls add them form's control collection , list mycontrols = new list(of control) [...] me.controls.add(newcontrol) mycontrols.add(newcontrol) do delete controls remove them form , dispose them (free ressources) for each c control in mycontrols me.controls.remove(c) c.dispose() next you can because controls reference types. means objects in both mycontrols list , ones displayed on form point same instance , can therefore dispose them afterwards.

javascript - Passing a variable to URL parameters using JQuery POST -

i have function passes account code (derived combo box) server. sending request in body - need send url parameter. example url should be: localhost:1234/myproject/webapp/data?accountcode=full assuming full selected. my code below works request body attempts amend submit url request have failed. accountselected: function () { var saccountcode = $("select#accountcombo").val(); var stringaccountcode = saccountcode.tostring() console.log("account is: " + stringaccountcode); var myurl = "webapp/data"; $.ajax({ url: myurl, type: "post", data: { "accountcode": stringaccountcode }, datatype: "text", }) i have been looking @ using $.param couldn't work , read on other questions using $.get when ch

PHP and C# SHA256 Hashes returning different strings -

so, found question accepted answer, hopped off , tried implement necessary changes. reason though, still getting 2 different strings, , don't know i'm doing wrong. tried comment on accepted answer find help, lack reputation so. so, figured i'd ask question again (that question 2 years old, too). let me explain i'm doing. in php... $intermediatesalt = md5(uniqid(rand(), true)); $salt = substr($intermediatesalt, 0, 8); $hashpassword = base64_encode( hash('sha256', $salt . hash('sha256', $password), true) ); the line says $hashpassword taken accepted answer question. didn't write of php, friend did. know enough programming alter code, couldn't create in php, let alone html. after hash has been created, both hash , salt stored on database. the c# method i'm using answer found here. public static string computehash(string plaintext, string salt) { // convert plain text byte array. byte[] plaintextbytes = e

how to design a two column form using bootstrap 2.3.2 where the 2nd column takes up the rest space -

i design 2 column horizontal form using bootstrap v2.3.2. following html: <div id='content' class='row-fluid'> <div class='span12 main'> <h2>product data</h2> <form class="form-horizontal"> <fieldset> <div class="form-group"> <label for="inputappname" class="control-label col-xs-2">application name&nbsp; </label> <div class="col-xs-10"> <input type="text" class="form-control" id="app_name" name="app_name" placeholder="application name"> </div> </div> <div style="height:10px;"></div> <div class="form-group"> <label for="inputappdesc" class="control-label col-xs-2">description&nbsp;</label> <div class="col-xs-10"> <textarea class="form-control" id="app_desc" name=

java - Finding uppercase characters in a user's string and counting them -

i wanted uppercase characters in string , there count package test; import java.util.scanner; import java.util.regex.matcher; import java.util.regex.pattern; public class case_test { public static void main(string agrs[]) { string str1 = "", regx; regx = "[a-z]+"; scanner sc = new scanner(system.in); pattern pattern = pattern.compile(regx); matcher matcher = pattern.matcher(str1); int count = 0; system.out.println("enter sentence"); str1 = sc.nextline(); while (matcher.find()) system.out.println(str1.substring(matcher.start(), matcher.end()) + "*"); count++; } } i wanted uppercase characters in string , amount. you can use string intersection ( intersection of 2 strings in java ) using originalstring & originalstring.touppercase().

c# - Transfering large files: combining streamed transfer and content-length -

tl;dr: how can stream large files known size using wcf, , still show progress ( content-length ) final user (a web browser)? i have wcf rest service downloads , serves large files (1-20gb) web browser. simplify, think of service proxy. obliges me set transfermode = streamed or transfermode = streamedresponse on binding, or end client have wait source files downloaded webserver before actual download begins. also, buffered transfer mode kills server large files (ram usage). intermediate disk storage not option. transfermode man page: (...) buffered transfers hold entire message in memory buffer until transfer complete. but when setting transfermode streamed or streamedresponse , wcf no longer returns header content-length client, , new header transfer-encoding: chunked added. consistent wikipedias article on chunked transfer: (...) uses transfer-encoding http header in place of content-length header (...) but know size of data transferred beforehand,

c# - How to obtain parameters from a statement in Roslyn to variable -

so far i've been able find console.writeline("hello world") statement inside method.body. want collect "hello world" string writeline("hello world"); statement. how can this? code: methoddeclarationsyntax method = syntaxtree.getroot() .descendantnodes() .oftype<methoddeclarationsyntax>() .first(); blocksyntax statement = method.body; controlflowanalysis controlflow = semanticmodel.analyzecontrolflow(statement); statementsyntax state = statement.statements.first(); console.writeline(state.tostring()); console.readline();

javascript - Pass PartialView with AJAX and still using Controller in MVC on submit -

i have div want put partialview when press input of type submit. partialview must created inside div after controlleraction showdetail() has executed else i'm getting nullreference @ model. have made attempt ajax i'm not sure how write this, , when model needs created before partialview posted div. appreciate guidance or solution my view (the div supposed keep partialview ancalcdetail): @using (html.beginform("showdetail", "calculation")) { <div class="calculatebox"> <label for="calcoption">choose value calculate:</label> <select form="anformcalcinput" id="calcoption" title="choose value want calculate"> <option value="anpmt">payment (pmt)</option> <option value="ani">interest (i)

android - New Update of Eclipse Doesn't allow to create AVD even pressed ok? -

Image
i have updated eclipse , when try create new avd , when press ok, nothing happens. can see ,my avd shows repairable devices. when clicked repair, nothing happens. and when try create new avd after clicking ok nothing happens. can see, ok clickable. when clicked nothing happens. i have installed files through sdk manager under each version. solution? as many posts bug related new version of adt, did not want rollback , test/use different version. me worked going directly in android sdk folder , launching avd manager (avd manager.exe) or sdk manager -> tools -> manage avds. meanwhile wait fix related adt plugin.

ios - Height of cell taller than cell contents - view rendering issue -

i have odd problem hoping perhaps explain. searching yields nothing in case. if heightforrowatindexpath specifies height taller of contents drawn result of cellforrowatindexpath upon scrolling, once view refreshes contents, won't draw of cell contents i've rendered (each row height dynamic). however, if reduce row height somewhat, rendered correctly. is there documentation pertaining problem? should heightforrowatindexpath return precise row height based on contents? example, made row heights rather large see contents, alas, cellforrowatindexpath wouldn't called many times should, , general rendering problems ensued. apologies fuzzy description, perhaps have experienced same problem offer insight. cheers. if cell content contains dynamic content affects height, have return different height values heightforrowatindexpath. tableview calls heightforrowatindexpath many times don't do calculations inside heightforrowatindexpath, instead create arr

ruby on rails - File digest/fingerprint is not always included in asset files -

i precompile assets , use following function render html: = stylesheet_link_tag "frontend/application", media: "all", "data-turbolinks-track" => true = javascript_include_tag "frontend/application", "data-turbolinks-track" => true sometimes methods generat correct html: <link data-turbolinks-track="true" href="/assets/frontend/application-64cf06dd4d2386f145e00844fed60d28.css" media="all" rel="stylesheet" /> <script data-turbolinks-track="true" src="/assets/frontend/application-447281961c979f73e944369c4b832fd8.js"></script> but on production rails (50%!) generates assets html this <link data-turbolinks-track="true" href="/stylesheets/frontend/application.css" media="all" rel="stylesheet" /> <script data-turbolinks-track="true" src="/javascripts/frontend/application.js">&

Error Sync framework in WCF -

i have implemented sync framework in wcf service. code: [servicebehavior(instancecontextmode=instancecontextmode.persession)] in service contract class having error the call beginsession() in relationalsyncprovider not valid. session in progress sorry late on syncoperationstatistics stats = orchestrator.synchronize(); please guide me resolve issue. thank you. replicated issue server side having multiple clients connect concurrently. exception server side @ sqlsyncprovider.beginsession(). in sync 2.1. i solved making sure sqlsyncprovider server per client instead of static across client connections. since replicating via unit tests had issue when client proxy reference static, switched instance well.

c# - How to assert a default value of a property with FluentAssertions? -

i have class fields/properties etc., of various types: public string somestringdata; public int? somenullableintegerdata; public somedataclass somespecificdata; public int someintegerdata; in part of code, somestringdata should filled, , want test explicitly that. use fluentassertions , have actual.somestringdata.should().be("whatever"); but how test, none of other elements not touched , still have default value? could, of course: actual.somenullableintegerdata.should().nothavevalue("must have no value."); actual.somedataclass.should().benull("must have no value."); actual.somenullableintegerdata.should().be(0, "must have no value."); but, how express more these items should have default value? like example imaginary bedefault operator: actual.somenullableintegerdata.should().bedefault("must have no value."); actual.somedataclass.should().bedefault("must have no value."); actual.somenullableintegerdata.s

random - generate categorical dataset in python -

suppose have list of ten cities : ["paris", "barcelona", "kolkata", "new york"] how can simulate n random datasets of 2 attributes each having 2 cities selected above list: ["paris", "barcelona"] ["barcelona", "kolata"] ["new york", "paris"] ["paris", "barcelona"] ["new york", "paris"] you can use random.sample this data = ["paris", "barcelona", "kolkata", "new york"] import random print [random.sample(data, 2) _ in xrange(5)]

excel - VBA Randomly generated strings repeating - why? -

i have created vba function produce randomly generated string of format xx00xxx. ran create in excess of 400000 serials in excel spreadsheet, there abnormally high number of repititions of same string; on 60% of strings have more 1 instance (>250 in cases!). expect repitition near level. there problem code? or perhaps week play lottery. function newvrn() string dim strone string dim strtwo string dim strthree string dim strfour string dim strfive string dim strsix string dim strseven string ' initialize seed using timer. randomize 'generate random letters strone = chr(int((90 - 65 + 1) * rnd) + 65) randomize strtwo = chr(int((90 - 65 + 1) * rnd) + 65) randomize strfive = chr(int((90 - 65 + 1) * rnd) + 65) randomize strsix = chr(int((90 - 65 + 1) * rnd) + 65) randomize strseven = chr(int((90 - 65 + 1) * rnd) + 65) randomize 'generate random numbers strthree = chr(int((57 - 48 + 1) * rnd) + 48) randomize

c# - Checking a rectangle collision with a circle -

i have 2 objects, rectangle object , circular shaped object. @ moment using 2 rectangles detect collision of these objects, , although working collision detectment not accurate enough because using rectangle means collision detected before circle has been hit. my question method use in order detect collision circle collision detected when rectangle intersects circular object? if you're using xna create boundingsphere circle , boundingbox rectangle, call sphere.intersects(box) check if collide. see boundingsphere , boundingbox both have constructors fit 2d needs

c# - log4net for WCF REST -

i have written wcf rest service. need enable logging. using log4net nothing logging in database. i have gone through following links in vain. how configure child logger lower loglevel root level in log4net log4net in wcf not working log4net issue inside wcf log4net wcf running service i using adonetappender . here log4net.config file. <appender name="adonetappendermessagelog" type="log4net.appender.adonetappender"> <buffersize value="100" /> <connectiontype value="system.data.sqlclient.sqlconnection, system.data, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" /> <connectionstring value="data source=faizan;initial catalog=anasagelogging;integrated security=sspi;" /> <!-- <commandtext value="insert messagelog ([transactionid],[sessionid],[userid],[message],[messagetype],[createddate],[createdby],[applicationid]) values (@transactionid, @sessionid, @userid,

asp.net - Error while sending mail - The SMTP server requires a secure connection or the client was not authenticated -

i have tried every example available on net still no working,whenever click on submit button shows error ,please me this protected void btnsubmit_click(object sender, imageclickeventargs e) { dal.s_email = txtforget.text; datatable dt = new datatable(); dt = bal.forgot_pass(dal); if (dt.rows.count > 0) { system.net.mail.mailmessage msg = new system.net.mail.mailmessage(); msg.from = new mailaddress("my@email.com"); msg.to.add(txtforget.text); msg.subject = "yor password details"; msg.body = "hi,<br>please check login details<br/><br/> username : " + dt.rows[0]["username"] + "<br/><br/> password " + dt.rows[0]["password"] + "<br/><br/>"; msg.isbodyhtml = true; smtpclient smtp = new smtpclient(); smtp.host = "smtp.gmail.com"; smtp.port = 587; smtp.enablessl =

javascript - Which format is better and not time consuming? -

i new web development .. confused time complexity of java script , jquery other programming languages c , c++. format 1: var cur_month; cur_month = (new date().getmonth()) + 1; // returns 0 11 cur_month = cur_month.tostring().length > 1 ? cur_month : '0' + cur_month; format 2: var cur_month; cur_month = ((new date().getmonth()) + 1).tostring().length > 1) ? ((new date().getmonth()) + 1) : '0' + ((new date().getmonth()) + 1); in format 2 , accessing month 3 new date objects .. in first format , creating 1 object , accessing .. 1 better format? format 1 because don't create multiple date object (with different values) also rewrite last line. adding string number implicitly casts string. var cur_month; cur_month = (new date().getmonth()) + 1; cur_month = ( cur_month < 10 ? '0' : '' ) + cur_month;

ssas - How can I implement multiple nameColumns that target the same table? -

i have 2 tables. first 1 references second 1 multiple times. demo data: id fk1 fk2 fk3 ------------------------------- 4009 9419 2282 9005 4057 9419 2112 null 5480 null 4279 null 5989 null 1677 null the second table contains names foreign keys in table 1 id name -------------------------------- 1677 bank account no1 2112 loyalty account 2282 sales account 4279 employee account 9005 warehouse no1 9419 sales i have create dimension table1. fields fk1, fk2 , fk3 should use namecolumn attribute, , show values table 2. i tried creating named query in data source view, if try put cube, deployment breaks without proper error. select [table1].[id] ,fk1 ,fk2 ,fk3 ,t2_fk1.name fk1name ,t2_fk2.name fk1name ,t2_fk3.name fk1name [dbo].[table1] left join table2 t2_fk1 on table2.id = [table1].fk1 left join table2 t2_fk2 on table2.id = [table1].fk2 left join table2 t2_fk3 on tab

jquery - Fancy box with one image only -

i using fancy box photo gallery, problem found upload 2 images. 1 thumbnail , 1 fancy box <a style="display: block;" class="fancybox imgcontainer" href="images/lorentejerome_barcelona.jpg" data-fancybox-group="gallery" data-filter="arch"><img src="images/lorentejerome_barcelona.jpg" alt=""></a> any way , can upload 1 pic need re-size thumbnail image css or jquery. 1 can . css of thumbnail : .imgcontainer { width: 100px; height: 100px; overflow: hidden; text-align: center; margin: 10px 20px 10px 0; float: left; border: solid 1px #999; display: block; } try this… .imgcontainer img { width:100px; height:100px; }

php - Using Mysql query with where condition -

i have decoded json , want submit in database, how can use query condition? if(is_array($arr)){ $sql = "insert wp_posts (post_title, post_type) values "; $valuesarr = array(); foreach($arr $row){ $email = mysql_real_escape_string( $row['property_name'] ); $post = mysql_real_escape_string( $row['post_type'] ); $valuesarr[] = "('$email', '$post')"; } $sql .= implode(',', $valuesarr); mysql_query($sql) or exit(mysql_error()); } if(is_array($arr)){ $valuesarr = array(); foreach($arr $row){ $email = mysql_real_escape_string( $row['property_name'] ); $post = mysql_real_escape_string( $row['post_type'] ); $sql = "update wp_posts set post_title='".$email."', post_type='".$post."' x=y"; mysql_query($sql) or exit(mysql_error()); } }

sql server - Simplify T-SQL Query -

i simplify query if possible. select max(tdatetimeofsurvey) stocks.dbo.tblsurvey ( (select isnull(sum(twettons), 0) stocks.dbo.tblsurvey tstockareaid = 3 , tdatetimeofsurvey between '20140201' , '20140228') + (select isnull(sum(twettons), 0) stocks.dbo.tblsurvey tstockareaid = 103 , tdatetimeofsurvey between '20140201' , '20140228') + (select isnull(sum(twettons), 0) stocks.dbo.tblsurvey tstockareaid = 181 , tdatetimeofsurvey between '20140201' , '20140228') ) > 0 , tstockareaid in (3,103,181) -- ras, soil, dorb , tdatetimeofsurvey between '20140201' , '20140228' many thanks, pierre please try: select max(tdatetimeofsurvey) stocks.dbo.tblsurvey tstockareaid in (3,103,181) , tdatetimeofsurvey between '20140201' , '20140228' having sum(twettons)>0

css - Media Queries for Different zoom Levels of Browser -

i newbie responsive design using css3 media queries. understand how target different devices using these media queries place confused browser zooming!!. for eg : normal body css rule #body { margin: 0 auto; width: 70%; clear: both; } and when want change css rule target devices width falls in range of 150px , 600px add particular media query. @media screen , (min-width:150px) , (max-width:600px){ #body { margin: 0 auto; width: 90%; clear: both; } } problem : using google chrome , when zoom in 200% particular media query comes play. how know media queries write different zooming levels or put way whats relation between browser zooming levels , pixel width. after lot searching. found answer. we don't need target browser zooming explicitly using media queries. when zoom our browser behaves different devices. eg: if zoom @ level 175% pixel width of our screen size 732px ( you can find relation between zooming , pixel width @ http:

Document name in geoxml3 -

my kml under <?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <document> <name>car parks</name> <description>car parks</description> <folder> <name>data objects</name> <open>1</open> <description>data objects</description> <placemark id="cp11"> <name>cp11</name> <description>cp11</description> <styleurl>#0-normal</styleurl> <point> <coordinates>4.878205,52.371968,0</coordinates> </point> </placemark> </folder> </document> </kml> my javascript under geoxml = new geoxml3.parser({ createmarker: createmarker

matlab - Which kernel produces sharper image -

kernel = [ 0 -1 0 -1 4 -1 0 -1 0 ] and b = [-1 0 -1 0 4 0 -1 0 -1 ] i have found frequency spectrums freqz2 function of matlab. a's spectrum has highest magnitudes in corners [(1,1),(-1,-1),(1,-1),(-1,1) , b's in (1,0),(0,1),(-1,0),(0,-1). i know center of frequency spectrum has low frequency information , corners high frequency information such edges. appears b filter produces sharper image although has higher magnitude in corners. why happening ? from definitions can seen a tends sharpen more along vertical , horizontal directions, whereas b sharpens more along diagonals . depending on contents of image, 1 effect may more noticeable other. in frequency terms, if kernel amplifies spatial frequencies @ image happens not have energy, effect hardly noticeable.

JQuery changing css background color -

i stared working jquery first time , have simple question changing css, current code able prompt color how can achieved? $(document).ready(function() { $("#change").click(function() { $("#container").css("background-color", "blue"); }); ive tried this: <input id="colorinput" type="text"/> $(document).ready(function() { $("#change").click(function() { $("#container").css("background-color", #colorinput); }); and alot of other ways nothing seems work. change $("#container").css("background-color", #colorinput); to $("#colorinput").css("background-color", "#ff0000"); id or class of element effected in selector. here fiddle.

how to parsing 10 digit number text into integer in java -

i have set "phone" int of 10 digit in database , take input text parse using string phone1=request.getparameter("phone"); int phone =integer.parseint(phone1); but not work why? in java can store in int variable numbers in range -2147483648 2147483647. not enough 10-digit telephone numbers. can fix using long : long phone = long.parselong(phone1); on other hand rethink using number data types storing telephone numbers. why? because can't store leading zeros if numbers not 10 digits long. because loose formating, "123-456-..." because can't save things # or p , valid used in phone numbers

crash - Android exception while adding calendar -

i'm facing strange problem when i'm trying add calendar contentprovider, it works there 1 device i'm testing on , doesn't - got crash. device: tablet android 4.0.4 (api15). some of code: private static uri buildcaluri() { return calendarcontract.calendars.content_uri.buildupon() .appendqueryparameter(calendarcontract.caller_is_syncadapter, "true") .appendqueryparameter(calendars.account_name, account_name) .appendqueryparameter(calendars.account_type, account_type).build(); } private static contentvalues buildcontentvalues(calendardata cd) { string dispname = cd.getname(); string intname = int_name_prefix + dispname; final contentvalues cv = new contentvalues(); cv.put(calendars.account_name, account_name); cv.put(calendars.account_type, account_type); cv.put(calendars.name, intname); cv.put(calendars.calendar_display_name, dispname); cv.put(calendars.calendar_access_level,

excel - Pastespecial is not working although paste does -

activesheet.pastespecial not working should be. activesheet.paste gives me result need formatting. sub show() dim rng range set rng = activeworkbook.worksheets("dashboard").range("a1:f30") rng.select rng.copy activeworkbook.close thisworkbook.worksheets.add(after:=worksheets(worksheets.count)).name = "dashboard" & newfile activesheet .range("a1").activate .range("a1").select .pastespecial paste:=xlpasteall **<-------** end end sub i think need specify paste. with activesheet .range("a1").pastespecial paste:=xlpasteall **<-------** end

php - Getting average number of uploads (or something else) per day -

sorry if i'm using wrong se network question. i'm in need of fetching average number of uploads , registrations website per day. problem can't seem figure out math task. in database tables uploads , registrations, have columns indicate when row created, stores unix timestamp. how calculate average number of rows created per day? select avg(anz) ( select date(from_unixtime(your_ts_column)) my_date, count(*) anz your_table group my_date ) subquery_alias

java - ckeditor not working in IE9 and 10 -

i using java implementation of ckeditor. in code have <%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %> my text area uses struts bean write tag logic <textarea id="txtcmt<bean:write name="i" />:<bean:write name="j" />" name="comments" style="width: 100%; height: 280px;"> i use <ckeditor:replaceall basepath="/elements/ckeditor_basic/ckeditor.js" /> to replace textarea ckeditor. implementation works on chrome , firefox,however,the editor not load on ie9 , page breaks on ie10. please advise. thanks

Firefox scroll issue on Jquery One Page Scroll -

i found out plugin wich allow single page show content un full width/height, not work propperly on firefox 27.0.1 am missing something? u facing same problem? online demo solution: looking forward on github issues, found post "gianu" user wich find problem on binding events. the following sentence copy / paste own: on firefox 27 on osx, if you're using mouse scroll event not fired. the solution found add mozmousepixelscroll bind list.

android - What to do to dismiss a dialog box which is coded as a dialog activity? -

/*packages , imports*/ public class bookmarkdialoge extends activity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.bookmarksaver); } public void bookmarking(view v) { edittext bookmarking=(edittext)findviewbyid(r.id.bookmarkname); final string bookmarkname=bookmarking.gettext().tostring(); string pathdir= getintent().getextras().getstring("bookpath"); string address=getintent().getextras().getstring("chapteraddress"); system.out.println("book directory in bookmark class "+ pathdir); sqlitedatabase db; db=openorcreatedatabase("epub.db",sqlitedatabase.create_if_necessary,null); db.setlocale(locale.getdefault()); db.setlockingenabled(true); db.setversion(1); try { string updatequery1 = "update bookmark set addresname=? bookdir=? , lastaddress=?"; db.execsql(updatequery1, new

c# - Encrypt password in database -

this question has answer here: preferred method of storing passwords in database 10 answers i have password, let's is: testabc123 and stored in database, password field in database showing password testabc123 . want when user open database, password field no longer showing testabc123 , user can't access. user know password does. any help? thank you your answer appreciated! do not store plain-text passwords in database. use hash function on password such string stored in database unreadable. user can't string, if knows it. must still make sure other user cannot change password field, otherwise won't help, because copy hash of own password there. check other questions (or google) on storing passwords in database. there should lot of information on around.

TypeError: cannot set property 'value' of null Autocomplete form google maps -

if fill in input field "adresse automatisch ausfüllen:" route , click enter have js error: typeerror: cannot set property 'value' of null i tried ... = null; have same error. here js code: <script> // example displays address form, using autocomplete feature // of google places api users fill in information. var placesearch, autocomplete; var componentform = { street_number: 'short_name', route: 'long_name', locality: 'long_name', administrative_area_level_1: 'short_name', country: 'long_name', postal_code: 'short_name' }; function initialize() { // create autocomplete object, restricting search // geographical location types. autocomplete = new google.maps.places.autocomplete( /** @type {htmlinputelement} */(document.getelementbyid('autocomplete')), { types: ['geocode'] }); // when user selects address dropdown, // populate address fields in form.