Posts

Showing posts from February, 2012

How can I output a UTF-8 CSV in PHP that Excel will read properly? -

How can I output a UTF-8 CSV in PHP that Excel will read properly? - i've got simple thing outputs stuff in csv format, it's got utf-8. open file in textedit or textmate or dreamweaver , displays utf-8 characters properly, if open in excel it's doing silly íÄ kind of thing instead. here's i've got @ head of document: header("content-type:application/csv;charset=utf-8"); header("content-disposition:attachment;filename=\"chs.csv\""); this seems have desired effect except excel (mac, 2008) doesn't want import properly. there's no options in excel me "open utf-8" or anything, … i'm getting little annoyed. i can't seem find clear solutions anywhere, despite lot of people having same problem. thing see include bom, can't figure out how that. can see above i'm echo ing data, i'm not writing file. can if need to, i'm not because there doesn't seem need @ point. help? update: tried ech

database - Storing Images in DB - Yea or Nay? -

database - Storing Images in DB - Yea or Nay? - so i'm using app stores images heavily in db. what's outlook on this? i'm more of type store location in filesystem, store straight in db. what think pros/cons? i'm in charge of applications manage many tb of images. we've found storing file paths in database best. there couple of issues: database storage more expensive file scheme storage you can super-accelerate file scheme access standard off shelf products for example, many web servers utilize operating system's sendfile() scheme phone call asynchronously send file straight file scheme network interface. images stored in database don't benefit optimization. things web servers, etc, need no special coding or processing access images in file system databases win out transactional integrity between image , metadata important. it more complex manage integrity between db metadata , file scheme data it hard (within contex

java - Why are ListModel objects necessary? -

java - Why are ListModel objects necessary? - let's have list called jlist1. we want create model it, of course, utilize listmodel object. done. defaultlistmodel<integer> numbers = new defaultlistmodel<>(); numbers.addelement(1); numbers.addelement(2); numbers.addelement(3); jlist2.setmodel(numbers); my question why utilize list model object instead of normal list or collection. reason know of setmodel() accepts list models argument, reason these decisions? if @ javadoc of defaultlistmodel realize provide several methods manipulate item in jlist not possible using simple collection. if initialize list array or vector, constructor implicitly creates default list model. default list model immutable — cannot add, remove, or replace items in list. create list items can changed individually, set list's model instance of mutable list model class, such instance of defaultlistmodel. please have @ swing tutorial on how utilize lists explained in

C++ : pointers to stack-dynamic variables -

C++ : pointers to stack-dynamic variables - i new c++. don't quite understand why code not work. code have stack-dynamic variable? help. int twice(int x) { int *y; *y = x * 2; homecoming *y; } int *y; *y = x * 2; is not right because y points nowwhere, not allocated memory. undefined behavior. after line of code programme unpredictable , cannot assume behavior. you need allocate memory first using new or malloc , assign x*2 or pass address assign y into, i.e: int *y = new int( x * 2); example: int main() { int x = 4; int *y = new int( x * 2); cout << x << "," << *y; delete y; homecoming 0; } side note: unsafe homecoming pointer memory allocated in function because might become unclear , when responsible freeing allocated memory. in particular case there absolutely no apparent reason dynamic allocation way. c++

asp.net - DropDownlistFor with a null-value as default -

asp.net - DropDownlistFor with a null-value as default - the code below displays 1 dropdownlist categories , empy textbox creating new category. both "target" same property , hope next sceanrio: if user have not made selection in dropdownlistfor , value in textboxfor should passed controller. my problem there value selected in dropdownlist default. there way have default value ---choose category---, has value of null , not passed controller? @using (html.beginform("savecategory", "home", formmethod.post)) { <div class="col-md-3"> @html.hiddenfor(o => o.id) <p>choose existing category</p> @html.dropdownlistfor(model => model.choosencategory, model.category.lis

Can't clone a VM instance from Google Developer Compute Console -

Can't clone a VM instance from Google Developer Compute Console - i'm trying clone instance centos based , in load balancing pool. click "create" see yellowish baloon saying "creating instance...." don't see task running in activities windows , message "creating instance..." freeze ever. so tried creating instance starting snapshot of original instance result same. i'm not sure if happened in project or problem related fact the instance in pool of loadbalancer. give thanks you. this screenshot: google-compute-engine

php - Yii Framework | Nested arrays in same table -

php - Yii Framework | Nested arrays in same table - using cactiverecord table looks this: a column parent_id has relation many id, , works properly. id | parent_id ---+---------- 1 1 <- top 2 1 <- means parent_id 1 has parent id=1 3 1 4 2 <- parent id=2 5 2 6 2 , many nested levels.... a goal how nested php classically way nested arrays info (arrays within arrays). array(1,1) { array(2,1) { array(4,2) .... } } problem yii. didn't find way how pick info nested array using cactiverecord. what best way create nested array results? main goal easy forwards render view don't separate many functions , calling many models outside modules or models. a 1 function result. solved using this: recursive function generate multidimensional array database result you need info arrays model: $somemodel = mymodel::model()->findall(); then set in array rather yii objects

javascript - Highcharts - using flag in columnrange charting to make a datarange invisible and dispaly message -

javascript - Highcharts - using flag in columnrange charting to make a datarange invisible and dispaly message - i have highcharts - columnrange chart works fine want create invisible 1 of dataranges based on info for illustration in code var arylist = '[{"name" :"taxupdt_ftp","st_time_am_pm" :"n/a","ed_time_am_pm" :" pm", here when "st_time_am_pm" :"n/a" want disable info range , display message says "not available" here jsfiddle thanks. help appreciates.. you need set parameter visible false , in callback hide point graphic. example: http://jsfiddle.net/pq5eg/1/ $.each(chart.series, function(i, s){ $.each(s.data, function(j, p){ if(p.hidden) p.graphic.hide(); }); }); javascript jquery highcharts

javascript - Select input shown with ng-show -

javascript - Select input shown with ng-show - i'd set focus on input after it's shown ng-show. however, requires jquery phone call made after $digest cycle. know how run code after item shown, without resorting settimeout(), or such thing? here's illustration plunk of issue: http://plnkr.co/edit/synsip?p=preview you can write simple directive , dont need jquery : yourapp.directive('focusme',function(){ homecoming function(scope,elem,att){ elem.focus(); } }); and can utilize : <input type="text" focusme> javascript jquery angularjs ng-repeat ng-show

cryptography - Force pin for signing data(SignedXml)? -

cryptography - Force pin for signing data(SignedXml)? - i testing illustration : http://msdn.microsoft.com/en-us/library/ms148731(v=vs.110).aspx , works great. im using certificate loaded in certificates store(my) smartcard. the problem code never inquire pin code? how can forcefulness pin code check? edit : have tried code , works first 1 : http://ianreddy.wordpress.com/2011/02/14/sign-data-using-certificates-in-c/ (no pin code demand) the pin asked csp provider, i.e. module developed hardware vendor , maps certificates hardware windows certificate storage. it's possible module caches pin process or have not set user pin hardware (set "admin's" pin). cryptography certificate x509certificate smartcard signing

android - How can I get a TextView from a ListView WITHOUT Click? -

android - How can I get a TextView from a ListView WITHOUT Click? - i'm starting out in android , creating basic to-do-list using listactivity . essentially, every time item (an entry) clicked, item marked (or unmarked) in it's corresponding sharedpreferences file. in addition, corresponding textview slashed (or unslashed) using setpaintflags , follows: protected void onlistitemclick(listview l, view v, int position, long id) { super.onlistitemclick(l, v, position, id); sharedpreferences savedlist = this.getpreferences(0); string item = savedlist.getstring(position + "", ""); if ( item.contains(checked) ) { item = item.replace(checked,""); saveitem(item, position); ((textview)v).setpaintflags( ((textview)v).getpaintflags() & (~ paint.strike_thru_text_flag)); } else { item = checked + item; saveitem(item,position); ((textview)v).setpaintflags( ((textview

xml - xsd Complex Types with Mixed Content -

xml - xsd Complex Types with Mixed Content - i reading this tutorial , states xml this: <letter> dear mr.<name>john smith</name>. order <orderid>1032</orderid> shipped on <shipdate>2001-07-13</shipdate>. </letter> you need xml schema definition: <xs:element name="letter"> <xs:complextype mixed="true"> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="orderid" type="xs:positiveinteger"/> <xs:element name="shipdate" type="xs:date"/> </xs:sequence> </xs:complextype> </xs:element> but see not correct. defines name, orderid, , shiptdate elements didn't define plain text dear mr. , your order , will shipped on the xs:string type has been assigned name element. could help me understanding please? many thanks that

sorting - fread reading garbage value from stdin -

sorting - fread reading garbage value from stdin - the next code sorting numbers based on quicksort in c. optimize speed, scanf() has been replaced fread(). on printing sorted list, garbage values come out. exact problem statement on :http://www.codechef.com/problems/tsort #define size 32768 #include <stdio.h> #include <stdlib.h> int compare(const void *a, const void *b) { homecoming (*(unsigned long *)a-*(unsigned long *)b); } int main() { char buffer[size]; register int readbytes=0; unsigned long buffercounter=0, bufferedinput=0; unsigned long * array, t, i; scanf("%lu", &t); fflush(stdin); array=(unsigned long *) malloc(sizeof(long)*t); i=-1; while(readbytes=fread(buffer, sizeof(char), size, stdin)>0) { for(buffercounter=0; buffercounter<readbytes; buffercounter++) { if(buffer[buffercounter]=='\n' || buffer[buffercounter]==' ') {

migration - java.lang.NoSuchMethodError: javax.faces.component.UIComponent.getPassThroughAttributes(Z)Ljava/util/Map; after migrating to JSF 2.2 -

migration - java.lang.NoSuchMethodError: javax.faces.component.UIComponent.getPassThroughAttributes(Z)Ljava/util/Map; after migrating to JSF 2.2 - i getting below exception after migrating jsf 2.2. specifically, i'm upgrading mojarra 2.1.17 mojarra 2.2.8. java.lang.nosuchmethoderror: javax.faces.component.uicomponent.getpassthroughattributes(z)ljava/util/map; @ org.primefaces.renderkit.rendererutils.renderpassthroughattributes(rendererutils.java:79) @ org.primefaces.renderkit.corerenderer.renderdynamicpassthruattributes(corerenderer.java:119) @ org.primefaces.renderkit.corerenderer.renderpassthruattributes(corerenderer.java:114) @ org.primefaces.renderkit.bodyrenderer.encodebegin(bodyrenderer.java:44) @ javax.faces.component.uicomponentbase.encodebegin(uicomponentbase.java:823) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1611) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1616) @ com.sun.faces.application.v

broadcastreceiver - Boot Reciever Working on Emulator but not android actual phone -

broadcastreceiver - Boot Reciever Working on Emulator but not android actual phone - on boot completed starting service runs on emulator when run on android phone broadcast receiver doesn't start service. infact app not receiving boot completed broadcast device. this manifest file: <uses-sdk android:minsdkversion="8" android:targetsdkversion="14" /> <uses-permission android:name="android.permission.receive_boot_completed" /> <application android:allowbackup="true" android:icon="@drawable/ic_logo" android:label="@string/app_name" android:theme="@style/apptheme" > <receiver android:name="com.darkrai.smsbasedcontroller.bootreciever" android:enabled="true" android:exported="false" > <intent-filter> <action android:name="android.intent.action.boot_completed" /&

Javascript: different keyCodes on different browsers? -

Javascript: different keyCodes on different browsers? - so i've seen forums posts different browsers reporting differenct keycodes, seems avoid "why?". i trying capture colon (:) keycode , realized firefox reports e.keycode 56. while chrome reports 186 (i think that's was). is there univeral way of getting right keycode across browsers? and why different if same keys? i more curious whether there international way of getting same key press. thanks. see http://unixpapa.com/js/key.html explanation why have different keys. not know of international way match keys. javascript keycode

vb.net - How can I debug a referenced DLL file from Visual Studio 2013? -

vb.net - How can I debug a referenced DLL file from Visual Studio 2013? - to start, know question has been asked 1000000 times on place, have no experience vb/visual studio, can't find solution can create sense of. i creating new vb.net project(solution?) , , making calls functions c library in dll file. dll file have pdb file , both stored @ same location. in code below shows how declare functions in vb.net code, have not figured out how attach pdb file project. declare function initrelay lib "z:\devel\relayapi\debug\relayapi.dll" (byval setbaud action(of short), byval getit func(of short, short), byval putit action(of short), byval flushit action, byval delay action(of short)) byte declare sub freerelay lib "z:\devel\relayapi\debug\relayapi.dll" () ... i getting exception somewhere in dll file, way have set up, can not debug dll file. whether adding breakpoints, or print statements, need way see in dll project fails. questions have loo

jquery - AJAX response for file download is in encoded format. -

jquery - AJAX response for file download is in encoded format. - i create ajax phone call as var formdata = new formdata(); formdata.append('name', 'john'); formdata.append('company', 'abc'); $.ajax({ url: url, data: formdata, processdata: false, contenttype: false, success: function(data){ window.location.href = data.url; // info not have url attribute. }, error: function(err){} }); here, should ideally excel file download response. however, success: function(data){ } here data contains bunch of encoded values can see in browser console. how can download url here. ajax meant used sending/retrieving data, info in success function. you should create post ordinary form , create sure server setting right header. <form method="post" action="/path/to/excel/file"> ... </form> after form create post, , server supply info , header if browser not back upward

sorting - Creating a sorted Linked List in Java -

sorting - Creating a sorted Linked List in Java - so supposed sort linked list in java alphabetical order (the nodes strings). not allowed utilize collections have create own linked list , sorting algorithm. have created method finds largest (or furthest downwards alphabet) word in linked list work. trying sort taking linked list, finding largest element , inserting new linked list. removes largest , goes doing same until linked list empty. ending blank list when run it, wrong code? code returns largest element public link islargest(){ link big = first; link temp = null; link current = first; link after = current.next; while (after != null){ if (large.lastname.compareto(after.lastname) < 0){ big = after; } temp = current; current = temp.next; after = current.next; } homecoming large; } to remove, set largest element teh front end remove it. private static linkedlist

multithreading - Thread synchronisation -

multithreading - Thread synchronisation - we have 2 methods a(){ ....//a-method body } b(){ ....//b-method body } task synchronize them in such way: in order of starting threads method should wait until method b finished. assume have standard synchronisation objects - mutex,semphore,monitor. how can implemented? update 1 i've tried this. mutex mut = new mutex(); a(){ mut.lock(); ....//a-method body mut.release(); } b(){ mut.lock(); ....//b-method body mut.release(); } but problem in such implementation there posibility method b executed first. want a wait till b finished your task accomplished events or semaphores. semaphore created externally threads , b, b sets semaphore @ end, , waits semaphore signal. if don't need/want utilize synchronization primitives, plenty utilize global boolean variable , check in loop in thread (but of course of study not effective synchro object). multithreading synchronization

xpages getDocument().getUniversalID() -

xpages getDocument().getUniversalID() - i want test getting universalid: i create computed field: <xp:text escape="true" id="computedfield3" value="#{javascript:cdoc.getdocument().getuniversalid()}"> </xp:text> when compose doc. content on xpage, computed field having unid , changing if nail refresh. in lotus notes programming, unid if current document saved, having default value @text(@documentuniqueid) . should save first cdoc datasource right unid? know i'm missing something. thanks time if refresh page in browser new document gets created. that's why different unid. from previous questions know define cdoc info source with <xp:this.data> <xp:dominodocument var="cdoc" formname="fmperscontact"> </xp:dominodocument> </xp:this.data> and means cdoc created every time open xpage. update: in addition, different unid every time

What are the differences between fieldquery vs termquery in elasticsearch? -

What are the differences between fieldquery vs termquery in elasticsearch? - what differences , similarities between fieldquery , termquery filterbuilders.queryfilter(querybuilders.fieldquery("truckname", "joshi")); filterbuilders.queryfilter(querybuilders.termquery("truckname", "joshi")); both returning same results. please give examples a term query looking exact match of terms field without doing analysis of parameter. it looks fieldquery (from http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/query-dsl-field-query.html) simple form of query_string on specific field, doing analysis. the 2 deed same single word "truckname", termquery faster. elasticsearch

regex - How to write hive query for Regex_extract -

regex - How to write hive query for Regex_extract - input file : 400xxx$52568999x&^000x&^00002 i want extract file 1 column : 4005256899900000002 how can in hive regex_extract ? please can 1 allow me know . i don't know hive, in regex terms, you're asking is: search: \d+ (any chars not digits) replace: empty string. in the demo, see substitutions @ bottom. regex hive

asp.net - SQL Server Stored Procedure Returns All Result properly for otherdays except the Starting day -

asp.net - SQL Server Stored Procedure Returns All Result properly for otherdays except the Starting day - i facing problem while trying info database & displaying in gridview. in front-end have page search study particular day. code working days except 1st day. 1st day not displaying values.1st day means, suppose entered opening balance entry on 01/06/2014 in opening balance table . & in search page want see study 22/06/2014 working fine. if want see study of 01/06/2014 not showing result. from stored procedure getting study info have written : alter procedure [dbo].[usp_getdatailsfordailyreport] @vdate varchar(50) --declare @vprevdate varchar(50) begin --set @vprevdate=(select convert(varchar(50),dateadd(dd, datediff(dd, 0, convert(datetime,'19/06/2014',103)), -1),103)) set nocount on; -- insert statements procedure here select prevopening.schoolid, schooldetails.schoolname, schooldetails.schoolcode, schooldetails.sansadno, schoolde

javascript - CSS Hover being de-activated -

javascript - CSS Hover being de-activated - i displaying page of thumbnails, if hover on them, description displayed. for using span element css .thumb:hover .thumbtext { display: inline-block ; } this works fine initially. but needs work on touch device , touch not have hover, added button show descriptions. this works fine, 1 time have used button toggle, description javascript function has somehow disabled css hover , can not work out why. var captionsoff = true; function togglecaptions() { if (captionsoff) { /* turn captions on */ $('.thumbtext').css("display", "inline-block") $("#btncaption").html("hide thumb captions"); captionsoff = false; } else { /* turn captions off */ $('.thumbtext').css("display", "none") $("#btncaption").html("show thumb captions"); captionsoff = true; } the s

objective c - Why is AnyObject[] bridged from NSArray in Obj-C Class Empty in "success" closure in Swift? -

objective c - Why is AnyObject[] bridged from NSArray in Obj-C Class Empty in "success" closure in Swift? - i have class method in obj-c class: + (void) tagsfetchforid:(nsnumber *) tid successful:(void (^)(nsarray *tags)) successful failure:(void (^)()) failure; this worked fine pre-swift, function named successful() in implementation of above metho beingness used pass resulting array handling block in used obj-c class, did necessary info in array (it's async http situation several levels down, part still obj-c , still working). the method bridges swift in manner code completion gives me this: potsshareddata.tagsfetchforid(<tid: nsnumber?>, successful: <((anyobject[]!) -> void)?>, failure: <(() -> void)?>) ...which i've turned this: potsshareddata.tagsfetchforid(transactionid, successful: { (fetchedtags: anyobject[]!) -> void in }, failure: { }) i'm not getting fetchedtags, despite fact when break on o

c++ - Pool of extended OVERLAPPED objects in a multithreaded environment: where and how to use locking efficiently -

c++ - Pool of extended OVERLAPPED objects in a multithreaded environment: where and how to use locking efficiently - in c++, i've stream object abstracts handle on windows, , i've various derivatives objects, such file , tcpsocket , udpsocket , pipe derives straight stream object, , i've requestio object own version of extended overlapped object, is, requestio straight inherits overlapped structure. now, saying requesio same saying overlapped . in requestio object store several useful things couldn't stored in single overlapped structure, such flags, user pointers , on. there store pointer next requestio object, in order have intrusive linked list of these objects. then, stream object has 2 heads of intrusive linked list, 1 requestio objects reading, , 1 writing. in way stream object can have little pool of these requestio objects, , don't have allocate/deallocate them @ every i/o operation, nor needs locking because 2 intrusive list separ

html - Make src point to a php page -

html - Make <img> src point to a php page - i have images saved in root directory normal user can't access. randomly generate filenames, don't want them know path or name of file. currently, have img element so: <img src="get_image.php?id=1"> i have get_image.php page so: <?php include_once 'includes/db_connect.php'; include_once 'includes/functions.php'; $uploaddir = '/root/......./uploads/'; //direct path root folder holding files $id = $_get['id']; if(!is_numeric($id)) { die("file id must numeric"); } // quick query on false user table $stmt = $mysqli->prepare("select `name`, `mime` `uploads` `filmid`=?"); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($name, $mime); // going through info while($stmt->fetch()) { header("content-type: " . $mime); readfile($uploaddir.$name); } ?> if there someway can thi

c# - Getting remainder of sequence but with exception on element with remainer zero -

c# - Getting remainder of sequence but with exception on element with remainer zero - let have number 1 24, want remainder of these 12 mod 12 sequence 1 11 , additionally 0 (of 12 , 24) . need 0 12. how accomplish such thing in 1 liner(without additional variables or ifs). right code this: for (int = 1; <= 24; i++) { console.writeline(i % 12); } oneline solution (with slight overhead though: i % 12 computed twice): for (int = 1; <= 24; i++) { console.writeline(i % 12 == 0 ? 12 : % 12); } pure arithmetic solution is for (int = 1; <= 24; i++) { console.writeline(12 - (12 - % 12) % 12); } c# modulus sequences

php - error when trying to write file -

php - error when trying to write file - i trying write file. maintain getting error though , i'm not sure create of it. there has suggestions on this. much error: warning: fopen(library/webserver/documents/gasdev/test_files/850_855_csv_tests/855_export/gunb0855.z9000404): failed open stream: no such file or directory in /library/webserver/documents/gasdev/src/controller/containercontroller.php this function using: public function savefile($savefile,$content){ $newfile = fopen($savefile, 'w'); fwrite($newfile, $content); fclose($newfile); }//end savefile() you cant read or write directory doesnt exist. code in reply should run before trying open it php: fopen create folders php fopen fwrite

mysql - Find every 2 alternate records in sql -

mysql - Find every 2 alternate records in sql - i have issue sql query. it's below. in particular field record consists of "a" , "b" only. now if want find 2 records of "a" followed 2 records of "b" , 1 time again 2 records of "a" , 2 records of "b" , on till end of records. example output should below. id field --------- ----- 2 3 1 b 5 b 4 7 6 b 8 b ......... ......... .............. , on kindly help me above....as stuck query. thanks! you can enumerating rows each value , cleverly ordering results: select id, field (select t.*, if(field = 'a', @a_rn := @a_rn + 1, @b_rn := @b_rn + 1) rn table t (select @a_rn := 0, @b_rn := 0) vars ) t order (rn - 1) div 2, field; mysql

java - Check if folder exists and if so add "New Folder 2" -

java - Check if folder exists and if so add "New Folder 2" - i have web application inherited. new java don't beat me bad. have next method add together new folders attachment page. user can create new folders on page , rename, how check see if "new folder" exists , if create "new folder (2)" or "new folder (3)" etc... here method attachments servlet: protected void newfolderaction(httpservletrequest request, httpservletresponse response, user user, string folderid) throws unsupportedencodingexception, ioexception { string key = request.getparameter("key"); string value = request.getparameter("value"); attachment parent = attachmentrepository.read(uuid.fromstring(key)); string path = parent.getpath(); logger.debug("newfolder: key=" + key + " value=" + value + " path=" + path); if (attachmentrepository.read(path + "new folder/") =

Layout Design -android -

Layout Design -android - i want create design below image showing popup window. i've tried <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00154271" > <linearlayout android:id="@+id/linearlayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:background="#154271" android:orientation="vertical" > <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:orientation="vertical" >

c# - Different sized TabPage items within the same TabControl -

c# - Different sized TabPage items within the same TabControl - i have tabcontrol multiple tabpage items. is possible create 1 tabpage different size rest, while keeping tabs within same control? i'm trying resize actual pages themselves, not tab icons. if want create 1 tab larger can add together bunch of spaces in tab's text property until desired size. if want resize tabcontrol each tab add together code selectedindexchanged event resize tabcontrol based on tab selected. though, don't know if recommend ux perspective. c# winforms resize tabcontrol tabpage

How to allow paragraphs in a rails text area similar to html text editors such as ckeditor? -

How to allow paragraphs in a rails text area similar to html text editors such as ckeditor? - is there way to allow user write paragraphs (with spaces) in rails text_area similar html text editors such ckeditor. <%= form_for(@usernote) |f| %> <%= render 'shared/error', object: f.object %> <div class="field"> <%= f.text_area :note, :rows => 15, placeholder: "create note..." %> </div> <%= f.submit "create", class: "btn btn-large btn-success" %> <% end %> by "spaces" mean new lines? when display text database view, can utilize simple_format() view helper re-apply formatting user submitted text with. #show.html.erb <p><%= @post.title %></p> <p><%= simple_format(@post.body) %></p> ruby-on-rails ckeditor

Protocol: Cannot assign to 'X' in 'Y' in Swift -

Protocol: Cannot assign to 'X' in 'Y' in Swift - i defined simple protocol , a class using generics can handle protocol. in lines marked error error: "cannot assign 'flag' in 'aobj'. protocol flag { var flag: bool {get set} } class testflag<t: flag> { func toggle(aobj: t) { if aobj.flag { aobj.flag = false; // <--- error } else { aobj.flag = true; // <--- error } } } do have thought why , have alter prepare it? from docs: function parameters constants default. trying alter value of function parameter within body of function results in compile-time error. means can’t alter value of parameter mistake. in case, can add together inout toggle persisted beyond function call: func toggle(inout aobj: t) { if aobj.flag { aobj.flag = false; else { aobj.flag = true; } } you have done: func toggle(

Crystal Report: Rounding off field automatically on using Sum formula, Visual Studio 2008 -

Crystal Report: Rounding off field automatically on using Sum formula, Visual Studio 2008 - trying sum amount field on basis of grouping field. scheme automatically rounding of decimals. want output decimals. also, using formatting alternative show info 2 decimals ex: 500.73 automatically changed 501.00 using crystal reports visual studio 2008 approach1: try below totext(<<databasefiled>>,2,"") approch2: right clikc of summary field ---> format ---> number tab ---> select required format visual-studio-2008 crystal-reports-2008

c# - PropertyInfo.SetValue ArgumentException? -

c# - PropertyInfo.SetValue ArgumentException? - i have next code. however, has runtime exception on setvalue . may cause error? var _filter = new filter(....); // filter implemented ifilter applyfilter(_view.name, x => x.name); private void applyfilter<t>(t curr, expression<func<ifilter, t>> prev) { var expr = (memberexpression)prev.body; var prop = (propertyinfo)expr.member; if (!equalitycomparer<t>.default.equals(curr, (t)_filter[prop.name])) { prop.setvalue(_filter, curr, null); // error ..... // on _filter the exception is: system.argumentexception unhandled message=property set method not found. source=mscorlib stacktrace: @ system.reflection.runtimepropertyinfo.setvalue(object obj, object value, bindingflags invokeattr, binder binder, object[] index, cultureinfo culture) @ system.reflection.runtimepropertyinfo.setvalue(object obj, object value, object[] index) @ myapp.errorlog

java - After server spawning a new thread respond to the client -

java - After server spawning a new thread respond to the client - i developing web application multithreading. concept clients send requests server. server creates new thread execute procedure (delete foder town name). client request , server response using restful web services. here code server: @get @path("/data_availability/{town} public response data_availability( @pathparam("town") string town) throws exception{ delete_dir procedure = new delete_dir(); thread thread = new thread(procedure); thread.start(); homecoming response.ok("done").build(); // here response. since create // new thread "done" } and here code procedure: public class delete_dir implements runnable{ string town; public void run() { seek { execute(); } grab (exception e) { e.printstacktrace(); } }

Is lack of user-agent in HTTP request valid -

Is lack of user-agent in HTTP request valid - we've noticed time time http request without valid user-agent string. there valid real-world case accepting type of http request? i.e. why wouldn't auto block ip's type of request received? update intention phrase "real-world" indicate not asking technically can or can't happen. possible submit http requests without headers. wondering "real-world" case have allowing type of http request server. i guess many people utilize http requests without user-agent when using api perform request. http

javascript - YouTube API function calls not working when used in Chrome extension -

javascript - YouTube API function calls not working when used in Chrome extension - we're trying create chrome extension uses youtube api. video displays, none of api functions (seekto, getcurrenttime, etc, etc) work. console shows 'undefined not function' errors of functions. , onready isn't firing, either. here's manifest.json: { "manifest_version": 2, "name": "asyncyoutube", "description": "this extension provides improved accessbility options youtube subtitles low vision.", "version": "0.1", "permissions": [ "tabs", "<all_urls>" ], "content_security_policy": "script-src 'self' https://www.youtube.com/ https://s.ytimg.com/; object-src 'self'", "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" } }

Best method to import products, customers and Orders in Magento -

Best method to import products, customers and Orders in Magento - i working on new magento website design integration , functionality complete. before create site live need import existing site info magento site. old site has around 1000 products , not magento site. excel sheet not in format of magento excel sheet. when compare current excel , create new excel sheet magento time consuming. best , speedy method import products magento site. know please share idea. helpful. to import products & customers source. have 3 option: export info in csv compatible magento , import in magento. you can utilize 3rd party paid service info migartion if supported them. http://www.shopping-cart-migration.com. if can afford paid service best time saving solution. you can create custom script import info csv not compatible or direct external db. one product import script url follows: http://www.fontis.com.au/blog/magento/creating-magento-products-script for importing

android - which link will put in admob for non play apps -

android - which link will put in admob for non play apps - hi have created non-play apps want integrate advertisement mob's banner , interstitial ads in problem link provide when create new app in advertisement mob.i have search can't find proper solution.i have go through advertisement mob.so,how utilize advertisement mob's ads non-play apps.please help me.thanks in advance. for older version of admob, in url, add together application bundle name. for illustration bundle name com.example.abc then you'll add market://details?id=<com.example.abc> it doesn't matter if app on play store or not. mine not , worked fine. android

How to update Jenkins config.xml from Java code? -

How to update Jenkins config.xml from Java code? - i new jenkins plugin development pardon me if question silly. developing jenkins plugin provides little list of configuration options shown in attached screenshot. the form has been designed using jelly script. have update these parameters submitted form in config.xml file of job java code. can suggest way update current config.xml of job in java code? thanks after research have got know how update config file through user defined form. pfb code abstractitem item= (abstractitem) jenkins.getinstance().getitembyfullname(itemname) source streamsource = new streamsource(new stringreader(config)) item.updatebyxml(streamsource); item.save(); in jelly form has called method this <f:form method="post" name="config" action="configsubmit"> so code update has placed in method follows public void doconfigsubmit(staplerrequest req, staplerresponse rsp) throws ioexception, servlet

ios - How to disable cookies in UIWebView ? -

ios - How to disable cookies in UIWebView ? - i have searched , found ways clear cookies uiwebview , want know how clear cookies ? guidance needed. thank you. for(nshttpcookie *cookie in [[nshttpcookiestorage sharedhttpcookiestorage] cookies]) { if([[cookie domain] isequaltostring:@"owner.ford.com"] || [[cookie domain] isequaltostring:@"ford.com"]) { nslog([cookie domain]); [[nshttpcookiestorage sharedhttpcookiestorage] deletecookie:cookie]; } } [[nsuserdefaults standarduserdefaults] synchronize]; imp: sure add together lastly nsuserdefaults line. or cookies restart app. ios objective-c cookies uiwebview

netbeans - java.lang.NoClassDefFoundError: javax/persistence/Query when trying to run EE Jar from Windows CMD? -

netbeans - java.lang.NoClassDefFoundError: javax/persistence/Query when trying to run EE Jar from Windows CMD? - i wrote java client enterprise application, , works when run netbeans. please notice there query run on start of application send query entitybean. the problem when seek run jar application windows command line , error appear me: java -jar apps.jar exception in thread "main" java.lang.noclas sdeffounderror: javax/persistence/query @ apps.main.main(main.java:75) caused by: java.lang.classnotfoundexception: javax.persistence.query @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown so

Android emulator speed with nested KVM -

Android emulator speed with nested KVM - i trying run android emulator within virtual machine , utilize kvm's nested back upwards speed emulator. i run emulator emulator64-x86 -avd test -qemu -m 1024 -enable-kvm , i've made sure kvm nested back upwards available on both host , guest: cat /sys/module/kvm_intel/parameters/nested "y" still emulator slow, there i'm missing or log file can consult see if nested back upwards in fact used @ all? android-emulator kvm android-x86

mysql - Rails - Library not loaded: @@HOMEBREW_PREFIX@@/opt/openssl/lib/libssl.1.0.0.dylib (LoadError) -

mysql - Rails - Library not loaded: @@HOMEBREW_PREFIX@@/opt/openssl/lib/libssl.1.0.0.dylib (LoadError) - i fighting error occurs when run rails s: /users/adam/.rvm/gems/ruby-2.0.0-p481/gems/mysql2-0.3.16/lib/mysql2.rb:8:in `require': dlopen(/users/adam/.rvm/gems/ruby-2.0.0-p481/extensions/x86_64-darwin-13/2.0.0-static/mysql2-0.3.16/mysql2/mysql2.bundle, 9): library not loaded: @@homebrew_prefix@@/opt/openssl/lib/libssl.1.0.0.dylib (loaderror) referenced from: /usr/lib/libmysqlclient.18.dylib reason: image not found - /users/adam/.rvm/gems/ruby-2.0.0-p481/extensions/x86_64-darwin-13/2.0.0-static/mysql2-0.3.16/mysql2/mysql2.bundle mysql installed through brew. unfortunately not sure how prepare issue, appreciate every help. thank you i having same issue on rbenv setup after updating few things in homebrew. recompiled ruby , problem went away. in case looks might want recompile gems well. according this so can run rvm reinstall 2.0.0-p481 (recompiles ruby ,

html - Centering an image with varying width wider than parent container -

html - Centering an image with varying width wider than parent container - i'm trying build blog middle column of text, images centered on page. i'd text 600px wide, images can 1024px wide , i'd them centered on page. my weird constraint i'm using shopify platform , code gets generated (i.e. img within p tag) <div class="container"> <p>hello 123, blog post..</p> <p><img src="//cdn.shopify.com/s/files/1/0296/9253/files/img_6009_1024x1024.jpg?14454" /></p> <p>this text</p> </div> so how write code allows images hang outside p tags when don't know images width? write jqeury solution ideally i'd write css solution... thanks! there many ways centre elements: margin way: with set width or display: inline-block; can use: margin-left: auto; margin-right: auto; text-align way: with set width or display: inline-block; can add together paren

javascript - Changing URL in internet explorer 8 -

javascript - Changing URL in internet explorer 8 - i need alter url in ie8 without reloading page. there method window.history.pushstate, method not work in ie8 works in other version. is there method alter url in ie8 without reloading page. according caniuse.com, ie8 supports using hashchange event. event allows to trigger function when part after hash in url changed, running when url changed. alter in hash of url not refresh page. window.onhashchange = function() { if(location.hash == "#foo") { alert('bar'); } } more info on hashchange event can found @ mdn. javascript internet-explorer-8

visual c++ - Match VS2013 C++ struct packing to old MSVC++ compiler version? -

visual c++ - Match VS2013 C++ struct packing to old MSVC++ compiler version? - i trying wrap unmanaged c++ library (compiled using msvc++ compiler version 13, dating 2002 or 2003) in cli c++ console application (using visual studio 2013), in order phone call c# project. i have managed wrapper building , running, results when runs suspect vs2013's c++ compiler packing stucts differently how unmanaged library reading them. is there way tell vs2013 bundle structs in same way version 13 compiler would? or have find old comipler , write intermediate wrapper exposes basic, unpacked types? c++ visual-c++ visual-c++-2013

PHP - Posting video on Facebook through Graph API using a valid access token -

PHP - Posting video on Facebook through Graph API using a valid access token - i have video exist on server, need post video on facebook using graph api. here code suggested team facebook. what doing below. 1) android device getting access token 2) recognizing user passing access token facebook , email id , through email id recognize user 3) posting user's video server facebook through graph api. 4) returning video id android device api response. i approaching route because in android device 2 step process post video on facebook. 1) download video first 2) post facebook this time consuming. here code trying define("fb_web_app_id","********"); define("fb_web_secret","********"); define("fb_web_redirect_uri","<< redirect url >>"); $globals["all_user_dir_path"]="/var/www/proj/web/video/user_videos/"; define("fb_web_scope","user_f

javascript - What is theForm.onsubmit()? -

javascript - What is theForm.onsubmit()? - can explain function me. !theform.onsubmit() , theform.onsubmit() != false mean? //<![cdata[ var theform = document.forms['form']; if (!theform) { theform = document.form; } function __dopostback(eventtarget, eventargument) { if (!theform.onsubmit || (theform.onsubmit() != false)) { theform.__eventtarget.value = eventtarget; theform.__eventargument.value = eventargument; theform.submit(); } } //]]> and when checked console got this; !theform.onsubmit true theform.onsubmit null !null true what meaning of theform.onsubmit , how can null , !null true? and when checked theform.onsubmit() != false got: theform.onsubmit() typeerror: object not function theform.onsubmit() != false typeerror: object not function what difference way between theform.onsubmit , theform.onsubmit() ? theform.onsubmit event handler submit event. if null , no handler has been set. when

javascript - How to access the HTML document being generated dynamically inside an iframe, from remote server? -

javascript - How to access the HTML document being generated dynamically inside an iframe, from remote server? - i'm creating web application display reports beingness fetched tableau server. utilize tableausoftware.viz() function reports , display them. i'm using tableau_v8.js file. an iframe generated dynamically using tableau_v8.js file. iframe contains html document uses dojo framework create ui components on html page. on click of button on ui generated within iframe , new html div tags gets added dynamically. i think these div tags beingness added because of script or functions beingness called on in javascript (i.e. tableau_v8.js) file or because of request beingness posted on tableau server , don't have clear understanding on how these elements beingness generated. how find way understand dynamic creation of html document other html components within iframe ? how should go issue? javascript html iframe

email - Automatic Mail Sending on specific Dates in PHP -

email - Automatic Mail Sending on specific Dates in PHP - i having mail service ids in database. have send mail service mail ids automatically on specific dates have mentioned in database.how in php. it depends on server type. if utilize linux can utilize cronjobs programme execution of specific php file @ time. if hosted, host may offer cronjob menu in cpanel, else have improve hosting plan offer that. or @ to the lowest degree access crontab file programme different cronjobs. executing php script cron job php email

directx - Is it possible to get the interface name (Dynamic Shader Linkage)? -

directx - Is it possible to get the interface name (Dynamic Shader Linkage)? - i working on implementing dynamic shader linkage shader reflection code. works quite nicely, create code dynamic possible automate process of getting offset dynamiclinkagearray. microsoft suggests in sample: g_inumpsinterfaces = preflector->getnuminterfaceslots(); g_dynamiclinkagearray = (id3d11classinstance**) malloc( sizeof(id3d11classinstance*) * g_inumpsinterfaces ); if ( !g_dynamiclinkagearray ) homecoming e_fail; id3d11shaderreflectionvariable* pambientlightingvar = preflector->getvariablebyname("g_abstractambientlighting"); g_iambientlightingoffset = pambientlightingvar->getinterfaceslot(0); i without giving exact name, when shader changes not have manually alter code. accomplish need name marked below through shader reflection. possible? searched through references of shader-reflection did not find useful, besides number of interface slots ( getnuminterfaceslots

android - Multiline button breaks width calculation of Dialog -

android - Multiline button breaks width calculation of Dialog - i have ugly error in app , have no thought how prepare it. see @ first 2 screenshots: as might can see there 1 button big text wraps (that text cutting not matter here). guess text causes calculations bug in linearlayout: in 1 of measure steps width cumulated, width bigger aviable space, take hole width instead of using aviable width , split on elements. here xml: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <textview android:layout_width="match_parent" android:layout_height="@dimen/list_item_height" android:textsize="18sp" android:gravity="center_vertical" android:text="test 1" androi

cuda - Appropriate usage of cudaGetSymbolAddress and cudaMemcpyToSymbol with global memory? -

cuda - Appropriate usage of cudaGetSymbolAddress and cudaMemcpyToSymbol with global memory? - i new cuda , familiar normal usage of cudamalloc , cudamemcpy , cudamemcpytosymbol copying constant memory. however, have been given code makes frequent utilize of cudagetsymboladdress , cudamemcpytosymbol re-create global memory , i'm not sure why have chosen instead of cudamalloc / cudamemcpy . would able explain when advantageous , appropriate utilize cudagetsymboladdress , cudamemcpytosymbol ? thank you! when global memory allocated dynamically using cudamalloc , right copying api utilize cudamemcpy . when global memory allocated statically: __device__ int my_data[dsize]; then right api utilize cudamemcpytosymbol or cudamemcpyfromsymbol cuda

php - How to connect Android app to mySQL *SPECIFICALLY* -

php - How to connect Android app to mySQL *SPECIFICALLY* - after @ to the lowest degree 10 hours of pouring on online resources, videos, , tutorials, have 2 questions connecting android app mysql database. saving files 1) tutorials save php files in c/wamp/www/hello_php - example, , when go localhost/hello_php works. --where store php files if don't want utilize localhost? i.e want utilize mysql's ip address. --for example, guy this video uses this: httppost httppost = new httppost("http://192.168.168.0.3/~tahseen@amin/php/getallcustomers.php"); --i presume 192.168... ip of server. did save "getallcustomers.php" file? --note, using phpmyadmin handle database. existing jdbc code 2) have created code required insert/update/delete elements db. have done in java using jdbc in eclipse. understanding connecting android app db jdbc not ideal / unsafe / not recommended. --is code wrote useless? i.e have convert php code? thanks in advance h