Posts

Showing posts from September, 2012

uiview - How to make a list view in IOS with Scroll -

Image
i need make view below. (any starters on helpful.) 1) need add list of items view. 2) particular item should highlighted if touch item in list , need value of item. 3) list should in scrolled view if extended. any starters on helpful. have @ github link , try run github link and if want highlight on tap have @ link how change color of uitableviewcell when selecting? and show scroll bar on uitableview have @ post https://stackoverflow.com/a/1978526/1959180 and can follow simple tutorial

c# - No connection could be made because the target machine actively refused it why? -

hi using tcpclient , tcplitner transmit data getting error not connect below code private void button1_click(object sender, eventargs e) { tcpclient tcpc = new tcpclient("192.168.21.46", 10); networkstream nts = tcpc.getstream(); if (nts.canwrite) { byte[] sends = system.text.encoding.ascii.getbytes(textbox1.text.tochararray()); nts.write(sends, 0, sends.length); nts.flush(); } } private void button2_click(object sender, eventargs e) { tcplistener mylistener = new tcplistener(10); mylistener.start(); while (true) { //accept new connection socket mysocket = mylistener.acceptsocket(); if (mysocket.connected) { //make byte array , receive data client byte[] receive = new byte[64]; int = mysocket.receive(receive, receive.length, 0); char[] unwanted = { ' ', ' ', ' ' }; ...

windows phone : no trigger in xaml? -

i don't know how use triggers in xaml of windows phone 8. but have seen people it, below: <toolkit:listpicker header="background" expansionmode="fullscreenonly" template="{staticresource listpickercontroltemplate}" verticalalignment="top" itemssource="{binding path=buildings.objectlist}" margin="0" x:name="buldings" padding="0"> <i:interaction.triggers> <i:eventtrigger eventname="selectionchanged"> <i:invokecommandaction command="{binding path=buildingselectioncommand}" commandparameter="{binding path=selecteditem, elementn...

Sitecore admin account permission related issue -

Image
in sitecore admin portal created user following roles when open sitecore item , try edit using content editor first asks me lock item before making edits. when select "lock , edit" option says if publish now, selected version not visible on web site because has been replaced older version. when try same thing using sitecore administrator account doesn't ask me lock , editing works fine. there problem sitecore roles user? there happening other this, when select lock , edit option create new version instead of editing same version. administrator users doesn't happen. think creating new version main reason this. nope, expected behavior. real administrators (where "user administrator" checked in general tab on screenshot) able bypass these security mechanisms.

chrome ask multiple time to allow use of speaker and mic for incoming call in twilio -

i creating call center application ,and when call come twilio client on chrome browser ask permission allow use of speaker , mic .when second call comes have allow 2 times , if third call come have allow 3 times , on. and in firfox browser ,when acccept call second time automatically disconnect , give error of mediastream. please suggest me wrong , how solve problem. below javascript of twilio client,if need more information please let me know <script type="text/javascript"> //var token =callaction(); var connection=null; var content; $(document).ready(function(){ $('#hangupcallbutton').hide(); $.post('cleanify?action=createcall', function(data){ content= data; twilio.device.setup(content, { debug: true} ); } ); twilio.device.ready(function (device) { $("#log").text("ready"); } ); twilio.device.error(function (error) { $("#log").text("error: " + error.message); } ); twilio.device.connect(function (c...

html - Writing my own custom function inside jQuery 'draggable( )' to display alert message -

i want display alert message when start's dragging, searched many posts, blog, jquery documentation , different sites. haven't appropriate answer that. out searched, tried using $("#mydiv").draggable(function(){ start: function( event, ui ) { console.log("krishna"); } }); can 1 please suggest me solution this. demo $( "#mydiv" ).draggable({ start: function( event, ui ) { alert('drag it'); } });

c# - Filling Foreign Key Object in Entity Framework 4 -

i using entityframework first time , maybe question simple...i've used code first method..i have class personnel looks this: public class personnel { public string id { set; get; } public int code { set; get; } public string name { set; get; } public int type { set; get; } public jobtitle title { set; get; } } and jobtitle class: public class jobtitle { public string id { set; get; } public int number { set; get; } public string title { set; get; } public list<personnel> personnels { set; get; } } which last property in personnel class foreign key in personnel table of course..my problem when want retrieve personnels ( or personnel ) db using lambda expression..the foreign key object null..the lambda expression below: context.contextinstance.personnels.tolist(); and if change expression foreign key object not null more. context.contextinstance.personnels.include("title").tolist(); is right way??..is there...

install android sdk on ubuntu -

i have downloaded android sdk tools according this page should update go it's directory , type: ./android when sdk manager opens can see sdk tools installed there isn't else do. since qt doesn't recognize sdk assume have not installed yet. there else should complete installation? edit: tried somthing else. downloaded adt bundle. in folder there sdk folder used folder , worked qt. in directory there folders in original sdk didn't exist: extras platform-tools system-images i suggest go adt bundle linux, can following link android adt linux extract downloaded package. download openjdk linux , install update qt if necessary add location of sdk qt now might able run eclipse adt location adt bundle contains eclipse + adt plugin - customized eclipse location of android sdk presetted android sdk tools - inside tools folder, contains android sdk services emulator, hierarchy viewer, sqlite etc android platform-tools - contains compiler runtime...

php - Hex2bin is not working when I am trying to use it to convert encoded data to binary -

i using bin2hex() function working when tried original value using hex2bin() saying "undefined function". solution? hex2bin available php version >= 5.4.0 - php version 2 date? below (copied php.net ) solution if version can not updated: <?php function hextobin($hexstr) { $n = strlen($hexstr); $sbin=""; $i=0; while($i<$n) { $a =substr($hexstr,$i,2); $c = pack("h*",$a); if ($i==0){$sbin=$c;} else {$sbin.=$c;} $i+=2; } return $sbin; } ?>

performance - Oracle Query/SQL tuning -

i have table total 198695 records , 96579 records project_id =555. have list interval partitioned table project_id. if run below query(without distinct),it takes 0.75 secs run. select kw,search_volume,target_url,keyword_type,rank_date,rank,url,domain alps_project_theme_kw_v min_rank =1 , project_id = 555; while if add distinct , run below query, takes 15 secs run select distinct kw,search_volume,target_url,keyword_type,rank_date,rank,url,domain alps_project_theme_kw_v min_rank =1 , project_id = 555; for results fetched both distinct , non distinct query same (1636 rows) can please suggest how should further tune query? please note:- have partitioned table on project_id mentioned above , analyzed ,have not created indexes. i suggest adding index on project_id reduce execution time. if dont want add index base table, copy o/p temp table, create index on temp table , fire distinct query, bet faster 15 sec.

c# - System.InvalidOperationException: Collection was modified error -

i have system.invalidoperationexception: collection modified error, can see output of console here . here code, removed many lines, structure easier read. static public void searchcode2(dictionary<string, string> mlist) { using (sqlconnection connection3 = new sqlconnection(configurationmanager.connectionstrings["db"].connectionstring)) { connection3.open(); sqlcommand command2 = new sqlcommand(null, connection3); var keyswithmatchingvalues = mlist.where(p => equals(p.value, "0")).select(p => p.key); // ce devrait macher, meme s'il y plusieurs requetes // tthe fallowing line error point out. foreach (var key in keyswithmatchingvalues) { console.writeline(" missing list"); string[] mottocut = key.tostring().split(' '); dictionary<string, int> movieslistmissing = n...

vector - three.js get double clicked 3d object -

ciao, trying accomplish this: able know wich 3d object double clicked in scene, , animate camera position bring object in center of screen. i tried without success adapt interactive cubes example uses raycaster , projector... http://www.gioblu.com/gio/web/solarsystem/index_backup as can see can navigate in space , change camera position right , left mouse button. able come initial camera position (earth in center of screen) double click on planet. why didn't had success adapting example? errors occuring? did mean this example? because raycaster , projector way looking for. first of need eventlistener ondblclick event on container. in event function can copy&paste linked example: 1) saving mouse coordinates mouse.x = ( event.clientx / window.innerwidth ) * 2 - 1; mouse.y = - ( event.clienty / window.innerheight ) * 2 + 1; 2) project coordinates world system via camera , create ray var vector = new three.vector3( mouse.x, mouse.y, 1 ); projector.unpr...

Twitter 401 not authorized PHP & Abraham Williams Twitter -

i've been using abraham williams twitter oauth library , breeze setting up, except 1 thing. try post message twitter , 401 not authorized. i've been searching internet answers, tried getting new consumer keys nothing seems work. this code i'm using post test tweet twitter. // connection $connection = new twitteroauth(consumer_key, consumer_secret, oauth_token, oauth_token_secret); // posten $connection->post('statuses/update', array('status' => "dit een tweet via de twitter api")); // error afhandeling $httpc = $connection->http_code; if($httpc == 200) { echo 'tweet posted!'; } else { echo "fail!"; } and error get. don't have callback url. should have one? twitteroauth object ( [http_code] => 401 [url] => https://api.twitter.com/1.1/statuses/update.json [host] => https://api.twitter.com/1.1/ [timeout] => 30 [connecttimeout] => 30 [ssl_verifypeer] => [...

android - Bluetooth Low Energy encryption and data safety -

i need send sensitive data on bluetooth low energy (ble) data connection between smartphone (ios & android) , embedded device (cc2540 chip). since don't consider app-code on phones safe hacking, need rely on ble safety encrypted package delivered server device once , once (i must assume second attempt deliver package, must attacker). i have been browsing net few days now, find out if data safe, , under conditions. unfortunately haven't been able come simple answer questions. is data safe if pair phone device? - suppose so, though understand pairing process flawed, theoretically possible man-in-the-middle (mitm) sniff encryption keys during pairing process , compromise connection. i need each device paired several phones (but communicating 1 @ time). what's maximum number of pairings pr. device? - unfortunately need pair rather large number of phones device(s). can perhaps pairing data (long term keys etc.) device , store on external memory, increase limit. ...

java - Retrieve a particular portion of data from pdf -

i need retrieve keyword related data pdf file. these keywords:title,scope of pdf,who proposed pdf,version,summary,state,regulator. is there tool retrieve data pdf? in advance you can use pdfbox apache , speaking have never used read lot on forums. other alternative can itext or jpedal . if interested can give try , confident pdfbox able meet requirements. thanks

asp.net - Edit GridView not working Properly -

i using gridview bounded sqldatasource. when click edit button in gridview, able edit fields. fields contains 3 text boxes, 2 dropdown list, 3 datepicker calenders. dropdownlist data bind database. if click on edit , after update text field values updated in database, dropdown , calender field entries in database null.. update query: updatecommand="update intakesheet set case_number = @case_number, case_name=@case_name, case_type=@case_type, case_status = @case_status, assigned_date = @assigned_date, assigned_to = @assigned_to, date_withdrawn= @date_withdrawn, date_delivered= @date_delivered, qc_by = @qc_by, qc_date=@qc_date, additional_notes = @additional_notes (case_number = @case_number)"> update parameters: <updateparameters> <asp:parameter name="case_number"/> <asp:parameter name="case_name" /> <asp:parameter name="case_type" /...

php - How to export to csv with concatenated columns -

i want export mysql data csv file concat 4 columns,but not work can 1 me asap want concat add1,add2,add3,city,pincode these columns , shows in single column in csv file thnx in advance my php code follows <?php require_once("config.php"); //enter headings of excel columns $contents="sr no,date,agent name,process,donar name,address,contact no,nearest station,suburbans,pickup time,confirmation status,pickup amount,field executive\n"; //mysql query records datanbase //you can customize query filter particular date , month etc...which depends database structure. $sr_no=$_get['sr_no']; $dt=date('y-m-d'); $user_query = mysql_query("select sr_no,entry_date,agent_name,process_name,donar_name,concat( ifnull( add1, '' ) , ' ', ifnull( add2, '' ) , ' ', ifnull( add3, '' ),' ',ifnull( city, '' ),'', ifnull( pincode, '' ) ) full_address,mobile_no,nearest_station,s...

c# - How do i use the AllowHtml attribute with the entity framework -

how go adding [allowhtml] attribute entity framework generated class without attribute being overwritten next time code generated? i looking allow ckeditor post information mvc4 application using razor without having use [validatereuqest(false)] on content entity class. you can use [metadatatype] attribute add metadata/attributes classes permanently without having edit original classes. for class content create new cs file in project , replace empty class with: [metadatatype(typeof(contentmetadata))] public partial class content { } public class contentmetadata { [allowhtml] public string contenthtml { get; set; } } the partial class name must match class name of entity class exactly, , attribute must match definition of attribute in entity class exactly. after rebuild, work if put attribute within entity class, added bonus of not being overwritten every time.

how to sort a Thai field using mongoDB -

how sort thai field using mongodb in following sql command? select * employee order convert(name using tis620) right now, not possible mongodb sort else "unicode code point". there issue in our issue tracker: https://jira.mongodb.org/browse/server-1920 tracks inclusion of locale-based, , case-insensitive sorting mongodb.

sql - most efficent way to compare a form value and database value -

i have created single table in magento database, table has no connections of magento tables. have created form allows user put information table. within table there column must hold unique value, have set column allow unique values in it. what i'm doing passing data in without checking if value unique , getting 'integrity constraint violation' message shown on screen. what want before trying pass data table check value user trying enter not exists within table , if does, pass them on relevant page, or possible use 'integrity constraint violation' pass user onto relevant page? i know how compare values using raw php , mysql code, after reading on magento see using sql queries discouraged considered creating array hold rows column comparing array against users inputted data, seems big waste of resources database grows. how best way achieve this? if situation sql query acceptable run directly on table, in code find function need use? in view, f...

iphone - How can i show user avatar image using xmpp framework in objective c? -

i creating chat application iphone using xmppframework. want display user list in uitableview user name , photo, , using nsdata *photodata = [[[self appdelegate] xmppvcardavatarmodule] photodataforjid:user.jid]; if (photodata != nil) cell.imageview.image = [uiimage imagewithdata:photodata]; else cell.imageview.image = [uiimage imagenamed:@"blank_image~iphone.png"]; but returns nil always. please help.. nsdata *photodata = uiimagepngrepresentation([[[self appdelegate] xmppvcardavatarmodule] photodataforjid:user.jid]); if (photodata) cell.imageview.image = [uiimage imagewithdata:photodata]; else cell.imageview.image = [uiimage imagenamed:@"blank_image~iphone.png"];

mysql - An example of form validation inside php -

the below show example of implementing form validation inside php detect empty field or unwanted character , alert error message output. have no credit in work, barely compound them suit own site needs. share code did found difficulty find 1 before. answer below provide more advance solution failed make work thou, it's not problem due novice skill in php . so show basic step novice me before. below code show basic php form validation , email specific email address when user press submit. <?php $me =$_server['request_method']; if ($_post['mail']=='' && $me =="post") { //remember in input tag,set name 'mail' , in form tag set action " "; $name = preg_replace('/[^a-za-z]/','', $_post['name']);//filter letters $tel = preg_replace('/[^0-9]/','', $_post['tel']);//filter number //$email$regex credit adam khoury www.developphp.com $email = $_post['email']; $...

python 3.x - Print list to csv file in Python3 -

i have list this. all_chords = [['c', 'c', 'e', 'g'], ['cm7', 'c', 'e', 'g', 'b'], ['c7', 'c', 'e', 'g', 'bb'], ['cm7', 'c', 'eb', 'g', 'bb'], ['cm7b5', 'c', 'eb', 'gb', 'bb'], ['cdim7', 'c', 'eb', 'gb', 'bbb(a)'], ['caug7', 'c', 'e', 'g#', 'bb'], ['c6', 'c', 'e', 'g', 'a'], ['cm6', 'c', 'eb', 'g', 'a'], ] i want print out csv file, this. c_chords.csv c;c,e,g cm7;c,e,g,b c7;c,e,g,bb cm7;c,eb,g,bb cm7b5;c,eb,gb,bb cdim7;c,eb,gb,bbb(a) caug7;c,e,g#,bb c6;c,e,g,a cm6;c,eb,g,a it has 2 fileds separted semicolon. (not comma) i used csv module, this. myfile = open('c_chords.csv','w') wr = csv.writer(myfil...

HTML Auto-Complete -

i have form in html has text input. i'd auto-complete list of sports, if type in "ba", shows basketball, baseball, , badminton list below. don't want tags inside, want user typing input suggestions below. basically, i'd know how add such element form. this might unclear, i'm happy explain more. i'm new here (but searched , searched no avail!) apologies misuse. here plugin list auto-complete jquery plug-in pligin 1 : http://jqueryui.com/autocomplete/ pligin 2 : http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ pligin 3 : https://github.com/dyve/jquery-autocomplete pligin 4 : http://www.pengoworks.com/workshop/jquery/autocomplete.htm pligin 5 : https://github.com/devbridge/jquery-autocomplete you may use 1 of theme good luck!!

c# - My project references another project which references a 3rd party assembly. How do I set the assembly path for this 3rd party assembly? -

my project references project b. project b holds reference 3rd party assembly. project located in folder project b , 3rd party assembly (due integration software). know have assemblies in integration folder, have them in own folder have other assemblies executable used diagnose , setup module. i have subscribed myresolveeventhandler in project in appdomain.currentdomain , , can set correct assembly path of project b. problem occurs when project calls method in project b 3rd party assembly used. throws filenotfoundexception assembly, , display path of integration folder rather folder set project b in myresolveeventhandler . i've tried appdomain.currentdomain.load(assemblyname.getassemblyname(@"pathof3rdpartyassembly")) , tell me loaded assembly in appdomain , still throw same filenotfoundexception mentioned above. how can set assembly path of 3rd party assembly used within project b project a? edit: sorry, problem caused hidden bug myself. implemented dl...

asp.net - Webmatrix - WebGrid: change css style conditionally -

i've started webmatrix , i'm trying transform html table webgrid. data comes db , want change css class each td (within 1 column) depending on items content. so example if item contains "," apply class="multi", if doesn't contain "," , not null class="single", else "none". <td class="multi"> <td class="single"> <td class="none"> i've tried webgrid style: , format: settings couldn't classname switch depending on value of item. think need right syntax started. i hope can me out here. thank you. if want use webgrid, real option set td style based on cell value via javascript after has rendered. style parameter accept string representing css class apply. alternatively, can conditionally set content in format parameter based on value, filling td span or div can style eg: <style> td.nopadding{padding: 0;margin: 0;} .green{backg...

java - Android MultiTouch does not work -

@override public boolean ontouchevent(motionevent event) { synchronized (getholder()) { int aktion = event.getaction(); if (aktion == motionevent.action_down) { touched = true; bar.sharetouch(event.getx(), event.gety(), touched); } else if (aktion == motionevent.action_up) { touched = false; bar.sharetouch(event.getx(), event.gety(), touched); } if (aktion == motionevent.action_pointer_down) { touched2 = true; bar.sharetouch2(event.getx(), event.gety(), touched2); } else if (aktion == motionevent.action_pointer_up) { touched2 = false; bar.sharetouch2(event.getx(), event.gety(), touched2); } } return true; } this code chech if first finger going onto screen or leaving it. same finger. public void sharetouch2(float xtouch2, float ytouch2, boolean touched2) ...

uWSGI suitable for Rails production app? -

our system administrator proposed move rails app of ours nginx/passenger nginx/uwsgi, uwsgi seems little used ruby-community: unable find benchmark comparisons uwsgi , other rack servers or other experiences of users. can confirm using uwsgi ror app (or bad) idea? please share experience server. thanks, niels i met same issue recently. did investigation , deployed rails web site onto uwsgi. http://projects.unbit.it/uwsgi/wiki states support ruby "stable". think ready production.

install asp.net application on IIS using wix without IIS backward compatibilty on -

i have created wix installer installs website in iis have keep iis backward compatibility on. <component id="virtualdirectorywebapppool" guid="{giud}" permanent="yes"> <iis:webapppool id="webapppool" name="${productname}" managedruntimeversion="v4.0" managedpipelinemode="integrated" /> <createfolder /> </component> <component id="virtualdirectorywithoutwinauth" guid="{guid}" permanent="yes"> <condition>typeofauthentication = "forms"</condition> <iis:webvirtualdir id="webvirtualdirectorywithoutwinauth" alias="[vdname]" directory="webuifolder" website="defaultwebsite" > <iis:webapplication id="webapplicationwithoutwinauth" name="[vdname]" webapppool="webapppool" /> <iis:webdirproperties id="webd...

optimization - Export a copy of the project in Xcode without including the unused files that are inside the project folder -

it's long title know... :p problem this: have xcode project inside folder, in folder there many files (source code, images, ...) not used project anymore. export xcode project in different folder getting rid of these files, have new folder containing project , files used project. possible? thank you. john

java - Joda-Time ISO8601 standard ISOPeriodFormat cannot parse decimal fraction -

as stated in iso8601 wikipedia article : the smallest value used may have decimal fraction, in "p0.5y" indicate half year. decimal fraction may specified either comma or full stop, in "p0,5y" or "p0.5y". but can't parse such period joda-time, following code : period.parse("p0.5y", isoperiodformat.standard()); fails : java.lang.illegalargumentexception: invalid format: "p0.5y" malformed @ "0.5y" who's wrong : wikipedia, joda-time isoperiodformat.standard() or mistake? with jodatime 2.2 it looks limitation of jodatime. has isoperiodformat , periodformatterbuilder creating periodformatters. isoperiodformat supports subset of iso8601 formats (none including fractional years) per link in comments. periodformatbuilder, although highly configurable, apparently deal years integers : http://joda-time.sourceforge.net/apidocs/org/joda/time/format/periodformatterbuilder.html

mysql - How to copy a database table after a mysqldump -

i have mysqldump of databases projects created this: mysqldump -u username -h localhost --all-databases | gzip -9 > alldb.sql.gz i want copy specific database of specific project (project1) of alldb.sql file (which have gunzipped). need copy project1_production database anotherproject_development database of application i'm developing. what easiest way copy (and overwrite if entries exist) project1_production database of alldb.sql file anotherproject_development database of application i'm developing? mysql -d mydatabase -o < dump.sql a thread here

Tableau server error - field not found, does not exist in database -

i using tableau version 8.0.0. when publish report in live server following error **"tableauexception: field '[account_schedule_fact].[date_dm]', included in join clause, not exist. unable connect server ". have verified column date_dm exists in table account_schedule_fact. server , running. join condition in report has been verified case sensitive issue. when publish same report in development server or when check in desktop (without publishing) not throw error , works smoothly. custom sql tableau has been executed in our sql server database , returns correct number of rows. can point out why error occurring or whether there workaround problem? , regards gautam

objective c - iOS Updating Property of an Object -

i'm new ios dev , question i'd appreciate guidance on. i have viewcontroller has property want regularly replace: @property (strong, nonatomic) iboutlet uiimageview *image; now in class update property, first alloc , init viewcontroller update property accordingly. when come replace image ever uses first image. if instantiate viewcontroller alloc init works ok. so question correct/best practice way update, creating new instances of viewcontroller - memory efficiency wise best practice? thanks. it sounds want change image, rather replacing entire view controller. can show code changing image? also, please specify if want change image view or image inside it. (the image view displays actual image on screen. suggest name property imageview , avoid confusion.) here 2 examples. i'm assuming there variable 'theviewcontroller' holds reference view controller. replacing image view: // create new image view new image inside theviewcontroller...

android - Listview with TitlepageIndicator Strage indexoutofbound exception -

i having listview in view pager , have used titlepageindicator. seems working fine randomly crashes due indexoutofbound exception. not sure cause it. below have attached stacktrace of it. found this link , mentioned has been fixed in 2.1.0. using 2.3.1 version. ` > 07-31 15:32:10.242: w/system.err(6720): java.lang.indexoutofboundsexception: invalid index 4, size 1 07-31 15:32:10.247: w/system.err(6720): @ java.util.arraylist.throwindexoutofboundsexception(arraylist.java:251) 07-31 15:32:10.247: w/system.err(6720): @ java.util.arraylist.get(arraylist.java:304) 07-31 15:32:10.247: w/system.err(6720): @ android.widget.headerviewlistadapter.getview(headerviewlistadapter.java:225) 07-31 15:32:10.247: w/system.err(6720): @ android.widget.abslistview.obtainview(abslistview.java:2452) 07-31 15:32:10.247: w/system.err(6720): @ android.widget.listview.makeandaddview(listview.java:1775) 07-31 15:32:10.247: w/system.err(6720): @ android.widget.listview.filldown(...