Wednesday, 15 February 2012

mysql - issue on database query to fetch data with subquery -


मुझे एक SELECT क्वेरी के साथ परेशानी हो रही है।

  SELECT P.product_id, ( से चुनें श्रेणी_आईडी श्रेणी सी जहां से C.product_id = P.product_id) ए पी बिल्ली से उत्पादों पी  

यह उत्पाद के उत्पाद को कैंडिडेट से और श्रेणी_आईडी से खींचने के लिए माना जाता है। यदि उत्पाद कई श्रेणियों में है, तो मैं श्रेणियां फ़ील्ड उन श्रेणियों की सूची वापस करने के लिए चाहूंगा I समस्या यह है कि एक subquery केवल एक ही मान वापस करेगा। क्या किसी को पता है कि यह कैसे लिखना है?

धन्यवाद!

इसके लिए GROUP_CONCAT का उपयोग करें:

  SELECT P.product_id, GROUP_CONCAT (PC.category_id SEPARATOR ',') उत्पादकैग पीसी से, उत्पाद पी WHERE PC.product_id = P.product_id GROUP द्वारा P.product_id;  

चेक आउट करें।


c# - BigInteger bigger than the Long and Int? -


I'm doing a program that will use a large number, and for a little slow speed, too much Will work. And my question is, is that big injection is slow and slow slow?

  long number = 12; Bigentiary number 2 = 12; Add Public Zero () {number + = 1; } Public Zero add2 () {number2 + = 1; }  

Which is faster now?

Yes, type BigInteger is slow int or long time.

But in reality, with a large number, the integer calculation is a big intangare required .


r - Self avoiding walk -


I want to simulate a self that would avoid random walking in two dimensions on a square mesh and plot a path.

So far I've written the code for this problem:

  n < - 100 x & lt; - 0 y & lt; - 0 randomwalkx & lt; - 0 Randwicki & lt; - For 0 (1: n) (random == 1) {x  

The path travels only in a diagonal direction Does anyone see me or solve this mistake?

The problem is in this line:

  if (ycheck == "TRUE" and & amp; xcheck == "TRUE") { 

This is what the line is doing, doing so can not let your walking "backwards" assume that your Walks random walkx = (0,1,1,2), randomized = (0,0, -1, -1) and your next role gives you x = x-1: the next coordinate will be 1, - 1 . Both x = 1 and y = -1 are present in your random running history, so your loop will roll again until you move on in the same direction for X or Y.

If you can fix this by changing something like Paste (Paste (X, Y)% Paste (RandWox, RandWalk))

  {{code > 

go - How do I do enums in golang? -


मेरे पास

  const (ब्लाहफू = 1 & lt; iota MooFoo)   

फिर

  प्रकार क्लस्टर स्ट्रक्चर {a int b int}  

मैं केवल BlahFoo के लिए Cluster.a चाहता हूँ या MooFoo

मैं इसे कैसे लागू करूं?

  प्रकार FooEnum int const (BlahFoo FooEnum = 1 & lt; & lt; iota MooFoo) प्रकार क्लस्टर संरचना {a FooEnum b int}  

c# - Model binding with two Search Results selection -


I have a MVC view that has contact information fields such as first name, last name, address, city, state and zip . These fields are auto-populated with 2 search results drop-downs (lookupSLMRLeadRec) and lookupCRMLeadRec ()). Apart from this, I am using blockade for this MVC project.

Example: Address 1 for the population:

  & lt; Div data-bind = "visible: display phone view" & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; Td> & Lt; Strong & gt; * Road & lt; Br / & gt; Address: & lt; / Strong> & Lt; / TD & gt; & Lt; TD & gt; @ Html.TextBoxFor (model => model.vchAddress1, new {data_bind = "value: lookupSLMRLeadRec (). VchAddress", @class = "form-control"}) & lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt; Div data-bind = "visible: display CRMView" & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; Td> & Lt; Strong & gt; * Road & lt; Br / & gt; Address: & lt; / Strong> & Lt; / TD & gt; & Lt; TD & gt; @ Html.TextBoxFor (model => model.vchAddress1, new {data_bind = "value: lookupCRMLeadRec (). VchAddress", @class = "form-control"}) & lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Div & gt;  

The address is not being passed in the 1st model scene, because the area is populated based on two conditions.


regex - find files with more than 1 match using grep -


I am thinking that there is no way to list files with more than 1 match using grep. Here's what I'm doing: I'm going through a customer's website and trying to replace the last match with a string. Therefore, at the bottom of each page, he has this line:

  & lt; P align = "center" & gt; & Lt; Font face = "aerial" color = "# 808080" size = "2" & gt;  

Which is followed by a footer, I need to change it (sed) from this line:

   

But I want to separate the files which are just 1 instance of that first line, so I can replace them. Another solution to my problem would be to use sed only on the last match, or to use sed on the last 50 lines of a file. Any ideas for me?

You can actually use grep -c in the file matches Number of:

  grep -c '& lt; P align = "center" & gt; & Lt; Font face = "arial" color = "# 808080" size = "2" & gt;   

To store your output

  cnt = $ (grep -c '& lt; p align = "center" & Gt; & lt; font face = "aerial" color = "# 808080" size = "2" & gt; 'file)  

CSS converted from SASS not working -


Trying to use SASS in my project I wrote a SCSS and then changed it to CSS.

I have made a SCSS,

$ primary caller: # D92231; Body {$ primary color: # ccc; Background: $ Primary Caller; } P {background-color: $ primary collar; } Ui-btn {background color: $ primary-color; }

Convert that SCSS to command by CSS,

  sass-convert style.css style.scss  

> Lastly I got CSS. Generated CSS,

  $ Primary Color: # D92231 Body Background: $ Primary Color P Color: $ Primary Color URI-btn Background-Color: $ Primary Color  

I added it to my html page but there is no effect. Where am i going

Generating CSS is not actually a sass in the form of CSS Convert actually Sass does not convert to CSS

This depends on the CSS based on the SASS or SCSS which you want.

To convert SCSS into SASS, you will need to run the script below. You will need to install SASS.

  sass input.scss output.css  

Alternatively, you can run a script to update the SCSS file to Ruby and on every saving

Similarly:

  sass - Input Input CSS: output.css  

Read more here:


java - What is a NullPointerException, and how do I fix it? -


What are the null pointer exceptions ( java.lang.NullPointerException ) and what is the reason for them?

Which method / tool can be used to determine the reason so that you stop the exception due to terminating the program prematurely?

When you declare a reference variable (i.e. one object), then you can actually declare an object Make an indicator. Consider the following code where you declare a variable of the primitive type int :

  int x; X = 10;  

In this example, the variable x is a int and Java will start it in 0 for you. When you give it for 10 in the second row, your value is written in 10 memory place, which is indicated by x.

However, when you try to declare a different type of reference type, take the following code:

  integer number; Num = new integer (10);  

declares a variable called the first line, but does not have a primitive value. Instead it has an indicator (because this type is the integer which is the reference type). Since you have not said so far, what does it tap to indicate Java, which means "I'm not saying anything".

In the second line, the keyword new is used to instantiate the integer type of object (or create) and the pointer variable number is assigned to this object . Now you dereferencing operator . You can refer to the object using (a point).

The exception that you asked is when you declare a variable but do not create an object if you try to dereference num If you do, you can obtain NullPointerException before receiving the item. The compiler will catch the problem in the most trivial cases and you have to tell that "the number has not been started", but sometimes you write a code that does not make the object directly. For example, the method is as follows:

  do something for public void doSomething (SomeObject obj) {// obj}  

that status Unfortunately, it is possible to call the method in this way: obj , rather assuming that it was created before the doSomething method: < / P>

  doSomething (empty);  

In that case, obj is zero if the purpose of the method is to do something in the object, then it is advisable to throw NullPointerException This is a programmer error and the programmer will need that information for debugging purposes.

Alternatively, there may be cases where the purpose of the method is not fully operated to pass in the object, and therefore a null parameter may be acceptable. In this case, you will need to examine a null parameter and behave differently. You should also understand this in the document. For example, doSomething can be written as:

  / ** * @ an alternative foo for the ultimate obj ____. False, in that case * the result will be ____.  

Finally

/ div>

Ignore message "Breakpoint x at y" after setting a breakpoint in gdb -


Is it possible to disable the "breakpoint x" on the message "after setting the breakpoint in gdb?" Example:

Breakpoint 1248 at 0x10054700 & lt; Function, no debug info & gt; Ceremony;

I am setting up breakpoints for each function in the file and I want to leave these messages.

You can do it in one of two ways.

You can use the set logging command to redirect the output to / dev / null . Then set your breakpoint, and then reset the logging.

Or, you can evaluate the command through Python using gdb.execute , and you can use to_string to output To redirect the string into the parameter of that function - and then ignore the return value of this function.


json - Embjerjs store.find not working while getJSON is -


I am starting to build an amber app, I'm almost done with the API, which works for me. I am able to display correctly with .getJSON, but not with store.find method, instead I get an unknown type of error, which I am guessing the amount of data that is not recovering properly. I am using Amber Inspector in Chrome, but I do not know why he is trying to get JSON, I am assuming that it should be "API / Projects".

Thank you!

  window App = amber application. Create (); App.Router.map (function () {this.route ('project')}); App.ApplicationAdapter = DS.RESTAdapter.extend ({Namespace: 'API'}); App.Projects = DS.Model.extend ({title: DS.attr ('string'), Description: DS.attr ('string')});  

This works:

  App.ProjectsRoute = Ember.Route.extend ({Model: function () {Refund $ .getJSON ("API / Projects "). Then (function (data) {return data.projects;});}});  

It is not:

  App.ProjectsRoute = Ember.Route.extend ({model: function ()} return.store.find (' Projects');}}); Error while processing route: Project can not read property type 'type' of undefined type: Undefined property on DS can not read 'type'. RESTAdapter.DS.Adapter.extend.findAll (http://trgmanage.app/js/libs/ember-data.min.js:928455) at Object.Ember.assert (http://trgmanage.app/js / Libs / ember-1.10.0.debug.js: 3934: 27) but the DS.Ember.Object.eddedFaceLal (http://trgmanage.app/js/libs/ember-data.min.js: 8: 20000) at DS.store.member.object.and.find all (http://trgmanage.app/js/libs/ember-data.min.js:8:19773) in DS.store.emember.object . Expand (http://trgmanage.app/js/libs/ember-data.min.js:8:16174) at App.ProjectsRoute.Ember.Route.extend.model (http://trgmanage.app/js/ App.js: 13: 23) at EmberObject.extend.deserialize (http://trgmanage.app/js/libs/ember-1.10.0.debug.js:23915:21) at applyHook (http: // trgmanage. App / js / libs / ember-1.10.0.debug.js: 50118: 30) on object. Handler InfoRent Shared Model Hook (http://trgmanage.app/js/libs/ember-1.10.0.debug.js: 48139: 22) at Object.subclass.getModel (http://trgmanage.app/js /libs/ember-1.10.0.debug.js:48365:21)  

JSON Response: (Formatted JSONview in Chrome)

  {projects : [{Id: 1, title: "This is going on", Description: "The above has been revealed, even the number of all the leaders, and they can be taken to the place later. It is necessary to do this in the form of a group of companies. , But did not say anything to them. "}, {Id: 2, title:" twinkle1 ", Description:" Encounter and it actually invades during life. "Culpa voluptatum accusamus voluptate voluptate or nihil. Let's talk about you and tell only about those people non-qui snatite rim acuid end. "}, {Id: 3, title:" Culpa quibusdam perspiciatis id dolorem consequences. ", Description: "This is not really an easy way for this feature. Optios charge what you can do JSON Response Asimated:  
  {"Project": [{"id": 1, "Google" heading ":" go this Has been "," description ":" has reached the place after this ", even the number of all the leaders, and can be taken to the place later, as a group of all companies. Required for. The disciplines were interrupted, but nothing has been said to them. "}, {" Id ": 2," Sheer ":" Twinkle1 "," description ":" encounter and it actually invades during life. "Culpa voluptatum accusamus voluptate voluptate or nihil. Suit Adyphe deli Nihil Choir Dolorum Tell you about it and only about those people "Information": "It is not true that it is not really." "Description:" "," "": 3, "title": "Culpa quibusdam perspiciatis id dolorem result.", "Description" There is an easy way for this feature. Opti Charges Such as what you can do is using an old one. The Open was using an old one. Version of Ember-data Beta 6 Yakas After updating to the latest Beta 15, all this works just as much as you want. 


Android Studio fatal error: CL/cl.h No such file or directory -


I am trying to create an OpenCL program in Android Studio and running in the following problem:

< Pre> Android Studio Fatal Error: CL / CLP is not such a file or directory

I am searching and everything is a solution for "Visual Studio".

I thought that if we have the solution specifically listed for Android studio and this error, then it can be helpful.

Any ideas how to fix this? I think that the reference commands from the command line to the GCC move I just have to work with Android Studio

OpenCL is not part of Android, so you can not get a CLH. Download the required cl header files from here:

Download CLH with the correct version (as the CL version is using, for example, CL 1.1).

Header files in your OpenCL program, so you have good to go.


Edited 4/18/2015:

OpenCL header files, you can do the following:

  #ifdef __APPLE__ #include & lt; OpenCL / opencl.h & gt; #else #include & lt; CL / opencl.h & gt; #endif  

But if you have the program CR code (without CL-GL interoperability), CL / CLH also includes:

  #include & Lt; CL / cl.h & gt;  

After doing this, you should add folders containing the cl folders in the path in your mailbox. (Below is the PATH_TO_CL_FOLDER your CL folder)

For people using Android .mk

If you have application.mk and Android Working with MK, and using your native library traditional ndk-build , you should add the path to the CL directory in the LOCAL_C_INCLUDES variable in Android.mk.

<<> LOCAL_C_INCLUDES + = PATH_TO_CL_FOLDER

For people who work with griddle in Android studio (This is what you need )

Edit Build.gradle, add your path to the cFlags field as listed below:

  android {defaultConfig {ndk {moduleName "yourlib" stl "stlport_static "LdLibs" logs "," z "cflags" -IPATH_TO_CL_FOLDER "} ...} ...}  

android:ellipsize not working as intended -


Here's some code, I can repeat the bug, even if I strip everything on a simple text view.

  End Lieutenant: TextView Android: Layout_With = "250dp" Android: Layout_Height = "Wrap-Content" Android: Alpsas = "Medium" Android: SingleLine = "True" Android: Text = "I Very smart I am very smart AM very smart "Android: textSize =" 16sp "& gt; & Lt; / TextView & gt;  

I wish I could post a screenshot but SE is not giving me what is the text that has been shortened in the middle (as intended), but a full oval ( ...) instead of a dot (.) With

all that I do on Lollipop Tablets (Nexus 7 and Nexus 9). Other devices are displaying the ellipses properly. I have researched this issue and got different comments about people who got the same problem, but no answer.

this:

  Android: layout_width = "250dp" Android: Android: singleLine = "true" Android: singleLine = "true" abdroid: focusable = "true" Android: Focusable Infobox = "True" Android: Text = "I'm very smart I'm very smart I'm very smart "Android: Text Size =" 16 SP "& gt; & Lt; / TextView & gt;  

c# - How to call ManagementObject with more than one parameter? -


BcdObject का उपयोग ManagementObject प्राप्त करने के लिए सही सिंटैक्स क्या है? एकल पैरामीटर जो मैं उपयोग करता हूँ:

  var obj = new ManagementObject (@ "root \ WMI", string.Format ("BcdObject.Id = '{0}'"), नल);  

लेकिन मुझे यकीन नहीं है कि अतिरिक्त मापदंडों को कैसे जोड़ें (यह और , या , , या कुछ और है?), कुछ जैसे:

  var bcdObj = नया प्रबंधनऑब्जेक्ट (@ "रूट \ WMI", string.Format ("BcdObject.Id = '{0}' और BcdObject.StoreFilePath = '{1}' "," {वर्तमान} "," "), नल);  

यह जाने का तरीका होना चाहिए:

  Var bcdId = "{current}"; Var sfp = ""; Var obj = नया प्रबंधनऑब्जेक्ट ("रूट \\ WMI: BcdObject.Id = \" "+ bcdId +" \ ", StoreFilePath = \" "+ sfp +" \ "");  

ध्यान दें कि यदि आप कॉमा के बाद केवल एक स्थान डालते हैं तो यह काम नहीं करेगा। शुभकामना!

आप कन्स्ट्रक्टर में एक दूसरे पैरामीटर के रूप में फ़िल्टर स्ट्रिंग को पारित कर सकते हैं (जैसे कि आपके मूल कोड में), लेकिन समान नियम लागू होते हैं - कोई स्थान नहीं

< / div>

css - Show truncated text on touch -


As we know we can shorten the text with CSS and "can cancel it like this :

  & style style = type = "text / css"> one-long-line {max-width: 400px; white-space: abrap; overflow: hidden; text -Overflow: Ellipissis;} One-long-line: Hover {Overflow: visible}} I used it to cut long H1 in the mobile view, however I want the user to be able to see the full headline. It does not work on mobile. I wonder if something can be coded exactly where the user touches the header, and of course this code should be.  

works with: active

  .offlow-tip {white-space : Abrup; overflow-x: hidden; text-overflow: alipesis;} .offlow-tip: Invitation deactivated, Kuvrflo-tip: hover {overflow-x: visible}}  

demo


android - Custom expandable BaseExpandableListAdapter getGroupView or getChildView never gets called -


I have a page with 2 page, Viewpager , I fill out a form Swipe on the page and in the expandableList , I am using a custom adapter below.

I've included expandable listview and another button inside a layout.

When I swipe on this new page, I see an empty layout with the button, the expandable list never appears

I have checked and ReturnGroupCount is returning a size equal to the size of the array list data, so this is not the problem of data being empty.

On further analysis, I thought that getGroupView as well as getChildView is never called, for debugging those methods Add some log statements, they are never printed. Although the constructor is being called, same getGroupCoun is returning the right values. Is my implementation correct?

Public class FareStageExpandableListAdapter BaseExpandableListAdapter {Private context reference; Private LayoutsInfoLtter; Private Array List & Lieutenant; Tripitines & gt; Information; Personal SimpleDataFormat Formatter; Private Editing Test Fairfield; Private text view title text; Private textview child text; Public FareStageExpandableListAdapter (Reference Reference, ArrayList & lt; TripTimings & gt; Data) {Log D. ("FareStageExADapter", "Constructor"); This.context = context; This.inflater = (Layout Influenor) reference .getSystemService (References LAOUT_INFLATER_SERVICE); This.data = data; This.formatter = New SimpleDateFormat ("HH: mm"); } @ Override Public Integrucent () {return data.size (); } @ Override Public In Big ChildConnect (Int. Group Position) {Return Data. Size () - 1 - Groupposition; } @OverWide Public Object Gate Group (Input Group Group) {return data.get (groupPosition); } @OverWide Public Objects Hosbild (Int Group Group, Intimate Child Position) {Return Data. Gate (Groupposition + child position); } @ Override Public Long Hot Group IID (Int. Group Position) {Return Data. Get (groupposition) .hashCode (); } @ Override Public Long Match ChildID (Int Group Group, Intimate Child Position) {Return Data.Gate (Groupposition + child position). Hashkod () + 5; } @ Override Public Boolean Hastel IDS () {// Tudo Auto-Generated Method Stub Returns True; } @ Override Public View: getGroupView (Ent groupposition, Boolean extension, see convertview view, view group guardian) {Trimmins parent = data. Get (groupposition); If (convertView == empty) {convertView = inflater.inflate (R.layout.fareadd_expanded_parent, parentView, incorrect); } HeaderText = ((TextView) ConvertviewFindvibid (RIDOrigintext)); Log D. ("Setting Header Text", parent.getStop (). GetStop_name ()); HeaderText.setText (parent.getStop () getStop_name ().); Return Convertview; } @ Override public see getChildView (Ent groupposition, int child position, Boolean establishment, View Convertview, View Group Child Voyage) {Last Triitims Children = Data. Gate (Groupposition + child status); If (convertView == empty) {convertView = inflater.inflate (R.layout.fareadd_expanded_child, childView, incorrect); } ChildText = ((TextView ConvergedDestinationText)); Log D. ("Setting Up Child Text", child.getStop (). GetStop_name ()); ChildText.setText (child.getStop () getStop_name ().); Return Convertview; } @ Override Public Boolean is ChildSclaimable (Int Group Position, Int Body Position) {// Tudo Auto-Generated Method Stub Return False; }

}

This is when you fall asleep Are deprived There is nothing wrong with the code, except that the adapter has never been added to expandable list view


javascript - Infinite scroll return multiple results in IE -


I have created a simple borderless scrolling for my website that shows more image when scrolling down. It works with chrome, but when I test it on Internet Explorer, loader shows results many times. I do not know where this error is.

Here is my jQuery code:

  $ (document) .ready (function (e) {$ (document). Scroll (function () {if ($ (window) .scrollTop () + $ (window) .height () == $ (document) .height ()) {var pictureCount = $ ("Picture-1A"). Length; $ .get ('ajax / home-pagination.php', {off_set: pictureCount}, function (data) {$ ("# home content"). Append (data);})}}})}} ;  

I send off_set to the php page which will return the data with new pictures and add it at the end of the page


xcode - Filtering multiple arrays -


I'm trying to filter the 4 arrays but I can not work it, it's a pushed tableview Uses NSSSING. When I write something in the search bar, the search results are in the other than the 1 arrow (merlance). I know that the problem is in - (zero) filtertContentForSearchText: . I missing

  - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section {if (tableView == self.searchDisplayController.searchResultsTableView) {return [self. SearchResults2] count; } Else {if ([testName isEqualToString: @ "CES"]) Return [self.CES count]; If ([testName isEqualToString: @ "Merlin"]) back [self. Marlin count]; If ([testName isEqualToString: @ "DELTA 2, Navigator"]) Return [Self. Delta count]; If ([testName isEqualToString: @ "CREW 2002, Navigator"]) back [self. CREW calculation]; } Return 0; } - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {static NSString * CellIdentifire = @ "cell"; UITableViewCell * cell = [TableView deView Re-Eligible CellWithIdentifier: CellIdentifire]; If (cell == zero) {cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifire]; } If (tableView == self.searchDisplayController.searchResultsTableView) {cell.textLabel.text = [self.searchResults2 objectAtIndex: indexPath.row]; } Else {if ([testName isEqualToString: @ "CES"]) {cell.textLabel.text = [self.CES Objektatindeks: indexPath.row]; } Else if ([testName isqualToString: @ "marlin"]) {cell.textLabel.text = [self. Marling ObjectAutandx: IndexPath.ro]; } Else if ([testName isEqualToString: @ "Delta 2, Navigator"]) {cell.textLabel.text = [self.DELTA objectAtIndex: indexPath.row]; } Else if ([testName isEqualToString: @ "Crew 2002 Navigator"]) {cell.textLabel.text = [self.CREW objectAtIndex: indexPath.row]; }} Return Cell; } #pragma Search Methods - (zero) filtertContentForSearchText: (NSString *) Search text field: {NSPrite * Self.searchResults2 = [Self. Marlin filtered estimation using the application: predicate]; Self.searchResults2 = [self.CES is filtered using the phrase Valid: predicate]; Self.searchResults2 = [Self. Using Crew Filtered Array Valid: Count]; Self.searchResults2 = [self. Using DELTA filtered accessories is valid: Speak]; } - (BOOL) searchDisplayController: (UISearchDisplayController *) Administrator should be ReloadTableForSearchString: (NSString *) Search String {[self filtertContentForSearchText: searchString area: [[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex: [self.searchDisplayController.searchBarSuggestedStyleButton Industries]] ]; Yes come back } @end  

(By removing comments from one 'answer', together Better):

You have a scope parameter that you are not using inside the filter method to be reloaded in some usefulTemplateThereforeststring: To know which array you want to filter.

Look at that scope variable if its current value is something that you want to use, to find out which array you want to use, at the minimum, you can copy your copy You can ... and block you like the code in the cellphone indexpath and filter only a special array. / P>


java - Communication between parent and nodes -


We have a parent about many nodes Keeps the information. Each node has a different VM example, which performs various functions. The root is like a dashboard for all nodes.

original is required:

  • Send some topical configuration node
  • Change in node
  • Get some data from . Node

I think the node is not as far as possible as possible. Each node works as a web server, they can sometimes get large traffic.

Parents and nodes ?

I was thinking of using files for communication, so set the file with a command on original a node file You can do the system, and then there is a DIRE viewer who reads for such files.

Or there are some event-bus / message-queues in the background, but they are using sockets, so in case of a node high traffic parent Message can not be responsive. Or maybe I worry too much?

Edit

Is there an Event / Message-Bus that provides direct communication between channels to save time for broadcast? In my example, communication is always between parents and single children , there is no need to broadcast. So we can email some messages like;)

Edit # 2 - About Communications and Traffic

is a original (or a cluster Examples of a parent who represents one) The number of children is not determined, it can be anyone; The goal will be as much as possible, as long as the system works fine. Communication is:

  1. Command ( parent -> child ) Orders, usually started by administrator (Such as "restart", "upload", "reload configuration"). It goes directly to the specific children .

  2. Runtime statistics (each child -> parent ) each child your health ( Heart beat) and some minor data about guardian . This should not be a real time communication, until the message is moved 10 seconds.

  3. Runtime log (each child -> parent ) Important logs about traffic and usage. It can be high-volume data because it is important to measure each node, if the calculation exceeds some limit, then we should know about it. Again, not real time, but we need urgent warnings on high calculations. / P>

There is no need for normal transmission (since children s are not aware of other babies), this is a more direct message.

I advise you to use, because you have the necessary methods to communicate between the nodes , The class you want to communicate with is extending into the remote interface.

You have to use rmiregistry at the beginning of communication, but then it was won

Updates : if you have If there is a "central" node for delivering the reference / message, then it will not be needed again. I am not advanced to answer your last question, but this link can help you with what you want:

1.-

2.-


tdd - C# test always return true even when test fails -


Before I was running my test, I had set my code to look like the following: < / P>

  Private bool ValidateAntone (EntityModel.MultiIndexEntities Reference) {If (context.SearchDisplayViews.Count ()! = Expected SdvCount) {Assert.Fail ("Search Performance View Number Was Different from What Was Expected" ); } If (sdv.VirtualID! = Expected SedvertIID) {Assert.Fail ("Search Display View Virtual ID was different than what was expected"); } If (sdv.EntityType! = Expected SDETTip) {Assert.Fail ("What was the type of search display visual unit different than what was expected"); } Back true; }  

It also tells the correct path that if any exam passes or fails, and after some advice, I have changed my code, so it looks like the following :

  Private EntityModel.MultiIndexEntites context {Assert.AreEqual (Expected antiquity, context.), "What was the entity count different than expected"); Back true; }  

My thinking on using the new assert.rerequal is that it will still return on the basis of true or false if it passes or fails . But now my test is always right because I have no way to test if my test failed or not

All of the following line is named in my main examination method: < / P>

  Depend on ISTRU (test4PassFail = Accredited Test ("4.4"), "Test 4");  

Is there any way i can change my new code to return true or false without returning my old code?

instead of correcting , you can do . (Expected Antique, Context.NT.Count () "); .

This will be your failure / pass. You do not have to make a comeback, but as such, Time true is returning.

  [test class] public class test {[TestMethod] Private Zero valid Teston (EntityModel.MultiIndexEntites reference) {Assert.AreEqual ( Expected Antiquity, Context. Antiques.Count (), "Entity Count Was Different From Expect");}}  

parsing - Is there a way to see the result(output) of lexical and syntax analysis of a java program compilation process? -


Want to know that there is no way to see the output of the Java lexical and analysis steps while compiling Java programs. We can see the byte code (virtual machine code) by using Java code. Is there a way to see the production of the text and analysis phase? thank you in advanced!

If you want to analyze abstract syntax tree some sample of Java source file

  • You can debug the first instance and you will be loading the source Java file tree < / Code> in the object


    java - Birt Report with Dynamic Column -


    I want to create a Birt table report with a dynamic number of columns from the XML data source. How can I go about it?

    By searching I have read that it can be done with a scripted script, but I can not get an example or document how to use a scripted data source with a XML data source.

    I have also tried cross tab which works only for certain form groups (it does not work with strings).

    Here's a sample xml:

      & lt; Table & gt; & Lt; Line & gt; & Lt; Name & gt; & Lt; / Name & gt; & Lt; Question_1 & gt; The answer & lt; Question_1 & gt; & Lt; Question_2 & gt; The answer & lt; Question_2 & gt; & Lt; / Row & gt; & Lt ;! - Or it may be this way that I can control how XML is generated - & gt; & Lt; Line & gt; & Lt; Name & gt; & Lt; / Name & gt; & Lt; Question & gt; The answer & lt; Question & gt; & Lt; Question & gt; The answer & lt; Question & gt; & Lt; / Row & gt; & Lt; / Table & gt;  

    The number of questions for different XML is different but they are similar to the rows within an XML I want the data to be shown in table form in this form

    < Pre> names | Question_1 | Question_2

    As you mention this question, I think that The easiest way is to have a crosstab; Actually the datacobules work with numerical measures, but we can solve it by making a dummy measurement as an expression in the underlying datacube with "answer". Set the type of "string" to measure and the "first" set, then the crosstab should display each question in the cells


    html - table in a table with rowspan and colspan -


    I am preparing a table for pdf , my design is simple, but when I table The table will not make it design that I want. Design and its only crop image is not a complete image desing

    Now No div is not working for me only. How can I do this?

    Look at the design

    numbers and numbers , #OF units , details packages and goods , gross weight and remedies I think these are the rows in a table or td , I can not understand it .

    see

    Here I have some part in HTML as follows:

      & lt; Tr & gt; Html  and  css  

    & lt; Td> Apu 7031756 & lt; Br / & gt; Seal & lt; Br / & gt; Container size & lt; Br / & gt; & Lt; / TD & gt; & Lt; Td rowspan = "4" & gt; 4 & lt; / Td> & Lt; Td> 2012 Nissan VERSA & lt; Br / & gt; 2012 Toyota Camry & lt; Br / & gt; 2014 Toyota Camry & lt; Br / & gt; 2014 Kia ​​Camry & lt; / Td> & Lt; Td> 1237 Kgs. & Lt; Br / & gt; 12 9 5 Kgs. & Lt; Br / & gt; 12 9 5 Kgs. & Lt; Br / & gt; 12 9 5 Kgs. & Lt; / Td> & Lt; Td> $ 2799 & lt; Br / & gt; $ 1114 & lt; Br / & gt; $ 1114 & lt; Br / & gt; $ 1114 & lt; / Td> & Lt; / TR & gt;


    Downgrading to PHP 5.3 on Nginx -


    I am on the verge of extending it with this. I have a client running code that is compatible with PHP 5.3 and below. I am trying to find a way to install Nginx with PHP 5.3

    I have a LEMP setup running PHP 5.5. I was allowed to rebuild PHP 5.3 by following this tutorial

    And everything went successfully, but I did What is it to do after this?

    OK, I installed PHP 5.3 PHP 5.5 still running on my web server

    I run it:

      USER = Route PHP_FCGI_CHILDREN = 15 PHP_FCGI_MAX_REQUESTS = 1000 / usr / bin / env - - USER = $ USER path = / usr / bin PHP_FCGI_CHILDREN = $ PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS = $ PHP_FCGI_MAX_REQUESTS / Opt / PHP-5.3 / etc / bin / php & amp; 127.0.0.1:9001  

    To try and work it, but I do not know what I'm doing honestly.

    Why did you install PHP 5.5? According to your tutorial, you need to 5.3:

    download PHP

    Now download the latest PHP 5.3.29 archive with the following commands:

      PHP_VERSION = 5.3.29 wget -O /var/tmp/php-${PHP_VERSION}.tar.bz2 \ http://bg2.php.net/get/php-${PHP_VERSION}. Tar.bz2 / to / this / mirror  

    You need to specify what is the result of what you are doing and what the actual results are. / P>


    java - Edit JPG via WebDav -


    We have webdiv server, from which we can open editing documents for documents (words, excel, ...) . But we also need to open the image (JPG, PNG) and PDF from this server for editing on the client computer (for the default app for this computer - for JPG and ADB reader PDF for ADSB), and we have clean This is not a solution.

    Our thoughts:

    • Edit Win Registry on Customer (this is intranet project): "ms-powerpoint: ofe | u |" Add URLs like I can to find files to open files on a local computer:

    "HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ ProtocolExecute \ ms-word"

    < P> But what to do with it, it is not clear.

    • Write your own Java applet for client side (downloading files, opening, blocking, etc. will be handled by applet server etc.). It's clear (more or less), but the harsh and time-consuming way, I think.

    Can anyone give any feedback about this problem? Thanks!

    Is mapping the WebDAV resource out of the question as a network drive or webfolder? It can also be done by GPO originally.

    Relevant question:


    android - Showing aler diaog box in async task which is outside the activity (after execution is completed ) -


    छवि दर्ज करें यहाँ विवरण

    मैं async कार्य onpostExecute विधि में alertdialogbox को दिखाना चाहता हूँ जो एक differnt वर्ग है और एक आंतरिक वर्ग के रूप में नहीं लिखा है। मैं वर्तमान में एसिंक कार्य कन्स्ट्रक्टर में गतिविधि को पास कर रहा हूं और इसके संदर्भ को एलेरडीियलोग में प्रयोग कर रहा हूं, लेकिन एप्लिकेशन क्रैश हो रहा है। कृपया इसे कैसे हासिल किया जा सकता है, यह मदद करें। संलग्न त्रुटि है, त्रुटि से मैंने सोचा कि मुझे हेन्डलर का उपयोग करना होगा क्योंकि मैं यूआई को अद्यतन कर रहा हूं इसलिए मैंने हेन्डलर को जोड़ा और उसके अंदर एलरबॉक्स डाल दिया। लेकिन इस तरह से यह एप्लिकेशन क्रैश नहीं करता है, लेकिन एलेटबॉक्स को भी प्रदर्शित नहीं करता है। हेन्डलर का उपयोग नहीं किया जाना चाहिए क्योंकि मैंने पढ़ा है कि onpostExecute को UI थ्रेड में कहा जाता है। कृपया मुझे बताइए कि मैं गलत हूं।

    अग्रिम धन्यवाद।

    आपको आवश्यकता है क्रिया संदर्भ संदर्भ का उपयोग करने के बजाय एप्लिकेशन संदर्भ का उपयोग करने के लिए। आपको लगता है कि यह वही है जो आप यहां कर रहे हैं

      AlertDialog.Builder builder = new AlertDialog.Builder (imageUploadMainActivity.getApplicationContext ());  

    लेकिन आप अभी भी getApplicationContext () को कॉल कर रहे हैं, जो अनुमान लगाते हैं, एप्लिकेशन संदर्भ देता है);

    इसके बजाय हमें

    <प्री> अलर्टडायलोग.बिल्डर बिल्डर = नया अलर्टडायलॉग.बिल्डर (imageUploadMainActivity);

    यह मानते हुए कि imageUploadMainActivity वेरिएबल है जो संदर्भ को संदर्भ देता है आप AsyncTask के पास गए हैं। लेकिन, चूंकि आपने यह कोड नहीं दिखाया है, मैं निश्चित रूप से नहीं कह सकता।


    python - Problems running Flask-Appbuilder 1.3.2 -


    I have installed the flask-appbiller package properly, and I'm trying to execute the finisher, this is the following lines Shows:

      (venv) lupo @ mint-virtualbox ~ $ fabmanager traceback (most recent call final): file "/ home / lupo / venv / bin / fabmanager", line 9 , & Lt; Module & gt; Load_entry_point ('flask-appbuilder == 1.3.0', 'console_script', 'filibber') () file "/home/lupo/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 353, load_entry_point Return get_distribution (dist) .load_entry_point (group, name) file "/home/lupo/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 2321, load_entry_point return load in AP ( ) File "/home/lupo/venv/local/lib/python2.7/site-packages/pkg_resources.py", in line 2048, load entry = __import__ (self.module_name, globals (), globals (), [ '__name__']) File "/ Home / Lipoze / Win / Local / Lib / Python 2.7 / Societe - Package / Flux_Dublan /__init__.py", Punk End 4, the & lt; Module & gt; .models.sqla Import model, base, SQL file "/home/lupo/venv/local/lib/python2.7/site-packages/flask_appbuilder/models/sqla/__init__.py", in line 4, in & lt; Module & gt; Import as_declarative ImportError from Sqlalchemy.ext.declarative: Can not import name as_declarative  

    Can anyone help me with that?

    It's tried to:

      Sqlalchemy.ext.declarative import as_declarative  

    but has been found now with SQLAlchemy-0.9.9, as_declarative :

      Sqlalchemy.ext.declarative.api Import as_declarative  

    It seems that there is no reason for that import gone.

    Unless a new release of the Flask-AppBuilder or SQLAlchemy is made, the easiest solution is to get 0.9.8: Pip from SQLite sqlalchemy == 0.9.8 .

    The latest version of the Flask-AppBuilder has fixed it.


    php - add orderby clause when fetching data from parse.com -


    I'm trying to get data from parse.com, but it does not allow more than 10000 data to be excluded So that it is alternatively using the

    command

      $ request = 'skip ='. $ Max '& Amp; Limit = 1000 '; $ Url = "https://api.parse.com/1/classes/_Installation" "?". $ Request; // $ ch = curl_init ($ url); Curl_setopt ($ ch, CURLOPT_URL, $ url); Curl_setopt ($ CH, CURLOPT_HTTPHEADER, $ headers); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, true); $ Response = curl_exec ($ ch); $ Parse_data = json_decode ($ response, true);  

    I am trying to use this concept

    but I do not know that according to the order curl code.

    As the saying goes:

    < P> You can order by ordering a comma separated list by sorting on several fields, to retrieve documents which are ordered in descending order and in descending order by name:

    Example for you:

      $ request = 'skip =' $ Max '& amp; Border = 1000 & amp; Order = your_order_field ' By adding  - : 

      $ request = 'skip =' you can select the order or you can descend. $ Max '& amp; Border = 1000 & amp; Order = your_order_field '; // ASC $ request = 'skip =' Max '& amp; Amp; Limit = 1000 & amp; Order = - your_order_field '; // DESC  

    Xamarin Forms Android Memory Issues When Loading Images -


    Then I have this app in Xamarin.Droid, which basically loads an image that loads from the resource Which is only 168KB, before loading the image, the consumption of RAM of the app is 29.81 MB (already very high, since this time I am loading an image from XML which is 54KB). When showing a 168kb file, it goes up to 60 to 80 MB!

    I now call and go to the next page:

      var modalPage = new SomeContentPage (); Wait for the navigation. Push asyn (modal page); After that, I load a list of items from the json file with these lines:  
      stream stream = assembly. GETManifestResourceStream (Constants.APP_NAMESPACE + "someJson.json"); Streamer rewrite = new streamrider (stream); String content = re Reed to End (); This._animals = JsonConvert.DeserializeObject & lt; List & lt; MyObject & gt; & Gt; (material); Re.Dispose (); // adding it consumed up to 20 MB or maybe I am so desperate at this point that I thought that improvement has improved. Stream.Dispose ();  

    deserialized using:

      this._ someList = JsonConvert.DeserializeObject & lt; List & lt; MyObjects & gt; & Gt; (SomeJsonSource)  

    "Based on the current status of the page". I keep it in the current object (IMG background is an image of course):

      imgBackground.Source = ImageSource.FromResource (Constants.APP_NAMESPACE + ".reisara." + SomeObject.ImageFileName );  

    Some items have 10 items with only four string fields in the list.

    Can anyone help with this? Is this a known issue of some kind?


    java - Hibernate Criteria: subquery with IN -


    The first question here: I am using the DB2 and Java Hibernate criteria. I need to use one of my sub-parts where the volume and the sub code will be able to use IN . But I do not know the solution: I have it now:

      Criteria. Add (restrictions. Sequel Reciprocation ("{alias} .arnrmb in (Select from FIRBB from ARNRVB where MNIRRBB?)", Millennialhouses (). Toure (), Typierre));  

    I get this error:

      2015-03-16 14: 07: 13,566 [error] (SqlExceptionHelper: 147) - The descriptor indicator is not valid is.  

    Can anyone help?

    It has been set for now:

      CSCMonstexics .NoteApply (Gatewareware)) {StringBinder S.B. = New stringbilder (); ArrayList & LT; String & gt; Warehouse list = new Array list & lieutenant; String & gt; (Milan Warhouse ()); (Int i = 0; i & lt; warehousesList.size (); i ++) {if (i! = Warehouse list. Size () - 1) {sb.append ("'" + warehousesList.get ( I) + "'" + ","); Other {sb.append ("'" + Warehouses List (I) + "' ');}} String Warehouse Quadys = sb.toString (); Criteria. Aid (Restrictions (" {alias} .arnrmb in ( Select arnrvb from the leading, where mgnrvb ("+ warehousesQuery +")) "});}  

    I'm still curious to do so!


    linux - How to choose static IO memory map for virtual memory on ARM -


    I port the Linux kernel is investigating how the new ARM platform. I have noticed that some platform implementation is static mapping from a physical IO address to a virtual address in the map_io function.

    My question is how should I fix the "virtual" address in the structure map_desc ? Can I map physical IO to arbitrary virtual memory? Or are there some rules or good practice about it? .

    Here Some examples of map_desc and map_io >

      44 DT_MACHINE_START (VERSATILE_PB, "ARM-Versailles (device tree support)") 45.map_io = multifunction_map_o, 46.init_argeley = virtual_init_ariali, 47.in_matchin = multicast_dt_inited, 48.dt_compat = versatile_dt_match, 49 Restart = versatile_restart, 50 MACHINE_END  

      189 void __init versatile_map_io (null) 190 {191 iotable_init (versatile_io_desc, ARRAY_SIZE (versatile_io_desc)); 192} 131 static structure map_desc versatile_io_desc [] __initdata __maybe_unused = {132 {133. Virtual = IO_ADDRESS (VERSATILE_SYS_BASE), 134 Kpifan = __phys_to_pfn (VERSATILE_SYS_BASE), 135. Length = SZ_4K, 136. Type = MT_DEVICE 137}, { 

    too long for a comment ... < / P>

    Not an expert but, because map_desc is for static mapping. It should be from the system manual. How virtual the peripheral kernel can be accessed from the virtual location, the PFN (page frame number) is the physical address by the page units.

    does not matter if you are in kernel space, so you want to make this kernel using the virtual space mapping even have access to a fixed physical address which you need mapping, That can be one-by-one which I believe is what you get from map_desc.

    Statemapping mapping is map_desc, dynamic mapping is the ioremap. So if you want to play with physical IO, then ioremap is the first thing if it does not work for special cases map_desc.

    Different types of addresses in Linux provide a good entry point to mapping.


    r - How to do a PCA with 0 (zero) values -


    I want to make a PCA in R with monthly barin values. Since there is no rain during the winter, so there are a lot of values ​​in my column.

    When I run PCA, the following message appears in the console: error in cov.wt (z): 'x' should only have a finite value

    I think That R is telling me here that it does not like my 0 values ​​

    So, I tried to convert my 0 value into a 'real number', in which to multiply everything with 1.0000000001 . But even if I do this and I go again with new values, then it pops up with the same message

    I have read that getting rid of those lines Anyone who can use them in any missing value (which I can not do) or a PCA code, which in some way can deal with the tempted values. But my 0 values ​​are real, values ​​are not missing.

    I get a lot of information on the web how to deal with missing values ​​or NA values, but nothing to deal with zero values. Does anyone have any suggestions on how I can do this? Many thanks for your help!

    My guess is that "error in cov.wt (z): 'only having finite value in x Should complain that some confused are non-finite, that means NA / NAN This can happen, if you have variables that are standard deviation of 0.

    Example code:

      latent = rnorm (10) data = data. Frames (Representative (0, 10), # 10 0's secret + ronmore (10) #latent and noise latent + rnorm (10) # secret + 1.5 * rnorm (10)) # colnames (data) = c ("zeros", "var1", "var2", "var3") library (science) principal (Data) #Terror! Principal (data [-1]) # no error  

    c++ - Testing arduino gps -


    A friend of mine and me are building a robot in which GPS for arduino is to check the GPS we have the following Circuit built:

    Arduino circuit

    We have GPS Trying the following code to check:

      #include & software ;; serial.h> #include & lt; TinyGPS.h & gt; Long latitude, lan; // Create variables for latitude and longitude object software; GPSSial (2, 3); // TinyGPS GPS making GPS sensor connection; // Create a GPS object zero setup () {Serial.begin (9600); // Serial GPS Serial. Busin (4800); // connect GPS sensor} zero loop () {serial. Print ("test"); // I did implement this test while (GPSSearial .Unavailable ()) {// Check GPS Data Serial Print ("test2"); // I have implemented this test if (GPS. Encoded (GPSSearial read ()) // // GPS data serial Print ("Test 3"); // I GPS this test Gate_position (& amp; latitude & loan) applied; // Get Latitude and Longitude // Display Status Serial. Print ("Status:"); Serial. Print ("Lat:"); Serial.print (latitude); Serial.print (""); // print latitude serial Print ("lawn:"); Serial.printeline (loan); // print longitude}}}  

    The thing is that serial monitor produces output test number 1, but test number 2 and no3 do not output. So we expected that we made the circuit fail. But we have checked the stars etc. Does anyone know what the problem might be?

    Any inspiration / help is welcome,

    thanks,

    Justin van til

    Try this code.

      #include & lt; SoftwareSerial.h & gt; #include & lt; TinyGPS.h & gt; Tin GPS GPS; Static zero print_long (long value, long invalid, intel lane, int exact); Static zero print_in (unsigned long wal, unsigned long invalid, int lane); Static zero print_date (TNGPS and GPS); Static zero print_st (const four * str, int len); Softwarecierial SS (3,4); Zero setup () {serial.begin (9600); Ss.begin (9600); } Zero loop () {long latitude, lan; Integer alt; Unsigned short sentences = 0, unsuccessful = 0; Gps.get_position (& amp; latitude, and loan); Alt = gps.altitude (); Serial. Print ("Current Latitude and Longueudyu:"); Serial.print (lat); Serial.print (","); Serial.println (longitude); Serial. Print ("Current element:"); Serial.println (optional); Smartdelay (1000); } Fixed zero SmartDelay (unsigned long MS) {unsigned long time start = millise (); Do {while (ss.available ()) gps.encode (ss.read ()); } While (milis () - start  1) serial.print ('*'); Serial. Print (''); } Else {Serial.print (val, prec); Int vi = abs ((int) val); Int flen = prec + (val & lt; 0.0? 2: 1); // And - Flan + = Vi & gt; = 1000? 4: VI & gt; = 100? 3: Vi & gt; = 10? 2: 1; (Int i = flen; i & lt; len; ++ i) serial Print (''); } Smartdale (0); } Fixed Zero print_in (unsigned long wal, unsigned long illegal, Intel lane) {Four SJ [32]; If (val == invalid) strcpy (sz, "*******"); Second Sprintoff (SJ, "% LD", WAL); Sz [len] = 0; For (int i = strlen (sz); i & lt; len; ++ i) sz [i] = ''; If (LAN> 0) sz [len-1] = ''; Serial.print (SZ); Smartdelay (0); } Static zero print_st (const char * str, int len) {int slen = strlen (str); (Int i = 0; i & lt; len; ++ i) serial.print (i  

    Excel copy values from column to column but remove specific text -


    Hi, I am using this code to copy values ​​from sheet (1) column A to sheet (2) column B. It is working fine and whenever a value column is updated in column A, it is updated.

    The problem, or the question I have, is that I want to include another column in sheet (1), column (B). Column B. contains only different names, and are not being copied

      Private sub worksheet tags (by-target in the form of range) if not known (target, range ("A1: A50" )) Then there is nothing range ("A1: A50"). Copy Sheets (2) .Renze ("B1") end if the end is sub  

    But if the word "SUM" in column B is copied from column A to Sheet 2 in column B.

    Use . To see that the 'SUM' sheet is in (2) .col (B)

      Dynamic RJD in the form of private sub-worksheet tags (range by target) If not (target, range "A1: A50")) nothing is set RNG = Sheets (2). Ranges ("B: B"). Find: = "SUM", LookIn: = xlFormulas, _ LookAt: = xlPart, MatchCase: = False Range ("A1: A50"), if RNG is nothing. Copy sheets (2) .Renz ("B1") end if set RNG = some end if the end sub  

    ruby - How to call a Method in a Cucumber - Step Definition -



    ruby - How to call a Method in a Cucumber - Step Definition -

    i’m newbie cucumber framework. i’m trying phone call ruby method within of step definition. here how define method in lib/methods.rb

    class test_class def create_test_scenario() puts "here!!!" end end

    this how seek phone call method within of step definition:

    and(/^i create scenarios$/) test_class.create_test_scenario end

    i'm getting 'uninitialized constant test_class (nameerror)' when run test. ideas? thanks.

    you haven't instantiated test_class object. example:

    class test_class def create_test_scenario puts "here!!!" end end test_class.new.create_test_scenario # notice `new` method chained here #=> here!!!

    errata:

    here's link documentation explains initialize method , how can utilize set object state on initialization.

    for class (and module) names, ruby convention utilize camelcase. example, testclass instead of test_class

    ruby cucumber

    c# - Animate (smoothly) ScrollViewer programatically -



    c# - Animate (smoothly) ScrollViewer programatically -

    is there way smoothly animate scrollviewers vertical offset in windows phone 8.1 runtime?

    i have tried using scrollviewer.changeview() method , alter of vertical offset not animated no matter if set disableanimation parameter true or false.

    for example: myscrollviewer.changeview(null, myscrollviewer.verticaloffset + p, null, false); offset changed without animation.

    i tried using vertical offset mediator:

    /// <summary> /// mediator forwards offset property changes on scrollviewer /// instance enable animation of horizontal/verticaloffset. /// </summary> public sealed class scrollvieweroffsetmediator : frameworkelement { /// <summary> /// scrollviewer instance forwards offset changes on to. /// </summary> public scrollviewer scrollviewer { { homecoming (scrollviewer)getvalue(scrollviewerproperty); } set { setvalue(scrollviewerproperty, value); } } public static readonly dependencyproperty scrollviewerproperty = dependencyproperty.register("scrollviewer", typeof(scrollviewer), typeof(scrollvieweroffsetmediator), new propertymetadata(null, onscrollviewerchanged)); private static void onscrollviewerchanged(dependencyobject o, dependencypropertychangedeventargs e) { var mediator = (scrollvieweroffsetmediator)o; var scrollviewer = (scrollviewer)(e.newvalue); if (null != scrollviewer) { scrollviewer.scrolltoverticaloffset(mediator.verticaloffset); } } /// <summary> /// verticaloffset property forwards scrollviewer. /// </summary> public double verticaloffset { { homecoming (double)getvalue(verticaloffsetproperty); } set { setvalue(verticaloffsetproperty, value); } } public static readonly dependencyproperty verticaloffsetproperty = dependencyproperty.register("verticaloffset", typeof(double), typeof(scrollvieweroffsetmediator), new propertymetadata(0.0, onverticaloffsetchanged)); public static void onverticaloffsetchanged(dependencyobject o, dependencypropertychangedeventargs e) { var mediator = (scrollvieweroffsetmediator)o; if (null != mediator.scrollviewer) { mediator.scrollviewer.scrolltoverticaloffset((double)(e.newvalue)); } } /// <summary> /// multiplier scrollableheight property forwards scrollviewer. /// </summary> /// <remarks> /// 0.0 means "scrolled top"; 1.0 means "scrolled bottom". /// </remarks> public double scrollableheightmultiplier { { homecoming (double)getvalue(scrollableheightmultiplierproperty); } set { setvalue(scrollableheightmultiplierproperty, value); } } public static readonly dependencyproperty scrollableheightmultiplierproperty = dependencyproperty.register("scrollableheightmultiplier", typeof(double), typeof(scrollvieweroffsetmediator), new propertymetadata(0.0, onscrollableheightmultiplierchanged)); public static void onscrollableheightmultiplierchanged(dependencyobject o, dependencypropertychangedeventargs e) { var mediator = (scrollvieweroffsetmediator)o; var scrollviewer = mediator.scrollviewer; if (null != scrollviewer) { scrollviewer.scrolltoverticaloffset((double)(e.newvalue) * scrollviewer.scrollableheight); } } }

    and can animate verticaloffset property doubleanimation:

    storyboard sb = new storyboard(); doubleanimation da = new doubleanimation(); da.enabledependentanimation = true; da.from = mediator.scrollviewer.verticaloffset; da.to = da.from + p; da.duration = new duration(timespan.frommilliseconds(300)); da.easingfunction = new exponentialease() { easingmode = easingmode.easeout }; storyboard.settarget(da, mediator); storyboard.settargetproperty(da, "(mediator.verticaloffset)"); sb.children.add(da); sb.begin();

    mediator declared in xaml. animation not smooth on device (lumia 930).

    you should stick changeview scrolling animations regardless of whether info virtualization on or not.

    without seeing code changeview doesn't work, it's bit hard guess what's going on there couple of things can try.

    first approach add together task.delay(1) before calling changeview, give os time finish off other concurrent ui tasks.

    await task.delay(1); scrollviewer.changeview(null, scrollviewer.scrollableheight, null, false);

    the sec approach bit more complex. i've noticed that, when have many complex items in listview, scrolling animation first item lastly (from changeview method) isn't smooth @ all.

    this because listview first needs realize/render many items along way due info virtualization , animated scrolling. not efficient imho.

    what came - first, utilize non-animated listview.scrollintoview scroll lastly item realized. then, phone call changeview move offset size of actualheight * 2 of listview animation disabled (you can alter whatever size want based on app's scrolling experience). finally, phone call changeview 1 time again scroll end, animation time. doing give much improve scrolling experience 'cause scrolling distance actualheight of listview.

    keep in mind when item want scroll realized on ui, don't want above. calculate distance between item , top of scrollviewer , phone call changeview scroll it.

    i wrapped logic above in answer's update 2 section (thanks question realized initial reply doesn't work when virtualization on :p). allow me know how go.

    c# windows-runtime winrt-xaml windows-phone-8.1

    c# - Best way to implement a request response pattern that is extendable -



    c# - Best way to implement a request response pattern that is extendable -

    ok,

    i have create c# library can send commands device , process command specific responses , broadcasts on serial port (or other communications method). library must able handle request , response extensions held in other libraries devices implement extended command set, must possible take whether these extended commands utilised (i guess using reflection in client app). have created class of type packet able create packet , add together payload, calculate checksum , write packet stream.

    public class packet { internal packetheadertype header { get; private set; } internal list<byte> payload { get; private set; } protected int payloadlength { { homecoming payload.count; } } protected byte headerbyte { { homecoming (byte)((convert.tobyte(header) << 4) | payloadlength); } } //we need add together packet length lower nibble of header before sending public packet(packetheadertype header, list<byte> payload) { this.header = header; this.payload = new list<byte>(payload); } public packet(packetheadertype headerbyte) { this.header = headerbyte; this.payload = new list<byte>(); } internal byte xorbyte { { byte xorbyte = convert.tobyte(headerbyte); (int = 0; < payloadlength; i++) xorbyte ^= payload.toarray()[i]; homecoming xorbyte; } } public async task writeasync(stream stream, bool flush = true, cancellationtoken token = default(cancellationtoken)) { var buffer = new list<byte>(); buffer.add(headerbyte); if (payload != null && payloadlength > 0) { buffer.addrange(payload); } buffer.add(xorbyte); await stream.writeasync(buffer.toarray(), 0, buffer.count); if (flush) { await stream.flushasync(); } } }

    i have created kid classes implement type packet each of valid commands. have created class of type packethandler able read bytes stream , create packet object.

    the way envisage using library this:

    public async string getcmdstnsoftwareversion() { var msgreq = new cmdstnsoftwareversionreqmessage(); await msgreq.writeasync(sport.basestream); await var response = msgreq.getresponse(5); //5 = timeout in seconds! homecoming string.format("{0}.{1}", response.major, response.minor); }

    what stuck on pattern and/or illustration implementation handling responses compatible implementing extension libraries. can provide input?

    c#

    sql - Column is blank but doesn't qualify where clause -



    sql - Column is blank but doesn't qualify where clause -

    when run query:

    select lr.id, lr.hide location_room lr lr.lid = 19624

    i get:

    when run 2nd query:

    select lr.hide, id location_room lr lr.lid = 19624 , (lr.hide = ' ' or lr.hide null or lr.hide = '' or datalength(lr.hide) = 0)

    i result:

    i need check hide isn't null or blank, can't seem so.

    the column set this:

    why happening? how can resolve it?

    it looks have funny character in data. can see ascii value of first character in hide using ascii():

    select ascii(left(hide, 1)) location_room;

    or perhaps:

    select ascii(left(ltrim(rtrim(hide)), 1)) location_room;

    sql sql-server sql-server-2008

    android - Weird AdMob javascript errors over wifi after 1-2 minutes -



    android - Weird AdMob javascript errors over wifi after 1-2 minutes -

    my problem when i'm using wifi , i'm trying load ads on android app javascript errors (scroll downwards bit log). if haven't used tablet hours , connect wifi can see ads 1-2 minutes, error show 1 time again. if friend creates wifi 3g connection ads fine. can help me out? tablet device

    device info

    build.board: ebm7000nbd

    build.bootloader: unknown

    build.brand: mid

    build.cpu_abi: armeabi-v7a

    build.cpu_abi2: armeabi

    build.device: ebm7000nbd

    build.display: v1.0.5.jro03c.user.root.20131223

    build.fingerprint: mid/ebm7000nbd/ebm7000nbd:4.1.1/jro03c/eng.root.20131223.104152:user/release-keys

    build.hardware: amlogic

    build.host: xn-desktop

    build.id: jro03c

    build.manufacturer: yifang

    build.model: nx007hd8g

    build.product: ebm7000nbd

    build.radio: unknown

    build.serial: unknown

    build.tags: release-keys

    build.time: 1387766643000

    build.type: user

    build.user: root

    version.codename: rel

    version.incremental: eng.root.20131223.104152

    version.release: 4.1.1

    version.sdk_int: 16

    logcat

    10-06 17:00:14.411 i/ads (7302): starting advertisement request. 10-06 17:00:14.411 i/ads (7302): utilize adrequest.builder.addtestdevice("63edfd38b0ac9b029479f0456399e7c9") test ads on device. 10-06 17:00:14.671 e/ads (3742): js: <error> (https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.js:111) 10-06 17:00:14.671 e/web console(3742): <error> @ https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.js:111 10-06 17:00:14.681 e/ads (3742): js: <error> (null:1) 10-06 17:00:14.681 e/web console(3742): <error> @ null:1 10-06 17:00:15.061 d/dalvikvm(7302): gc_concurrent freed 314k, 54% free 7081k/15367k, paused 11ms+4ms, total 41ms 10-06 17:00:15.331 i/wpa_supplicant(3902): [ctrl_iface]wlan0: signal_poll 10-06 17:00:18.341 i/wpa_supplicant(3902): [ctrl_iface]wlan0: signal_poll 10-06 17:00:18.831 w/activitymanager(3425): activity destroy timeout activityrecord{424d34b0 com.gsoft.appinstall/.main} 10-06 17:00:19.691 v/tabletstatusbar(3499): setlightson(true) 10-06 17:00:21.341 i/wpa_supplicant(3902): [ctrl_iface]wlan0: signal_poll 10-06 17:00:22.291 d/audio_hw_primary(2374): out_standby(0x43e19238) 10-06 17:00:22.291 d/audio_hw_primary(2374): do_output_standby(0x43e19238) 10-06 17:00:22.291 v/audio_hw_primary(2374): ~~~~ do_output_standby().... phone call pcm_close() ##########8 10-06 17:00:22.711 d/dalvikvm(7325): gc_concurrent freed 616k, 28% free 9079k/12551k, paused 14ms+6ms, total 106ms 10-06 17:00:22.711 d/dalvikvm(7325): wait_for_concurrent_gc blocked 81ms 10-06 17:00:22.831 d/dalvikvm(7325): gc_concurrent freed 61k, 21% free 10006k/12551k, paused 4ms+4ms, total 76ms 10-06 17:00:22.841 d/dalvikvm(7325): wait_for_concurrent_gc blocked 68ms 10-06 17:00:24.351 i/wpa_supplicant(3902): [ctrl_iface]wlan0: signal_poll 10-06 17:00:24.611 w/ads (7302): there problem getting advertisement response. errorcode: 0 10-06 17:00:24.621 w/ads (7302): failed load ad: 0

    i break out 2 of discrete tests help narrow or solve issue.

    step 1: observe behavior on wifi devices vs. 3-4g cellular. if code working fine on cellular devises , behaving belligerently on wifi, network issue associated signal strength or access. if other way around still networking issue. may need create adjustments code involving network management. see here more information.

    step 2: compare logs on devices working 1 failing , see differences tell you.

    javascript android admob wifi 3g

    exec - Using PHP and calling sqlcmd -



    exec - Using PHP and calling sqlcmd -

    i've been wracking brain on in trying phone call sqlcmd in php (iis/windows) i'm @ finish loss why it's not working.

    code:

    $sql = 'sqlcmd -s '.$servername.' -d '.$databasename.' -u '.$username.' -p '.$userpassword.' -q "exec generateinstallscript 123456890" -o c:\temp\sqlscripts.sql'; shell_exec($sql);

    the code runs nil gets generated in

    c:\temp

    folder. tried running manually start / run , runs without issues. tried exec($sql), using total absolute path sqlcmd, tried calling cmd.exe , sqlcmd far nothing.

    i added iusr total , users total permission folder create sure it's not permissions iis still nothing.

    i used proc mon see if tell me , i'm not seeing related sqlcmd, cmd, or php.exe (that lead me reason why - entries show standard phone call entries).

    i've done extensive amount of searching php , calling sqlcmd seems people phone call batch file sqlcmd in it. can't here guidance appreciated!

    here's possible idea, utilize batch script have work done this:

    sqlcmd.bat

    @echo off cd /d "c:\program files\microsoft sql server\100\tools\bin\" sqlcmd -s %1 -d %2 -u %3 -p %4 -q "exec generateinstallscript 123456890" -o c:\temp\sqlscripts.sql

    then phone call batch script using php this:

    test.php

    <?php $servername = 'xyz'; $databasename = 'xyz'; $username = 'xyz'; $userpassword = 'xyz'; shell_exec("sqlcmd.bat $servername $databasename $username $userpassword"); echo 'done'; ?>

    php exec shell-exec sqlcmd

    vs unit testing framework - TFS Test runs reporting inconsistent count of tests run each build -



    vs unit testing framework - TFS Test runs reporting inconsistent count of tests run each build -

    using microsoft.teamfoundation.build.activities.runagiletestrunner activity shipped vs2013rtm, have unit tests set this:

    when run these builds, tests run fine, there different results in count beingness reported every time. not counts different between builds, build summary page given build run consistently shows different counts of tests actual test results (.trx) file.

    i tried microsoft.teamfoundation.build.workflow.activities.runtests activity, , same issues test results described above. however, able utilize runteststestcompletedeventargs write build message of name of test followed result, , when see same number of tests run each time, means wrong summary study and/or published results (right? right???):

    also, have 2 assemblies 'tests' in name picked filter, know aspect working because bin folder on build box have same size on disk among of different runs produce different results.

    so, going on these numbers? doing wrong in build definition or on build box causing this?

    tfs vs-unit-testing-framework

    swing - Java - Pac-Man - GUI - Drawing Graphics issue, and general tips for an aspiring programmer -



    swing - Java - Pac-Man - GUI - Drawing Graphics issue, and general tips for an aspiring programmer -

    i making pac-man , i'm having problem drawing graphics on frame, when draw point image looks game of snake, tried putting drawing methods background , char both in render method, point image flickers

    what looks like, sense free ignore random face within joke.

    also first game tips on structure, pointers on doing right (if anything) , i'm doing wrong, , general tips extremely helpful!

    also aware have couple unused methods

    code: package game; import graphics.map; import java.awt.borderlayout; import java.awt.canvas; import java.awt.color; import java.awt.container; import java.awt.dimension; import java.awt.font; import java.awt.graphics; import java.awt.insets; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.image.bufferedimage; import java.io.file; import java.io.ioexception; import javax.imageio.imageio; import javax.swing.jbutton; import javax.swing.jframe; public class main extends canvas implements runnable{ private static final long serialversionuid = 1l; //not sure why wanted me this, maybe inquire bender, or google later public static boolean running = false; public static int height = 800; public static int width = 600; public static int posx = 50; public static int posy = 50; public static final string name = "pac man alpha 1.4"; private static final double speed = 1.2; public input input; static bufferedimage background = new bufferedimage(width, height, bufferedimage.type_int_rgb);; static bufferedimage pacman = new bufferedimage(width, height, bufferedimage.type_int_rgb);; static bufferedimage settingsbackground = new bufferedimage(width, height, bufferedimage.type_int_rgb);; static bufferedimage level1 = new bufferedimage(width, height, bufferedimage.type_int_rgb);; static bufferedimage level2 = new bufferedimage(width, height, bufferedimage.type_int_rgb);; static bufferedimage points = new bufferedimage(width, height, bufferedimage.type_int_rgb);; static bufferedimage point = new bufferedimage(width, height, bufferedimage.type_int_rgb);; static jframe frame; private input keypress = new input(); private map map; private static boolean charloaded = false; public static boolean main_menu = true; public static boolean game = false; public static boolean level1test = true; public static boolean level2test = false; public static boolean level3test = false; public static boolean level4test = false; static boolean drawn = false; public static boolean key_down; public static boolean key_up; public static boolean key_right; public static boolean key_left; //private screen screen; jbutton startbutton = new jbutton("start"); //start jbutton settingsbutton = new jbutton("settings"); //settings jbutton exitbutton = new jbutton("exit"); //exit public main() { setminimumsize(new dimension(width , height )); setmaximumsize(new dimension(width , height )); // keeps canvas same size setpreferredsize(new dimension(width, height)); frame = new jframe(name); if(main_menu == true && game == false){ buttons(frame.getcontentpane()); } frame.setlayout(new borderlayout()); frame.setdefaultcloseoperation(jframe.exit_on_close); // ends programme on // close frame.addkeylistener(new input() ); frame.add(this, borderlayout.center); frame.pack(); // keeps size right frame.setresizable(false); frame.setvisible(true); this.addkeylistener(keypress); } public static void main(string[] args) { seek { background = imageio.read(new file("res\\background.png")); pacman = imageio.read(new file("res\\pacmansprites.png")); settingsbackground = imageio.read(new file("res\\background.png")); level1 = imageio.read(new file("res\\level1.png")); //level2 = imageio.read(new file("res\\level2.png")); point = imageio.read(new file("res\\points pacman.png")); } grab (ioexception e) { } running = true; new main().start(); } public void run() { long lasttime = system.nanotime(); double nspertick = 1000000000 / 60d; long lasttimer = system.currenttimemillis(); double delta = 0; int frames = 0; int ticks = 0; while (running == true) { long = system.nanotime(); delta += (now - lasttime) / nspertick; lasttime = now; boolean render = false; while (delta >= 1) { ticks++; tick(); delta -= 1; render = true; } seek { thread.sleep(3); //keep frames going high } grab (interruptedexception e) { e.printstacktrace(); } if(render == true){ frames++; render(); } if (system.currenttimemillis() - lasttimer >= 1000) { lasttimer +=1000; //system.out.println("frames: " + frames + " ticks: " + ticks); frames = 0; ticks = 0; } } } public synchronized void start() { new thread(this).start(); run(); } public synchronized void stop() { running = false; } public void tick() { if (key_up) posy -= speed / 2; if (key_down) posy += speed; if (key_left) posx -= speed / 2; if (key_right) posx += speed; } public void render() { drawn = false; if(main_menu == false && game == true) { drawmap(); drawchar(); } else if(main_menu == false && game == false) { graphics g = getgraphics(); { g.drawimage(settingsbackground,0,0,getwidth(),getheight(),null); g.dispose(); } } else { graphics g = getgraphics();{ g.drawimage(background,0,0,getwidth(), getheight(),null); g.dispose(); //kill } } } public void drawmap(){ if(level1test == true){ graphics g = getgraphics(); { g.drawimage(level1,0,0,getwidth(),getheight(),null); g.dispose(); } } if(level2test == true && drawn == false){ graphics g = getgraphics(); { g.drawimage(level2,0,0,getwidth(),getheight(),null); } g.dispose(); } drawn = true; } public void drawchar(){ //drawmap(); graphics g = getgraphics();{ g.drawimage(point,posx,posy,20, 20,null); g.dispose(); revalidate(); } } public void begin() { if (key_up) system.out.println("up"); if (key_down) system.out.println("down"); if (key_left) system.out.println("left"); if (key_right) system.out.println("right"); } public void loadmap(){ if(!drawn && level1test){ }else if(!drawn && level2test){ //draw 2nd map here }else if(!drawn && level3test){ //draw 3rd map here } } public void buttons(container pane) { pane.setlayout(null); startbutton.addactionlistener( new actionlistener() { public void actionperformed(actionevent ae) { main_menu = false; game = true; frame.remove(startbutton); frame.remove(settingsbutton); frame.remove(exitbutton); frame.revalidate(); drawmap(); system.out.println("start button clicked"); } } ); settingsbutton.addactionlistener( new actionlistener() { public void actionperformed(actionevent ae) { main_menu = false; game = false; frame.remove(startbutton); frame.remove(settingsbutton); frame.remove(exitbutton); frame.revalidate(); frame.repaint(); system.out.println("settings button clicked"); } } ); exitbutton.addactionlistener( new actionlistener() { public void actionperformed(actionevent ae) { system.out.println("exit button clicked"); system.exit(0); } } ); pane.add(startbutton); pane.add(settingsbutton); pane.add(exitbutton); insets insets = pane.getinsets(); dimension size = startbutton.getpreferredsize(); startbutton.setbackground(new color(0, 0, 0)); startbutton.setforeground(color.cyan); startbutton.setfocuspainted(false); startbutton.setfont(new font("calabri", font.bold, 16)); settingsbutton.setbackground(new color(0, 0, 0)); settingsbutton.setforeground(color.red); settingsbutton.setfocuspainted(false); settingsbutton.setfont(new font("calabri", font.bold, 16)); exitbutton.setbackground(new color(0, 0, 0)); exitbutton.setforeground(color.yellow); exitbutton.setfocuspainted(false); exitbutton.setfont(new font("calabri", font.bold, 16)); startbutton.setbounds((width - 125) + insets.left, 10 + insets.top, size.width + 50, size.height + 10); settingsbutton.setbounds((width - 125) + insets.left, 55 + insets.top, size.width + 50, size.height + 10); exitbutton.setbounds((width - 125) + insets.left, 100 + insets.top, size.width + 50, size.height + 10); } }

    getgraphics not how custom painting done. should, in case, override paint method, , create sure phone call super.paint before doing custom painting.

    getgraphics returns graphics context lastly used paint component, discarded on next paint cycle, null or no longer used component

    remember, painting uses "painters canvas" approach, is, painting in physical canvas, when paint it, paint on there, not erasing it.

    now, if override paint, find have flickering problem. because canvas not double buffered

    to solve this, should consider user bufferstrategy, allows not generate multiple buffers paint to, take command of paint process itself

    just don't forget clear each buffer before paint it...

    java swing canvas awt

    gzip - Java ZipException: invalid distance too far back only on Windows -



    gzip - Java ZipException: invalid distance too far back only on Windows -

    i next error

    java.util.zip.zipexception: invalid distance far

    i downloading compressed file ftp server using edtftp.jar. doing that:

    gzipinputstream unzipped = new gzipinputstream(new bytearrayinputstream(downloadfileasstream(ftpfile).tobytearray())));

    when running programme on mac works fine. testing jar or build project in eclipse on windows machine result in error listed above.

    both machines running java 7 update 37. hint on stackoverflow corrupted archive file, since mac can extract file should not reason. 7zip on windows not show error while extracting file.

    any thought can solve issue on windows? or why happens on windows machine?

    java gzip

    c# - Binding Data text field, Data value field to asp:Dropdownlist -



    c# - Binding Data text field, Data value field to asp:Dropdownlist -

    i have created helper function bind drop downwards list in asp.net. see function:

    public void bindddl(string query, dropdownlist ddl) { list<issuetype> obj = new list<issuetype>(); issuetype iss = new issuetype(); iss.deptid = 1; iss.issue = "sss"; iss.issuetypeid = 4; obj.add(iss); //balissue bl = new balissue(); //list<issuetype> objsource = null; //objsource = bl.bind_issuetypes(query); ddl.datasource = obj; ddl.datavaluefield = convert.tostring(obj[0]); ddl.datatextfield = convert.tostring(obj[1]); ddl.databind(); }

    in way if send query name , dropdownlist id function, drop downwards should binded list of issuetype entity, can see properties of issuetype in code.

    but not able set datavaluefield , datatextfield correctly. every time saying index out of range.

    datavaluefield , datatextfield should names of field in collection, not values collection.

    ddl.datasource = obj; ddl.datavaluefield = "issue"; //example take needed ddl.datatextfield = "issuetypeid"; //example take needed ddl.databind();

    the exception thrown because in collection have 1 item, seek set sec item(not exist) in datatextfield. not relevant if prepare code.

    c# asp.net

    ruby - Trying to define a method within a method within a class -



    ruby - Trying to define a method within a method within a class -

    i'm trying spec pass , i'm receiving error, "undefined method `first_word' "inferno":string"

    i have defined 'first_word' method, within class method 'title'. i'm having problem determining how can phone call 'first_word' method on string within class method 'title'.

    the spec:

    describe 'title' 'should capitalize first letter' @book.title = "inferno" @book.title.should == "inferno" end

    it 'should capitalize every word' @book.title = "stuart little" @book.title.should == "stuart little" end describe 'should capitalize every word except...' describe 'articles' specify 'the' @book.title = "alexander great" @book.title.should == "alexander great" end specify 'a' @book.title = "to kill mockingbird" @book.title.should == "to kill mockingbird" end specify 'an' @book.title = "to eat apple day" @book.title.should == "to eat apple day" end end specify 'conjunctions' @book.title = "war , peace" @book.title.should == "war , peace" end specify 'prepositions' @book.title = "love in time of cholera" @book.title.should == "love in time of cholera" end end describe 'should capitalize...' specify 'i' @book.title = "what wish knew when 20" @book.title.should == "what wish knew when 20" end specify 'the first word' @book.title = "the man in iron mask" @book.title.should == "the man in iron mask" end end

    my code:

    class book attr_accessor :title def initialize @title end def title=(str) def first_word self[0,1].capitalize + self[1,-1] end cap_except = ["over","and","of","a","to","the","an","or","but","if","else","in"] str = str.split.map {|w| cap_except.include?(w) ? w : w.capitalize}.join(" ").first_word @title = str end

    end

    you're calling first_word on string, similar "foo".length.

    you haven't defined first_word on string class.

    you have defined method phone call with string, e.g., first_word("foo").

    unrelated, why trying nest method definitions this?

    ruby class methods specifications

    c - Data Structure: Request Counting Task -



    c - Data Structure: Request Counting Task -

    i looking @ programming task , found next question. problem statement: list of professionals start_time , end_time given. list of end_tasks tasks given. find number of tasks each professional can within timeframe.

    inputs: requests: [4,2,5,3,1], start_time: [2,5], end_time: [5,6].

    output: 4 1

    explanation: since professional_1 has time_frame 2 5, can perform 4 tasks(4,2,5,3) , professional_2 has time frame 5 6, , can 1 task(i.e., 5)

    program code:

    #include <stdio.h> void count_requests(int *requests, int requests_length, int *pro_start, int pro_start_length, int *pro_end, int pro_end_length) { int i,j,req,start,end,task; for(i=0;i<pro_start_length;i++){ start=*(pro_start+i); end=*(pro_end+i); task=0; for(j=0;j<requests_length;j++){ req=*(requests+j); if(req>=start && req<=end){ task=task+1; } } printf("%d\n",task); } }

    the nested for-loop here takes more 30 seconds run when inputs of order 50000. missing here?

    right you're iterating through entire list of inputs each worker. instead, can sort list of inputs , perform 2 binary searches each worker determine indices of tasks within bounds

    sortedinputs = sort(inputs) for(i=0;i<pro_start_length;i++){ startindex = binarysearch(sortedinputs, *(pro_start+i)); endindex = binarysearch(sortedinputs, *(pro_end+i)); printf("%d\n",endindex - startindex) }

    you've got initial o(n*log(n)) cost front end when sort inputs, cost of each task count o(log(n))

    if instead you've got fixed set of workers , stream of requests (so it's not practical sort requests) create segment tree of workers, , each request retrieve set of workers can fulfill request. has same complexity - o(n*log(n)) create segment tree, , o(log(n)) query tree each request.

    c algorithm data-structures

    solaris - Finding capped memory of a non global zone -



    solaris - Finding capped memory of a non global zone -

    is there way find capped memory of solaris non global zone non global zone (given rcapd disabled)

    solaris zones

    c# - Unprocessed items in queue modify DB state - how do I handle concurrent requests for data? -



    c# - Unprocessed items in queue modify DB state - how do I handle concurrent requests for data? -

    sorry if title little unusual - wasn't sure how condense problem one-liner appropriately!

    basically, have queue of messages on scheme a, of received through socket several instances of scheme b , processed 1 one. of these messages modify info in scheme a's database, represents 'global state' (i.e. state of scheme , of scheme b instances).

    at same time, instances of scheme b can send 'state request' messages queue, which, when processed, homecoming info scheme a's database requesting scheme b farther processing. operations on 1 instance of scheme b depend on state of 1 or more other instances of scheme b.

    obviously, there's info integrity issue here. 'state request' message processed , info returned, there number of unprocessed messages in queue modify global state, rendering returned info unreliable.

    after lot of thinking, i'm pretty sure problem cannot solved while global architecture remains way is. there way can restructure overall scheme such no longer problem?

    thanks!

    one general approach create single info path through system, there fixed upstream-to-downstream info flow, , downstream state can lag upstream, there's no chance indeterminate ordering (race conditions).

    towards end, possible rearchitect that:

    1) pushes (broadcasts) each b, rather b polling state. identify, polling introduces 2nd path info , allows race conditions.

    2) "some ops on 1 b instance depend on other bs" sounds req-reply communicate between bs, introduces alternate info paths , indeterminism. bs peers, there's no obvious upstream among them. but- info striped across bs such piece of data, 1 b master pushes updates concerning datum other bs? example, b1 master a-m, , b2 n-z. piece of info "q", info flow -> b2 -> b1 , deterministic, scheme of record state of system.

    if bs coupled - illustration if a-m info depends on n-z data, sequence numbers (assigned on incoming messages) can help distinguish newer older states , prevent old info overwriting newer. details depend on details of b-b interactions.

    any eurekas yet?

    c# .net producer-consumer

    android - Restriction of Google OAuth call to Google Play unique name -



    android - Restriction of Google OAuth call to Google Play unique name -

    background

    reading these articles http://developer.android.com/google/auth/http-auth.html , http://android-developers.blogspot.cz/2013/01/verifying-back-end-calls-from-android.html , other responses on oauth 2.0: client id , client secret exposed, security issue? , client secret in oauth 2.0 realized not worth authorizing rest api using token received google oauth. can false (doing own app , getting token) attackers can client id decompiled apk. see way of securing app utilize app's unique name on google play.

    question

    is possible resstrict phone call google obtain security token app's unique name on google play?

    get oauth token google.

    rule of security don't invent own security. utilize established library handling of security.

    rule of security don't save (persist) security tokens in program. 1 when need it.

    return googleauthutil.gettoken(mactivity, "me@example.com", "oauth2:http://www.example.com/data/");

    http://developer.android.com/google/auth/http-auth.html

    android api security oauth

    routing - User defined routes in Rails -



    routing - User defined routes in Rails -

    there lot of info on routing in rails. must missing something, can't seem find illustration of rails application allows dynamically defined user specific routes.

    for example, application hosted at:

    www.thing.com

    ... , serves out user generated content.

    i'd give user alternative define suffix let's them share customized url content. example, if user 'joe' generates auto info might want create avilable via joescars at:

    www.thing.com/joescars

    maybe later decide want serve out under 'carsbyjoe' at:

    www.thing.com/carsbyjoe

    i can handle limiting suffixs valid. there rails way codify kind of dynamic routing?

    there way this. in config/routes file add together route says get '/:user_route' => 'somecontroller#someaction'. you'll have set @ bottom because routes matched top bottom , match things /users or other routes you'll want directed elsewhere.

    then, in controller can access params[:user_route] show appropriate content. there number of ways store custom content in database, depending on needs. might have model representing these custom routes customroute.find_by_route(params[:user_route]), or maybe each user have custom route user.find_by_route(params[:user_route]).custom_page , each user has 1 custom_page.

    ruby-on-rails routing routes