Posts

Showing posts from March, 2014

javascript - Refreshing KendoUI Grid - pager broken -

i have created simple kendo ui grid paging. want refresh grid new data. im using setdatasource attach new data grid , refresh refresh grid. works fine except pager stops working. give me no-items-in-the-grid message. i created jsfiddle demonstrate mean: http://jsfiddle.net/dxgyu/ and here code use refresh grid: var grid = $("#grid").data("kendogrid"); var ds = setds(); grid.setdatasource(ds); grid.refresh(); in example wont changing data doesn't matter. if click button not refresh pager correct way , have no clue how pager update too. can me! it's small can't find anywhere how access grid pager. thanks in advance. the grid's .setdatasource() function expects actual kendo.data.datasource not object. change .setds() function return datasource: function setds() { return new kendo.data.datasource({ ... }); }

asp.net - Can you please tell me why I am getting `The GridView 'GridView1' fired event RowUpdating which wasn't handled.` error message -

i have been able work through initial problem of not being able insert records consistently new error message crops up. now, getting the gridview 'gridview1' fired event rowupdating wasn't handled. this error occurs when click update button update row of record. first, click edit button. exposes update/cancel buttons. when click update button, aforementioned error. my first take gridview needed onrowupdating after adding (see markup code), still getting same error. this bit frustrating. here code. protected sub gridview1_rowupdating(byval sender object, byval e gridviewupdateeventargs) dim dd dropdownlist = directcast(gridview1.rows(e.rowindex).findcontrol("ddlstatus"), dropdownlist) e.newvalues("status") = dd.selecteditem.text end sub markup: <asp:gridview id="gridview1" runat="server" datasourceid="sqldatasource1" autogeneratecolumns="false" datakeynames="reqnu

android - declaring mime type for a "custom file" that is to be sent via bluetooth -

i need in solving issue: i developing application transfer file application other phone using blue-tooth. when wanted transfer image file, part of code went follows: intent.settype("image/*"); i.putextra(i.extra_stream, uri); //here uri has uri of image want send. and android manifest file went follows: <intent-filter> <action android:name="android.intent.action.main" <category android:name="android.intent.category.launcher" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="file" /> <data android:mimetype="image/*" /> <data android:host="*" /> </intent-filter> and code worked fine. question : want send file created following line: f = file.createtempfile("card", ".xcard", getexternalcachedir()); the name of file this: card124342

c# - What is wrong with this JQuery AJAX code -

i facing problem ajax code. using mvc3 our project. requirement bind dropdown value using ajax when page load. happens when loading page, ajax request send controller , return ajax function , binds exact values in dropdown. (when page refreshed or first time load) not binding retrieved value. rather showing default value. pls see code , suggest me doing wrong. edit: tried use async property false. not @ send controller action method getting data. code $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: '@url.action("getuser", "invoices")', data: "{'id':" + json.stringify(currval) + "}", datatype: "json", async: true, success: function (data) { $("#user-" + curr).select2("data", { id: data.value, name: data.text }); $(this).val(data.v

mysql - Count the no of id if it is not present in another table based on condition using sql -

i have table consists of repid , date. table: 1 repid date 108981 2013-04-09 00:00:00.000 108981 2013-04-09 00:00:00.000 108982 2013-04-10 00:00:00.000 108982 2013-04-11 00:00:00.000 108983 2013-04-11 00:00:00.000 108983 2013-04-11 00:00:00.000 i have table consists of repid , logtime. table: 2 repid logtime 108981 2013-04-09 00:00:00.000 108981 2013-04-09 00:00:00.000 108982 2013-04-11 00:00:00.000 108983 2013-04-11 00:00:00.000 108983 2013-04-11 00:00:00.000 108984 2013-04-10 00:00:00.000 i want count of repid table 1, when logtime not exist rep table 2. in case need output as repid repcount 108982 1 as date '2013-04-10 00:00:00.000' not exists in table 2 repid - 108982. i have used query as select t1.repid, count(t1.repid) 'rep count' table1 t1 not exists (select t2.repid table2 t2 convert(date, t2.logtime) between '2013-04-08 00:00:00.000' , '2013-04-11 00:00:00.000') group

ruby on rails - Difference between flash.now and @instance_var -

i'm wondering difference between using flash.now , using instance variable (e.g. @error_message )? on related note, how flash work when have multiple servers running, , there's probability subsequent request executed different server? i'm wondering difference between using flash.now , using instance variable (e.g. @error_message)? effectively not difference since both values gone after request completes. think it's more of convenience view code can check 1 place error messages instead of having check both flash , instance variable. on related note, how flash work when have multiple servers running, , there's probability subsequent request executed different server? the flash lives in session, typically persisted database. if have multiple instances of rails app running , using same database, have shared access flash object. it's therefore not problem @ if server writes flash object , server b reads out on next request.

xtext - Including a grammar into another grammar -

i reuse grammar definitions. i have grammar this: person: 'contact' name=id '{' 'phone' phone=int '}' ; i have grammar this: include "uri/to/other/project/to/other/grammar/definitions" call: 'call' person=person ; person not known second grammar. xtext therefore able insert or include person definition first grammar second grammar? a further step generation of person . know how accomplish too. i found solution. can use keyword "with" used include terminals. the necessary steps: create xtext project com.mydsl.a (a) , com.mydsl.b (b) write grammar a add dependency in meta-inf/manifest of b add a.ui dependency in meta-inf/manifest of b.ui add registration of a's genmodel in b's workflow that: in standalonesetup: registergenmodelfile = "platform:/resource/a/src-gen/path/to/a.genmodel" change first line of b grammar b a you can use eclasses of while writing grammar

c# - Release file from RichtextBox LoadFile Method -

so, load file @ start of form. have "save button" in form.when click it, want overwrite file richtextbox.savefile method. "access path.. denied" i checked , got this: permissions current user granted the debug folder has "read-only" -- tried remove, come now, think program doesn't release resource(the file) when close form is there method force this? (i think file remains loaded ram memory) one more thing: must use savefile , loadfile methods. working rtf files , code in such way methods best job. public editarearticol(string path,list<capitol>chapters,object[,]lca) { this.richtextboxex1.loadfile(path, richtextboxstreamtype.richtext); } private void savetoolstripbutton_click(object sender, eventargs e) { richtextboxex1.savefile("articles\\" + textbox1.text + ".dat", richtextboxstreamtype.richtext); file.

html - How can I use a PHP variable inside an iframe? -

i'm having problem i'm trying use $test variable inside iframe in src section , each time try fail , black border shows up. here code: <?php $url = 'http://www.youtube.com/watch?v=9t5itwlwydg/'; $parts = explode('=', $url); $url2 = $parts[1]; $url3 = trim($url2,"?\/"); echo $url3; $youtube = 'http://www.youtube.com/v/'; $video = $url3; $vars = '&loop=1&autoplay=1'; $test = ($youtube . $video . $vars); echo $test; ?> <br> <iframe width="420" height="345" src="<? $test ?>"> </iframe> you must use echo like: src="<? echo $test ?>"> or src="<?=$test ?>">

SQL Count of columns result for all existing Dates in the table -

i have table dttransaction , dthoteltransaction transactionid primary key in former , foreign key in later. columns in dttransaction :machinename(varchar),bookedon(datetime),transactionid(int) columns in dthoteltransaction :hcomcid(int) ,transactionid requirement : for every bookedon value in dttransaction , want machine name , count of machinename these (415428,415429,415430,415431,415432) hcomcid. i trying : select dttransaction.machinename,count(dttransaction.machinename) dttransaction join dthotelreservation on dttransaction.transactionid = dthotelreservation.transactionid , dthotelreservation.hcomcid in ( 415428, 415429, 415430, 415431, 415432) convert(varchar(10),bookedon,101)='04/10/2013' group dttransaction.machinename but give particular date.i want count existing bookedon values. thanks in advance. if want sum of dates, remove where clause: select dttransaction.machinename, count(dttransaction.machinename) dttransaction join

3dsmax - Pass a specific point on a model to the engine -

i sorry if ask trivial question, have no idea how begin searching answer in search engine. i understand how create model in 3ds max , load xna (for instance) program, need able pick point on model in 3ds max app , able trace it's world space position in xna app @ given point time. why? need trace player gun's muzzle create muzzleflash effect in right spot when player fires. i appreciate help, thanks. well in xna problem solved quite copying bone transforms of point. 1 needs set point modelmesh in 3d creation tool. e. g. in 3ds max setting separate element of scene. in engine can access modelmesh .name propery , it's position doing model.copyabsolutebonetransformsto(). there few more steps do, if search copyabsolutebonetransformsto find need. here stack overfrol article helped me: position of modelmesh in xna

android - Null Ponter Exception while using Monkeytalk tool -

hello have implemented monkeytalk library in app used following steps given @ https://www.gorillalogic.com/monkeytalk-documentation/monkeytalk-getting-started/install-agent/android . through these steps able record , playback steps in monkey talk ide. now issue when use app after installing library crashes randomly @ several places giving nullpointerexception . log of 1 such incident given below: 05-08 19:29:13.661: e/androidruntime(27158): fatal exception: thread-4790 05-08 19:29:13.661: e/androidruntime(27158): java.lang.nullpointerexception 05-08 19:29:13.661: e/androidruntime(27158): @ com.gorillalogic.fonemonkey.activitymanager$2.run(activitymanager.java:112) 05-08 19:29:13.661: e/androidruntime(27158): @ java.lang.thread.run(thread.java:856) any resolve issue appreciated. i using eclipse juno , target sdk 4.2 development. i got same error when tried invoke application (which not have monkey talk agent) our application integrated monkey talk agent. hav

r - Create unique ID based on existing ID conditions -

i column of unique document ids, ids contain q or a: "702-591|source-871987", "702-591|source-872066", "702-591|source-872336", "702-591|source-872557", "702-591|source-873368", "702-591|source-876216", "702-591|source-907269", "702-591|source-10754a", "702-591|source-10754q", "702-591|source-118603a", "702-591|source-118603q", "702-591|source-119738a" i want create simpler unique id column (easy enough -- table$id <- c(1:nrow(table)) ). if existing column contains q or a, want q/a incorporated new id field. additionally, if 2 ids linked q/a, want new ids show 1q or 1a. example, records 8 & 9 are: "702-591|source-10754a", "702-591|source-10754q" . new ids 8a & 8q, respectively. records 1 -5 have new ids of 1-5. need incorporating grep command here? thanks! this may little long, think works. you'll have install

Android SDK: Button becomes colored when changing the background color on LinearLayout -

i have linearlayout in android app creating contains default button gradient gray color. linearlayout white when try change background color yellow button becomes yellow don't want happen. tried use color image set background color on linearlayout same thing happens. how solve problem? here code: <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="horizontal" android:background="@color/yellow"> <button android:id="@+id/buttoncart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button"/> </linearlayout> solved: wait, works now. while buttons become colored , transparent in layout view in eclipse buttons unaffected when run app on phone. thought display same result when app runned. str

azure - Service bus QueueClient returns null brokered message even queue has thousands of messages -

i using service bus queue pass items producer consumer. producer able send items queue , consumer receiving correctly showing weird behavior receive method returns null (with no error) brokered message if queue has thousands of message. wrong queue? one thing mention here in testing called close() method on queue. done once , while testing. every time run receive methods return null brokered message. the messagecount can include messages sub-queues such dead-lettered , scheduled messages. if messages have expired have create receiver dead-lettered subqueue them.

how to use wordpress "Post Views Count" plugin? -

http://wordpress.org/extend/plugins/baw-post-views-count/screenshots/ i'm installed , active "post views count" plugin when i'm use shortcode [post_view] this, it's doesn't woek.... <li><em>[most_view]</em></li> or: <li><em><?php [most_view] ?></em></li> [most_view] short code , must place in post content if want put post counts in template use this: <?php bawpvc_views_sc(); ?>

Batch import through the REST API for neo4j -

i using neo4j's rest api batch importing. as per docs ( http://docs.neo4j.org/chunked/stable/rest-api-batch-ops.html ) this service transactional. if of operations performed fails (returns non-2xx http status code), transaction rolled , changes undone. i imporitng 60k nodes , 200k relationships. (at least) 1 of relationships fails , expected whole operation fails. my question is, there way track specific line of import failing can isolate or remove it? update: per @thomas fenzi's answer below, turned on x-stream flag, moving @ snails pace. (about 1/5 th speed). have other suggestions? if use api in streaming mode (chapter 18.15.3. in docs, send x-stream = true header , whatever need client side handle chunked responses) responses point of error. 60k nodes , 200k relationships might bit high single transaction, depending on hardware.

c# - Submit button is not working in asp.net mvc -

i have model: public class formcreatemodel { public formmodel forminfo { get; set; } public fieldmodel fieldinfo { get; set; } public institutionmodel selectedinst { get; set; } public formtypemodel selectedformtype { get; set; } public categorymodel categoryinfo { get; set; } public list<institutionmodel> institutions { get; set; } public list<formtypemodel> formtypes { get; set; } } and i've created typed view model: @using (html.beginform()) { <p> @html.labelfor(lbl =>lbl.selectedinst.institution_name, "institution name :", new { @class="lblname"}) @html.dropdownlistfor(drpdown => drpdown.selectedinst.institution_name, new selectlist(model.institutions.select(inst => inst.institution_name)),"-- select institution--", new { @class ="txtformtext"}) </p> <p> @html.labelfor(

c# - Error building Setup -

i building setup in vs2008 c#. when build clicked warning: unable copy schema file '(null)' message . i have vs2008 + vs 2010 installed. both working fine. reason happening today in vs2008. did check registry permissions ? hkey_local_machine\software\microsoft\visualstudio\9.0\deployment\schema

searching for the whole list of derived classes of a base class in a big C++ project -

Image
i working on huge c++ project. using netbeans edit it, compilation takes place on linux server. have problem of getting whole list of derived classes inherit base class. there protected variable in base class , want takle in derived classes inherit it, how know inheriting it? i have launched search on root of project directory " : public base_class " haven't found anything! is way correct derived classes? i have searched issue in forum haven't find relevant. any or hint highly appreciated. use doxygen graphviz support generate hierachy graph diagram you. the procedure simple: install graphviz. install doxygen. use doxywizard configure desired outputs you. here screenshot of doxygen diagrams tab have clue on how's interface. and finally, here link output example you.

html - How to make Flash autoplay using <embed> tag? -

when use <embed> tags this: <embed src="flashfile.swf" autostart="true"></embed> it may not autoplay. but if user other fromat this: <embed src="flashfile.wmv" autostart="true"></embed> it work well. why? i don't believe autostart attribute flash object interprets. embed tag doesn't have specification how object being embedded handles attributes or parameters passed, it's discretion of vendor creating object. so, essentially, wmv embed listens attribute called autostart, , swf not. flash embeds automatically start, if there's actionscript stops animation or whatever else happening, there's not can do. if swf object has external interface enabled, can interact object javascript. other that, there's nothing else can do. i hope provides insight!

Stress Testing for Mysql via php -

i want check mysql connection limit php. inserted mysql_connect inside loop mysql_pconnect doesnot increase number of connections on mysql.... came know php doesnot support multi-threading so how can it, optimizing mysql.ini file max-connection , want make sure stress testing the fourth parameter mysql_connect $new_link. by default, mysql_connect not create new link if given same arguments within same request, happening you. override behaviour setting $new_link true. http://php.net/manual/en/function.mysql-connect.php do not use mysql_ functions: the mysql extension deprecated , removed in future. use mysqli or pdo. edit: added mysql_ warning

Magento - can't save changed customer GroupId with observer for newsletter_subscriber_save_before event -

i built observer newsletter_subscriber_save_before event; gets fired when customer subscribes/unsubscribes newsletters. need change customers groupid accordingly. seems can change groupid, can't manage save it. if call in code $customer->save() - method, run infinite loop; same occurs if try hook newsletter_subscriber_save_after event. anyone can me? appreciated! here's code in observer.php : public function newsletter_subscriber_change($observer) { try { // status of subscriber $subscriber = $observer->getevent()->getsubscriber(); $status = $subscriber->getstatus(); $email = $subscriber->getemail(); $customer = mage::getsingleton('customer/customer'); $customer->setwebsiteid(mage::app()->getwebsite()->getid()); $customer->loadbyemail($email); // here change groupid $customer->setdata( 'group_id', 9 ); // if check group here, change applied

C#, How to hande SSH timeout Exception with SharpSSH -

i trying connect remote server using sharp ssh. timeout exception receive network based exception. want program more robust if network has problems, or if server isn't available. time out occurs @ open command , throws io timeout exception. i hoping solve intermittent problem end. mysqlconnectionstring = string.format( "server={0};user={1};database=mta;port=3306;password={2}", sqlhost, mysqluser, mysqlpass); se = new sshexec(host, user, pass); msc = new mysqlconnection(mysqlconnectionstring); // connect server , list of // firmware versions , serial numbers available se.connect(); lblconnected.text = (se.connected) ? "connected" : "not connected"; msc.open(); //exception happens here my question: there way can tell c# application try connect command again should encounter exception? try using try catch block: mysqlconnectionstring = string.format("server={0};user={1};database=mta;port=3306;pass

html - Javascript error addFiles() is not a function -

so when click addfiles button error in firebug says "typeerror: addfiles not function." this doesn't make sense me because if go firebug , @ script addfiles() function there. code looks like: <input id="addfiles" type="button" name="addfiles" value="add files" onclick="addfiles();"> <script type="text/javascript"> function addfiles() { } </script> edit: <form id="eventform" onsubmit="eventinfo();"> <table id="hornevent" class="horntable"> <tr> <td colspan="5" style="text-align:right"> <input id="addfiles" type="button" name="addfiles" value="add files" onclick="addfiles();"> <input id="close" type="submit" name="close" value="close"> <

computer vision - Exact measurement of translation and rotation of marker objects using OpenCV/EmguCV -

i measure displacement of object between 2 images. displacement can in image plane. result should give displacement, if possible in sub pixel accuracy. there assumptions, should make easier, didn't me far: the camara objective virtualy distortion free (telecentric) , oriented perpendicular object plane the object plane never changes the flat marker object (could known image, e.g. play card) in object plane, isn't scaled or warped -> rotational , translational changing. my first approach take feature recognition example emgucv, find first object in first image, take relevant piece of picture, use template , search in second image. did work, little unsatisfactory. there scaling , warpping in homography matrix (probably because of points, assigned wrong) , placing accuracy quite bad. i tried once demo of commercial image processing software halcon , worked charm in sub pixel accuracy. there can sort of least square fit of template image searching object in. resu

css - Creating a hover div that matches the height and width of base div -

so have base div , hover div (will display:block in js on mouseover). anyways i'm having hardest time making height , width of hover div match height , width of base div. i think problem because of responsive code, in base div image on background image , width , height set 95% create border effect. #user-options li img.role-photo { width: 95%; height: 95%; padding-top: 5px; } i've uploaded work test link here . as can see, on 2nd "card" have hover div showing. opaque white box 'sign in facebook' button suppose cover image of singer below. can't seem working right :( here jsfiddle http://jsfiddle.net/leongaban/pwvbp/ html current page: <ul id="user-options"> <li> <img class="role-photo" src="../images/registration_fan_tile.png" alt="fan"/> <h3>fan</h3> <p>calling tastemakers! influence hollywood, don't consume it. lorem ipsum dolor

database - MYSQL doesn't check for Foreign key exsistence -

i facing strange problem here. table 1: create table degree (degree_id varchar(6) primary key , degree_name varchar(32) unique key , degree_abbr varchar(3)); table 2: create table course (course_id varchar(6) primary key , degree_id varchar(6) not null, course_name varchar(40) not null , foreign key (degree_id) references degree (degree_id)); now far understand sql , cannot insert value in course table if value of field degree_id doesn't exist in degree table. but if try insert insert course values('cor_001' , 'blah' , 'course name' ); this query runs , though 'blah' not valid degree_id. you're using myisam tables, not support foreign keys. fk directives parsed , accepted, ignored. you need use innodb tables proper fk support: create table (...) engine=innodb; ^^^^^^^^^^^^^^ if show create table your_table , you'll see engine type being used @ end of output.

How can I retrive To Receipt from Email Entity in CRM 2011 -

hi have email , retrive information of email entity using below code email email = _context.emailset.where(p => p.activityid == new guid("448ff815-17b7-e211-9fdb-b4b52f67d694")).firstordefault(); now have attribute of email entity how can receipt email. you can see in this article microsoft properties email entity has. 1 property to of type activityparty.

html - Can I "freeze" an element inside a scrollable DIV with just CSS (or something that looks good on mobile)? -

i'm going guess answer question "no," nice, i'm going ask anyways. what i'm trying freeze element inside scrollable div such stays in place vertically. implement frozen row feature in table. it's pretty easy javascript , absolute positioning. here's html container , 3 inner divs (see here live version): <div id="container"> <div id="background"> content </div> <div id="absolutediv"> absolute stays inside </div> <div id="fixeddiv"> fixed escapes! </div> <div id="absolutediv2"> stays put! </div> </div> the relevant css: #container { position: fixed; left: 20px; width: 250px; height: 250px; top: 20px; overflow: scroll; } #absolutediv { position: absolute; top: 30px; width: 300px; background-color: #cec; } #fixeddiv { position: fixed; top: 100px; width: 300px; background-color

c# - Overly Broad Directory.EnumerateFiles() vs Multiple File.Exists()? -

i updating program which, among other things, checks existence of files within given path. files located in 1 of many subdirectories off of main path. previously, searching entire path files matched given pattern, part of update have separate array containing list of files expect have. given presence of array, there 2 options considering: use same call directory.enumeratefiles(startingpath, pattern, searchoption.alldirectories) , check results against array (perhaps through lambda). use multiple calls file.exists() each member of array. in average case, talking 3 or fewer files in array given call. in high-end case, still talking less dozen. executions involve hundreds or thousands of calls. this program resource hog, want go efficient method here. more efficient? there better way? changing datastructure filenames array type possible if lead improvements. i go second method, bunch of calls file.exists , , in parallelized fashion. there low throughput cost high

ios - App Name in Appstore is different than on your mobile device -

Image
i submit app app store. see in following screenshots, once open app store, find lengthy name of app. once download app, short name shown only. how possible? the name under app icon on device bundle display name. by default, bundle display name same bundle name, can set in xcode selecting info.plist file , setting in editor. the bundle display name not have match bundle name or application title set in itunes connect, however, must similar application title set in store or apple reject app. the app store guidelines : 3.4 app names in itunes connect , displayed on device should similar, not cause confusion documentation on bundles .

xml - insert/ignore a missing namespace in LXML -

i have parse malformed xml: >>> lxml import etree >>> root = etree.fromstring(xml_string) xmlsyntaxerror: namespace prefix xlink href on email not defined, line 3, column 2446 xlink indeed missing among declarations. is there easy, recommended way tell lxml ignore missing namespaces, or use supplied one? right now, manually modify xml_string inject namespace before parsing, works ugly , not general enough. there no way tell lxml insert missing namespace declaration. 1 might imagine etree.register_namespace("xlink", "http://www.w3.org/1999/xlink") could help, has no effect. even if "ugly", think you'll have continue inject namespace before parsing xml document (perhaps can automate if haven't already). it is possible make lxml accept malformed input using parser object initialized recover=true . example: import lxml.etree etree input = """\ <root> <x:a>abc</x:a>

ruby on rails - converting to devise - capybara::ElementNotFound: -

i in process of converting user authentication scratch devise gem. completed , appears working fine. changed rspec tests over, have 1 recurring problem have searched find solution to. the error 2) authenticationpages authorization non-signed-in users when attempting visit protected page after signing in should render desired protected page failure/error: fill_in :email, with: user.email capybara::elementnotfound: cannot fill in, no text field, text area or password field id, name, or label 'email' found # (eval):2:in `fill_in' # ./spec/requests/authentication_pages_spec.rb:53:in `block (5 levels) in <top (required)>' the test describe "for non-signed-in users" let(:user) { factorygirl.create(:user)} describe "when attempting visit protected page" before visit edit_user_registration_path(user) fill_in "email", with: user.email

How to check a checkbox of form 1 from another form in vb.net? -

i have 2 forms, form 1 , form 2 (windows application). how can access , check checkbox in form 1 form 2. tried calling form name , control form1.chkcanada.checked = true , did not work. , added property in form 1 public property abc boolean return chkcanadianstmtind.checked end set(value boolean) chkcanadianstmtind.checked = value end set end property and in form 2 dim frm new frm1 frm.abc = true 'checked and still doesnt work. missing here? alternatively can pass handle of form1 form2 constructor form1: public class form1 private sub button1_click(sender system.object, e system.eventargs) handles button1.click dim _form2 new form2(me) _form2.show() end sub end class form2: public class form2 public sub new(byval _form1 form1) ' call required designer. initializecomponent() ' add initialization after initializecomponent() call. _form1.checkbox1.checked = true end sub end cl

database - Adding index :unique to a column in ruby on rails via generate migration -

i know can touch migration , add add_index :table_name, :column_name, :unique => true but how right rails migration command generate this? rails g migration add_index_to_column_name :column_name, :unique => true is right? in special example have table customers t.integer :customerid t.string :surname t.string :first_name t.string :phone an want set customerid unique. tried rails g migration addindextocustomers :customerid, :unique => true but if migration file after this, dont right see this: def change add_column :customers, :, :customerid, add_column :customers, :, :unique add_column :customers, :=, :string end any idea or suggestion? starting rails 3.2 able use: rails g migration add_index_to_table_name column_name:uniq example http://guides.rubyonrails.org/3_2_release_notes.html rails g scaffold post title:string:index author:uniq price:decimal{7,2} upd i'm sorry. default type if don't pass string

html5 - Div structure with responsive design -

i´m trying float 3 divs in different order in responsive design. in mobile version correlative (div 1, div 2, div 3) in desktop version want place div 3 near div 1 , div 2 @ bottom of them. i´m triying float, clears , dont know how fix it. share mockup. can me anyone? thanks mockup http://s2.subirimagenes.com/imagen/previo/thump_8425505positiondiv.png this html structure: <div id="fondo-web"> <div id="main"> <section id="main-container" name="div1"> random image </section> <section id="cadiz-a-caballo" name="div2"> copy text </section> <section id="frm-container" name="div3"> contact form </section> </div> </div> in example, 1 attempt: #main-container{ width:33%; background-color:#856; float:left; } #cadiz-a-caballo{ width:33%; background-color:#376

excel - Adding to an array in VBA with strings as the index -

not sure i've labelled correctly. i have bunch of cells containing strings of data. each cell consists of this: q1 = 1 | q2 = 3.2 | q3 = 5.6 q1 = 1.8 | q3 = 2.1 | q5 = 1.4 *note: delimiter litteral, text in single cell, pipe char. i want loop through each cell, explode (to use php term) pipe (|) delimiter, , again = sign. i want create array each possible value left of equal sign, , add value found right array (not add in sum, add in append array). visually, think array should this: vars[ q1 [ 1,1.8 ], q2 [ 3.2 ], q3 [ 5.6,2.1]....] end goal being i'd average, mean , median each of q1, q2 , q3. is doable in vb? i'm more familiar php, keep in excel. thanks. this handle arbitrary number of "keys" (q1,q2, etc) sub tester() 'needs reference microsoft scripting runtime dim d new scripting.dictionary dim c range dim arrp, arre dim q, v, tmpv, tmpp, tmparr, ub dim long, n long dim k each c in selection.cells tmpv

How to emulate cellular to wifi (or vice versa) switch on android emulator -

i developing module downloads off internet. using asynctask download , tracking download process via flag iscomplete . requirement whenever application switches network cellular wifi or vice versa, should restart download. haev implemented via broadcast receiver listens intent android.net.conn.connectivity_changed , starts redownloading. @override onreceive(...){ if(!iscomplete){ reload(); } } i want test tis on simulator many reasons such dont have device has cellurla connection , debugging easy on emulator. is there way can test network switch or fire android.net.conn.connectivity_change outside app? please advice! adb shell broadcast -a intent_name -c intent_category -n package_name/class_name this send intent. i've used emulate boot completed in past make sure services started on boot. i'm not sure parts optional though (i think package/class name are).

bootstrap carousel strange behaviour with first slide being blank and 2 clicks to activate nav -

i using bootstrap demo there website. but when using mark up, blank slide appears first. there mark taken source , cannot find wrong it. put source fiddle , same thing happens. how can happening why mark identical demo. please see fiddle experience problem. http://jsfiddle.net/avbuy/3/ this mark up... <div id="mycarousel" class="carousel slide"> <div class="carousel-inner"> <div class="item" style="background-image: url('riders-carousel-011.jpg');"> <img src="wp/wp-content/themes/riders-experience/images/x.gif" alt="" /> <div class="container"> <div class="carousel-caption"> <h1>riders health</h1> <p class="lead">riders experience africa more holiday&#8230; unique chance see work of riders health , learn how motorcyc

Forcing Ada to use minimum spec size for enumerated types with gnat 4.4 -

i have enumerated type needs 4 bits when declare variable of type compiler assigns variable 8 bits. below simplified version of code. subtype ab_range_index word range 0..3; type ab_buffer_type array(ab_range_index) of bit; type buffer record ... var1 : some_buffer_type; orig_ab_var : ab_buffer_type; ... end record; buffer use record ... var1 @ 16 range 0..5; orig_ab_var @ 16 range 6..9; ... end record; ... type ab_type (a,b); ab_type use (a => 0, b => 5); ab_type'size use 4; ... procedure proc(ab_buff : ab_buffer_type) ab_var : ab_type; -- ab_var'size returns 8 in debugger. ab_var use @ ab_buff'address; begin data_valid = ab_var'valid; -- returns false since variable -- contains bits ... this worked under previous gnat versions not under gnat 4.4.6. understand gnat in compliance ada spec. is there way force compiler make ab_var in ab

MS Access report with data from two tables -

i have clients table , booking table. want generate invoice info 1 client, , 1 booking. i'd clientid , bookingid supplied parameters form... think can manage that. what i'm stuck on using report wizard make invoice. in wizard choose columns clients , booking. tell group client (kinda unnecessary because there 1 client on report @ time). in wizard, previews ok, final report comes out client , booking info in 1 wide row. what i'd separate client , booking info, "header" of report shows client name, address, etc, , booking info shown separately below. how can "break off" booking columns , move them further down page? if you've created report group on [client] can can put client-specific fields in group header (which should called "client header") , have booking fields in detail band of report.

jquery - Trigger a custom event on a dynamic element -

i created custom login.validate event , binded .question dynamic element. not able trigger new event using trigger method (). here js fiddle , script http://jsfiddle.net/pzsym/400/ <h2></h2> <button>generate new element</button> <p class="generateevent">trigger event validate</p> $("button").click(function() { $("h2").html("<p class='test'>click me</p>") }); $('p.test').bind('validate', function(){ alert('this working'); }) $('h2').on('login.validate', 'p.test', function(){ console.log('good validate event need trigered'); }); $('.generateevent').click(function(){ $('p.test').trigger('login.validate'); }); how trigger custom event in dynamic elements? you need use event delegates. here working sample: http://jsfiddle.net/tkirda/pzsym/414/ $("button").click(f

SQL Server stored procedure / cursor -

i wanted know if possible in sql server: my table looks this: create table membership ( memebership_id int identity(1,1)primary key not null, membership_expiry_date datetime, member_account_balance money, member_blacklisted bit ,--(0 no, 1 yes) customer_id int not null, last_payment datetime ) i wanted know if possible use stored procedure or without cursor inside of change member_blacklisted column if last_payment more 6 months date has inserted e.g. declare @memberid int,@date datetime my attempt far: declare @memberid int,@date datetime -- declaring cursor. declare c_expired_penalty_blacklist cursor ( select membership ) -- open cursor declared. open c_expired_penalty_blacklist fetch next c_expired_penalty_blacklist @memberid,@date while @@fetch_status = 0 begin if @date > datepart(month,getdate()+6) begin update membership set member_blacklisted = 1 memebership_id = @memberid end fetch next c_expired_penalty_blackli

Django and Rails on Apache localhost -

i wanna test performance of django , rails. would testing using inbuilt web servers bad idea? is difficult set making both django , rails run on apache localhost? (not same time) the usual way run rails directly in apache using passenger, tries set mod_php if you've set php apps served apache. or can use apache loadbalance dynamic requests backend, thin or unicorn or others; apache set serve static assets directly in situation. using rails' webrick server bad idea, because it's notoriously slow. you'll want set rails_env 'production' instead of 'development' when start rails, classes cached , on. i don't know setting django, imagine similar load balancing situation described above rails. give rails , django apps own virtualhost settings in apache, , should work fine.

codeigniter - Geting php error for array_merge and array_unique -

below arrays , code trying unique/merge $data['default_new'] = array_unique(array_merge($data['default'], $data['related'])) array ( [0] => array ( [keywords_id] => 8 [keyword] => curling [parent_id] => 5 [count] => 0 ) ) array ( [0] => array ( [keywords_id] => 8 [keyword] => curling [parent_id] => 5 [count] => 0 ) [1] => array ( [keywords_id] => 10 [keyword] => catchers [parent_id] => 6 [count] => 0 ) [2] => array ( [keywords_id] => 16 [keyword] => ces 2013 [parent_id] => 3 [count] => 0 ) ) it gives me array string error: a php error encountered severity: notice message: array string conversion filename: models/con

php - AJAX: return true or false on 'success:' -

i have following ajax script, reason var ok it's not returning true or false form can continue: function ajax_call(email,title,url){ var email = document.getelementbyid("email").value; var title = document.getelementbyid("title").value; var url = document.getelementbyid("url").value; var parametros = {"emaail":email, "tiitle":title, "uurl":url}; var ok = true; $.ajax({ data: parametros, url: 'validate.php', type: 'post', error: function () { alert("an error has occurred! try again!"); }, success: function (response) { if(response == 'bien') { ok = true; } else { $("#ajax_cal").html(response); ok = false; } } }); return ok; } html: <form onsubmit="return ajax_call();"> ... </form> php: <?php //////.... if(!empty($errors)) {

xcode4.6 - iOS Universal App Class Architecture -

what correct way implement classes in universal app? i have 2 xib (one each device), each xib calls same class , inside class have conditional statement checking type of device running app , corresponding code each one. i'm confused if correct structure, or have create base class , extend class each of devices overwrite corresponds each one? i try reuse code can many developers create separate classes iphone , ipad versions avoid "spaghetti code". depends on complexity of app writing. if it's simple app see no reason provide logic test device , execute different code based on vs creating multiple classes each. although, there many benefits creating separate code each such unit testing or easy updating of ipad specific code , vice versa. have seen successful developers use both methodologies , both work if document , pragma mark code correctly. here example of using diff classes you can create simple class returns device type if typing out full te

ios - How to check if NSNetService has stopped publishing -

i need find way observe when app stops publishing service via bonjour. happens when device receives call or such interruption. background: i'm using gcdasyncsocket communicate between 2 devices in same network app plays music (supports playback in background). i use nsnetservice broadcast ip , port other apps (clients) connect server. when server device receives phone call, publishing stops , other devices won't able see service. is there particular property need observe know when has stopped , can restart again. thanks in advance older question, i'm facing same problem currently. as far know can following: you can use nsnetservicebrowser , nsnetservicebrowserdelegate delegate. i assume you're using nsnetservicebrowser class, with [self.domainbrowser searchforservicesoftype:@"youridentifier" indomain:@"local."]; you can set delegate on browser instance. the delegate method - (void)netservicebrowser:(nsnetservic

php - JavaScript search script not working in Internet Explorer? -

i've following search script doesn't seem working @ in ie. comes "sorry, couldn't find using search criteria..." error. the code follows: <? $getmystatus = mysql_query("select status members id = '$session_memberid'"); while($getmys = mysql_fetch_array($getmystatus)) { $mystatus = $getmys['status']; } ?> <script language=javascript> function search() { var snum = 0; var name = $("#search_name").val(); var city = $("#search_city").val(); var country = $("#search_country").val(); var jobtitle = $("#search_jobtitle").val(); var company = $("#search_company").val(); var minage = $("#search_minage").val(); var maxage = $("#search_maxage").val(); var industry = $("#search_industry").val(); var male = $('#search_male').is(':checked'); var female = $('#search_female').is(':checked'); var token = $("#mtok

android - WebView in ScrollView prevents all scrolling -

Image
i want to: put fragment on screen, contains: a webview ...expanded full height embedded in layout of fixed size above , below scroll layout (i.e. whole thing, including full-height webview) this seems impossible. i've read 10+ different questions/answers on so, of them covering different critical bugs in android webview, none of them covering situation. it seems (from reading other questions, , following links current unfixed bugs on android site) that: webview's height has been wrong (unfixed android 2 - 4: e.g. height never decreases) webview's scrolling breaks, un-breaks, re-breaks in new ways in successive android releases (e.g: releases scrollview takes control, others webview takes control, others "fight" , stuttering, etc) you have use bizarre tweaks scrollview make it's supposed out-of-the-box. e.g. "android:fillviewport="true" (huh? isn't "layout_height=fill_parent" supposed do?) does have working

redirect - Remove trailing slash in WP multisite .htaccess file -

i've created .htaccess file contains redirects 1 site part of larger wordpress multisite install. the .htaccess content starts (necessary because same .httacess file must used multiple sites: rewritecond %{http_host} ^mydomain.com [nc] and contains series of rewrites, so: rewriterule ^about-my-site$ [r=301,nc,l] if visit mydomain.com/about-my-site , correctly redirected mydomain.com/about however, if visit mydomain.com/about-my-site/ (please note trailing slash), "page not found" error. change rewriterule to rewriterule ^about-my-site/?$ [r=301,nc,l]