Thursday, 15 March 2012

Using orientDB ETL json transform -


Anyone has examples of Oriented DB Atom transformers with many transformations or something that can create class identifier on the fly, For example, if you want to create organization organizations and ID may be a hash by the name of the organization, then it is important that if we are importing JSN, then it is not exactly what we want in destination

your ETA What about the block in the configuration file code ? You can use it in the start step, so you can change the ID column in your .csv input file. This is not an ideal solution I agree with.


ios - How to control the transition between 2 UIView states using a swipe gesture? -


I want to be able to swipe transition right gestures between the two states of a UIView with a swipe left. Basically I want to start increasing the height of the scene because the user starts swiping to the left and becomes "shrinking" when it swipe. I can easily animate with CAN Animation between the two states, but what I want is ideal that it is the signal to control the transition rather than giving it "duration". So essentially mapping the extension / shrinkage of the boundary height of the signal ... I am doing a terrible thing to explain to myself, but Apple is all this time.

Here's how it appears in your custom UIView moment:

  class CustomUIView: UIView {@IBOutlet bridesmaid swipeView: UIView! Var must have Except Expand Animation: Boole = True; Var needs extract shank animation: Bool = true; Required init (coder aDecoder in: NSCoder) {super.init (Coder: aDecoder) NSBundle.mainBundle () loadNibNamed ( "CustomUIView", the owner himself, option: zero). SwipeView.backgroundColor = UIColor.grayColor () self.addSubview (Self.swipeView) func performAnimation (Transansform: CATransform3D, toTransform: CATransform3D, duration: CFTimeInterval) {var animation: CABasicAnimation = CABasicAnimation (keyPath: "transform") animation. = self var transformView = conversion animation .fromValue = NSValue (CATransform3D: fromTransform) animation.toValue = NSValue (CATransform3D: toTransform) animation.duration = term self.swipeView.layer.addAnimation (animation, forKey: zero) self.swipeView.layer .transform = toTransform} expandView () {function if shouldExecuteExpandAnimation {performAnimation (CATransform3DIdentity, toTransform: CATransform3DMakeScale (1, 4, 1), duration: 0.1) executeShrinkAnimation = true; } ExxuteExpandAnimation = false; } Func shrinkView () {ifxexuteShrinkAnimation {executeAnimation (CATransform3DMakeScale (1, 4, 1), toTransform: CATransform3DMakeScale (1, 1, 1), duration: 0.1) shouldxecuteExpandAnimation = true} Chahiaakseksrenkanimeshn = false; } Func manageViewWithGesture {switch gestureRecognizer} {switch gestureResourceDescriptions {Case} UISwipeGestureRecognizerDirection.Right: expandView () Case UISwipeGestureRecognizerDirection.Left: shrinkView () Default: break}}}  

< Div class = "post-text" itemprop = "text">

As Aaron says, you can not get intermediate value with a swipe. If nothing happens, then it seems to be a fire, you have to use the pan gesture identifier or your own custom gesture identifier. For this, it is possible that you will be able to interpret the translation values ​​that you get from a standard pan-echchure identifier.

Then you can use those values ​​to change the animation from start to finish manually. I have a project on Gitbab which makes you different from ending the animation using the slider using the slider.

You can customize that approach to running an animation, because the user leaves a pan gesture.

View this link:


64bit time_t in Linux Kernel -


I've compiled kernel 3.19.1, but still have problem with time_t just simple program with cout & lt ; & Lt; Sizeof (time_t); Returns the size of 4 bytes, not 8 bytes, as I intend, should I switch to a particular option during Menukonfig?

Currently time_t is just tall kernel In: See definition of type. So if your CPU has long type 32-bit long, time_t is 32-bit too long Basically, if you have 32-bit CPU - long If the type is on your system then 32-bit is long if you have 64-bit CPU - long type is 64-bit long.

If you need your own 64-bit type - just use long time . If you want the kernel time API to work with the 64-bit long type time_t - this is a bit hard (to change kernel sources). For example, taking a look apart, you may be interested in reading the following link:

[2]

[3]


to longer

UPDATE

( __divdi3 etc with issues)>.

Now that you have changed the size of the time_t to 64-bit, any code using time_t is used for 64-bit operations. __detail3 means: div IIN operation d ouble i on ntegers 3 < / Strong> stands for the count of operands (e.g. 1 = 2/3 ). See for details so this operation is not clearly implemented for your platform. You should either apply it to yourself (in the kernel code) or by any means use the code from GCC Next link can help you:

[ 1]

[2]

[3]


python 2.7 - Find the start and ending sector index of a file in Windows 7 -


Hi, I want to find a real physical start and end indicator of a file on Windows 7.

Hi. Is there any operating system command that can help me find out that a dragon script or C program will also solve the purpose. Thanks for any help or suggestion.


Getting the value of a variable inside a while statement - PHP -


I can not find the value of a variable inside a loop here my code is:

  Function Check Login ($ username, $ password) {global $ dbh; Global $ queryPassword; $ Query2 = $ dbh- & gt; Query ("Choose WHERE user name from employee = '$ user name' and 'password` =' $ password ';"); $ Query2 - & gt; Settep Mod (PDO :: FETCH_ASSOC); While ($ line = $ query2-> fetch ()) {$ queryUsername = $ line ['username']; $ QueryPassword = $ line ['password']; } If (password_verify ($ password, $ queryPassword)) {echo ' 

no There may be problems in keeping it up

  $ stmt = $ dbh-> Ready (such as private, or preserved)  

and its more like it Also change to protect. "Choose from employee employee accounts WHERE User Name =: User and `Pasward` = pass; $); $ Stmt-> Execution (array (': user' = & gt; $ user name, '' pass' = & gt; $ password)); $ Query2 -> Settate mode (PDF :: FETCH_ASSOC);

Thus user input is escaped.


Remove a file that was previously added from Shared With Me to My Drive -


Google Drive has a good feature: someone can add a file or folder to my drive I've shared.

Enter image details here

Then I will call this file Anyway, I can remove from my disk anyway (note that if I delete the shared file in the web version it will not go to the trash)

However, I'm having a 403 forbidden error while trying to delete this file using the Google Drive API (whose Due insufficient permissions Not because I am not the owner of the file). Therefore, as no one can see, this is not a simple removal request. How can I apply this functionality?

Add to my drive change the parent store for the item in question, to change it, you delete Instead of wanting to unchanged the item.

Use about.get call about retrieving my drive ID, then delete that ID from the parent list in the file resource file folder. Update the file with a new list of parents


No CollaboratorJoinedEvent in Google Realtime after CollaboratorLeftEvent triggered by inactivity -


In the Google Realtime API, after a period of inactivity, a collaborative laugh event has begun for the local collaborator. However, on the awareness or on subsequent activity, no ColaboratorJoinedEvent appears to be triggered.

Is this a realtime bug, or maybe there is a hope / recommended way to deal with this behavior? If there is a local user (i.e., the ISIE is true), then should the associate Leftpiece be ignored?


python - django admin custom template for model redirection -


Suppose a curious question I have a module / app, which says that a model that has a model, Too. " Now I've registered admin.py this model Now when I log in to admin and look at this model, I see the general update, Delete option in the admin template.

Is it possible that when I look at this model in the admin and click on that model then it redirects to the other URL in the URL and it is displayed in another template and I have some I can also see what I like.

I'm sorry if this is misleading. What do I want that I want to show an admin's property model, add, and delete another custom template and it should be redirected to the URL defined in the module's urls.py

. .)

This can be done by expanding your base get_urls () method

< / Div>

String reversal in C++ getting 'Segmentation fault (core dumped) error -


This gives a 'segmentation fault' (core dump) error after printing the strings I mentioned below Could?

  #include & lt; Iostream & gt; #include & lt; String & gt; # Include & lt; Cstdio & gt; using namespace std; Zero print (char * str) {if (* str) {print (str + 1); Cout & lt; & Lt; * Str; }} Int main () {char * str; Cin & gt; & Gt; Str; Print (STR); Cout & lt; & Lt; Endl; Return 0; }  

Unspecified non-static local variable has uncertainty The price, and the reality appears to be random, without the initialization of it, it is used, which is one of the most common causes of the crash.

The problem is that you have an indicator, but it does not indicate anywhere when you use it to read the input, input stream cin in a random memory Will write on the place.

The solution is not to use the character indicator for the string, but the square.


If you is to use indicators, then you have two solutions: either declare the string as an array, or Allocate memory using the new operator. However, if you take the precautions, as much as you have allotted, you will write out of the limit and then once is undefined behavior .


data is not saved in database in rails -


I am creating a simple application and creating a simple application where a user can add a term and then add comments to that post is. Code for model

  # = schema information # # Table name: # # id: comments # # integer null, primary key # issue_id: integer # content: text # created: date time # Updated_at: datetime # class comment & lt; ActiveRecord :: Base is_to: problem ending  

is the code for the controller

  class commentsControler & lt; ApplicationController def @issue = Issue.find (params [: issue_id]) @comment = @ issue.comments.create (comment_params) If @ comment.save redirect_to: admin = & gt; 'Issues',: verb = & gt; The 'index' and 'new' end-end DEF end up making personal def commenter on the parameters. Request (comment). Pure (: content) end-end  

The Ben Controller has been added to issue the following support:

  has_many: comments  

When I enter the data in the form, the rail does not save the data in the database, instead it shows me

When you declare methods in Ruby Class, the final definition of the law overrides any previous declaration whose only method is signature (method name and title). A hundred).

You have two forming methods, with one argument and another one empty. Because the second one is empty, it is being run instead of the first, where all your arguments are.


sql server - Connection to the remote SMTP host -


Reduce story: One of the drivers started failing in raids in a couple of days. We changed the driver and after rebuilding it, we were not able to start the SQL server. So we re-installed it and restored all of our DB from backup.

Now, before the hard drive crash and SQL was reinstalled, Win 2008 R2 was able to connect all our custom programs on the server to remote SMTP hosts (like smtp.gmail.com) and email Send us also use SQL database mail and we reconfigure it, although we are still receiving massages like "Can not connect to the mail server".

Is some Windows services uninstalled during SQL and now connect to remote SMTP host where should I look and what should I do?

OK, I found my error in the process of restoring the server I set incorrectly on an NIC And DNS was unable to access ...


for loop - R: summation of rows in a data frame -


What do I want to do: I have a data frame where the first columns are wired, and the remaining columns are numeric values Applying different factors in the filled rows, I want to add the first three rows in the three lines in the group of three, such as line 1 * x + line 4 * y, line 1 * x + row 5 * y, line 1 * X + row 6 * y, then row 2 * x + line 4 * y, and so on A row3 * x + row6 * y then i want to do the same thing again, but with different values ​​for x and y, and then for the x and y, with the different values ​​the third time. Then I want to do the same with 1-3 and 7-9 lines, then with 1-3 and 10-12 The correct sequence is important. I want to write all this in the form of rows in a new data frame.

I also want to add the related strings of the first column, add a marker so that I know which Circulation is done, and then a counter per counter counter. I want to add it to my data frame results, so I can see which row has come from

What do I have to do: After extensive magic with the loops, this code is finally what I want That does, but it's ugly, and it's slow to slow with my actual data (the actual data frame has 1762 columns).

  numbers & lt; - data.frame (repeat (10, sample (1: 100,12, delegate = TRUE))) ID & lt; - data.frame (id = c ("d1", "D2", "D3", "v11", "v12", "v13", "v21", "v22", "v23", "v31" , "V32", "v33")) & lt; - cbind (ID, number) result & lt; - data.frame () data.raw & lt; - Data [, - 1] Story & lt; - data.frame () q = 1 ################### Lines with 1-3 rows 4-6 k = 1 # for my constant counter (1: 3 i) {for (4: 6 in j) {Results & lt; Legend [Q1] & lt; - Paste (data [i, 1], data [j, rbind (result, 0.99 * (data; raw [i,]) + 0.01 * 1], "01", k, sep = "_") q = q + 1 k = k + 1}} for k = 1 (i in 1: 3) {for (j in 4: 6) {result & Lt; - Legend [Q1] <- Paste (data [i, 1], data [ja, rbid id (result, 0.95 * (data. Raw [i,]) + 0.05 * (data. [Ja]] 1], "05", k, sep = "_") q = q + 1 k = k + 1}} for k = 1 (i (1: 3)) {for (in j 4: 6) {Results [1] & lt; - Paste (data [i, 1], results & lt; - rbind (result, 0.9 * (data.raw [i,]) + 0.1 * (data. Raw [ Ja]] Legend [q, 1] data [j, 1], "10", k, sep = "_") q = q + 1 k = k + 1}} #################### For lines 7-9 k = 1 with 1-3 rows (i in 1: 3) {for (j at 7: 9) ) (Results [1] & lt; - Paste (data [i, 1] (results, 19.9 * (data. Draw [i,]) + 0.01 * (data. And [j,]) Legend [Q (I, 1), "01", k, sep = "_") q = q + 1 k = k + 1}} k = 1 (1: 3) for (1: 3) I: 9) {Results & lt; - rbind (Results, 0.95 * (data. Raw [i,]) + 0.05 * (data. Raw [J,]) Legend [Q1]  

What do I have to do: It is possible for some beautiful, short, and sharply to take the place with loops, but where I am lost here I feel that I < Code> applicable Could use some improvement, but I am not able to fully understand the concept yet work, and then it gets more complicated all the descriptive wires.

Can anyone tell me in the right direction?

As the first step, instead of working with the data frame, simply convert them to matrix

  Results   Results & lt; -c () data. Raw & lt; - as.matrix (data [, - 1]) at the top  

It should be sharpened.


javascript - ng-class apply outside of ng-repeat? -


  और lt; ul class = "लिस्टिंग सूची-एसएम छोटा" एनजी-वर्ग = "{'विभक्त': ( Model.selections | फिल्टर: फिल्टर)। लम्बाई & gt; 0} "& gt; & Lt; li ng-repeat = "मॉडल में चयन। विकल्प | फिल्टर: फिल्टर" एनजी-वर्ग = "{हाइलाइट: selection.on}" & gt;  

क्या फिल्टर 2x (उल और एनजी-दोहराने पर) के माध्यम से डेटा को चलाने के बिना उल पर वर्ग जोड़ने का एक बेहतर तरीका है?

आप एक कॉलबैक फ़ंक्शन में फ़िल्टर बना सकते हैं और परिणाम की जांच कर सकते हैं और परिणाम के हिसाब से झंडा बदल सकते हैं।

  & lt; ul class = "लिस्टिंग-एसएम छोटा" एनजी-वर्ग = "{'विभक्त': हैरिस परिणाम}" & gt; & Lt; li ng-repeat = "मैनुअलफिल्टर में चयन (मॉडल। चयन)" एनजी-क्लास = "{हाइलाइट: selection.on}" & gt;  

और जेएस में:

  $ scope.manualFilter = function (चयन) {var परिणाम = $ फिल्टर ('फ़िल्टर') (चयन); अगर (result.length & gt; 0) {$ scope.hasResults = true; } और {$ scope.hasResults = false; }}  

swift - playerID was deprecated in IOS 8: use player -


I have this game center function that was used to watch the players. Recently I have downloaded the Xcode 6.3 - Beta 3.

This function is:

  Funk Lookup Player () {player id = match.player.map {($ 0 as! GKPlayer) .playerID} GKPlayer.loadPlayersForIdentifiers (player ID) {(player, error) - & gt; Error if error! = Zero {println ("Error in retrieving player information: \ (error.localizedDescription)") self.matchStarted = false self.delegate ?. Match match ()} {player for player in {println ("Player found: \ (Player.alias)"). Self player Player [player.playerid] = Player // use player} self.matchStarted = true GKMatchmaker.sharedMatchmaker (). FinishMatchmakingForMatch (self.match) self.delegate? .matchStarted ()}}}  

Xcode now flags a warning that says "The player was used in IIS 8: Use the player"

< P> Does anyone help me modify the code to remove the warning? I do not understand what should be changed.

Try to do this, it seems that the GCplayer is not being registered correctly

  players as player! [GKplayer] {println ("Miley Player: \ (player. Lions)") Self. Player [player.playerid] = player // user player}  

winforms - Setting selected item in F# ComboBox -


This is driving me crazy ....

I select "Selected" Windows Items of the Forms.ComboBox I tried to do everything but nothing has worked so far. I'm sure something is visible to me ...

Here I have (in F #):

  type foo = {id: int; Name: string; } Let's Fuse = [// List of Fuos] // I want comboBox to display it by default defFoo = {id = 3; Name = "defaultFoo"; } Let's CB = new combo box (cb.DataSource & lt; - foos | & Gt; List. Toure CB Displaymember & lt; - "name" cb.ValueMember & lt; - "id" cb.SelectedValue & lt; - DefFoo.id  

The last line does not work, as I tried none of the other methods (I tried SelectedItem , SelectedIndex , etc.)

I do not use F #, but I think That form needs to be present before doing compulsive work, so try using loaded or shown events:

  yourForm.Load.Add (fun evArgs -> CB Selected value & lt ; - defFoo.id)  

java - Why is sort method part of Collections instead of AbstractList? -


When the sort method works only on lists, then I feel a little bit upset by keeping it in a storage class. Should not a separate category devoted to the list? Maybe something like abstract element or list ..?

"text">

archive is an accessory category, despite all its collections, for all the collections < In addition to the method for code> list , there are specific methods for the map s, sorted map s, sortedset s, and However, archive s.

Although making a separate subsidiary for lists alone would be a justified option, using one assistant assistant, all the collections will help one place become perfect, as well as: It makes it easy for developers to remember Where are the methods, because there is only one class.

Note that starting with Java-8 you can call sort , and make it easier to find the implementation.


angularjs - Prevent angular from handling a url -


I have an angular web page in which I also have a twitter bootstrap carousel.

Arrow button with the following URL to jump to the next / previous image:

Every time I click on it, I will go to

I tried to remove every angle and just the stable version of an html page and it works fine, so I think the angular router is handling url from the # myCarousel slice.

How can I prevent it from happening?

When clicking on ARO, the URL changes in the address bar and the router handles the change that is necessary is. To apply the carousel, use the carousel instructions from Yuri-Bootstrap, or you can write ur custom function at the click of those links


mysql error after trying put in SQL -


After

I am trying to insert tables from phpmyadmin in SQL, such as:

  adding users (steam VARCHAR (35) not NULL default ', name VARCHAR (32) No NULL default', length INT not NULL default 0, unrestricted VARCHAR (32 ) No NULL default '', Due to VARCHAR (64) No NULL default ', banned SMALLINT not NULL default 0, SMALLINT leaves no NULL D Default 0, primary key (steam));  

but I am getting an error:

# 1064 - There is an error in your SQL syntax; 'VARCHAR (35) No NULL default', name VARCHAR (32) NULL default ', length' check

'matches the server version of the correct syntax that is used on line 3.

Am I doing wrong?

The value must be present in the database before entering it. So make sure that you are putting the value in the table that exists in your database.

To make a table you need to be active below given query.

  CREATE TABLE users (steam VARCHAR (35) not NULL default ', name VARCHAR (32) NULL default', length INT not NULL default 0, unrestricted VARCHAR (32) No NULL default 'VARCHAR (64) No NULL default' ', but SMALLINT is not less than zero 0, SMALLINT does not leave zero zero 0, the primary key (steam);  

After creating the table you can insert the value directly from phpmyadmin or you can do this by executing the following query Enter the user values ​​in 'Steam Value', 'User Name', '4', 'Any Unmanaged Value', 'Reason for any reason', '0 ',' 0 ');

If you want to enter a value from a php file, you will need to create a database connection; After that you can use the mysql_query () function in the value in the DB

value.

osx - Eye strain from using a Mac Book Air -


I know that this is not a question related to programming, but I think that many people in the tech community You can.

Since I started working 10 to 12 hours on my Mac Air laptop, in my left eye I was seen in the eyes. And this is just my left eye. It is a feeling of heaviness on my eye lid and sometimes there is tingling under my forehead over the eye.

I was working on the del monitor for several years and there was never any problem. Within a month of switching to Mac Air Laptop, I had to get this eye tension.

It is understandable that my left eye is one that is affecting me, seeing that I read the web page in an F pattern and most of the work is done with my left eyes.

When I am away from the computer, then go after a week like emotions, but when I return to work then only takes a day or two


Does anyone have these feelings in their eyes and what have you done to overcome the tension of eyes?

I keep my monitor on very dim light.

Do you think the strain of eyes is the result of a Mac laptop screen?

Or maybe it's a combination of age that I'm changing to 33 soon.

I have seen eye doctors and they say that my eyesight is fine. I have also tried to get drops of eyes, but this did not help much.

Any idea will help, because I suspect that stress in the eyes is just going to get worse, but I can not leave programming because this is my passion.

Thanks

Not so much is the OSX question, but before that Closes, I'll link to you, which I know is that many developers use to reduce stress. The 20/20/20 rule is also good, and there are apps that will set a reminder for you (every 20 minutes, 20 seconds to see for 20 seconds).


java - Keep cell content on one page -


I have a column, with one column. Each cell has paragraphs.

How can I stop the paragraph by splitting into two pages?

  PdfPtable table = new PdfPTable (1); // should be printed as possible table compat form .setSplitLate (wrong); // I can not set together, because the table page size may exceed / /table.setKeepTogether (true); For (Int i = 0; I & lt; 100; i ++) {// Random Text can be ~ 400 characters String Text = "AaAahAaAssaSSSSSSDDFDFFFFF"; Paragraph p = new paragraph (text); // This instruction does not work, I do not know why, because paragraphs in the cell can be printed p.setKeepTogether (right); Table.addCell (P); }  

change

  table.setSplitLate (wrong );  

in

  table.setSplitLate (true);  

In this way, your cell will not be split unless the entire cell fits on one page.


python - How can I get pycharm to NOT auto-insert a closing docstring? -


I hate anything in any IDE which includes anything which I have not explicitly told it Accordingly, I can get all the auto-complete and automatic insert, but I can not know how to kill it for the docstring. I type it by pressing "" " and space instead, in:

 " "" "" "" " 

How can I close this behavior?

Is:

 Editor> & gt; General -> Smart Keys  

Uncheck Insert Pair Quote

Add Uncheck Documentation Comment Stub Apart


raspberry pi - Source code of any version of linux operating system -


I am working on my operating system project, which is actually very difficult for me, my university has any Raspberry Pi operating The system asks for amendment I have tried surfing the net and I could not find anything. I have taken lectures given by Cambridge University.

Thanax them now I know about some kernels.

But I want to make a complete operating system at least that can behave like a terminal but keyboard, screen can support the Internet

I have established a method to get the source of the operating system as well as compile it on Linux.

I hope you find it useful too.


jsf 2 - Primefaces BlockUI blocks all with widgetvar -


I want to use the widgetware of the primaryface blockUI (at this time I use a model dialog for this). The application should be closed only when I select something (a long method calls) and should be unblocked after it is complete. But it blocks completely on first access. Make me something wrong?

When I work on table specific blocks ( block = "table" ) but I want to block the whole page.

Primefaces 5.1 & amp;

Html xmlns = "http: //www.w3.org/1999/xhtml" xmlns: h = "http://java.sun.com/jsf/html" xmlns: f = "http: //java.sun. Com / jsf / core "xmlns: p =" http://primefaces.org/ui "& gt; & Lt; H: top & gt; & Lt; Title & gt; Trial & lt; / Title & gt; & Lt; / H: top & gt; & Lt; A: Body & gt; & Lt; H: form & gt; & Lt; P: blockUI widgetVar = "block" blocked = "wrong" /> & Lt; P: dataTable id = "table" value = "# {myController.tableItems}" row = "# {data}" selection = "# {myController.selectedItem}" selectionMode = "single" var = "data" & gt; & Lt; P: ajax event = "select row" onstart = "pf ('block'). Show ()" listener = "# {mycontroller.doSomething}" incomplete = "pf ('block'). Hide ()" /> ; & Lt; P: column & gt; # {Data} & lt; / P: column & gt; & Lt; / P: DataTable & gt; & Lt; / H: form & gt; & Lt; / H: Body & gt; & Lt; / Html & gt; Bean:

  @Menzben @VivisScope enforces public final class microcontroller serializable {/ ** * * / / / Private Static Finals Long SerialVersionUID = 1L; Private listing & lt; String & gt; TableItems; Private string selected items; @PostConstruct Public Zero init () {tableItems = new ArrayList & lt; String & gt; (); TableItems.add ("test1"); TableItems.add ("test2"); } Public Zero doSomething (SelectEvent event) {System.out.println ("DO Some"); Try {Thread.Sleep (2000); } Grip (Interrupted E) E. {// TODO Auto-Generated Catch Block e.printStackTrace (); }} Select Public String Selected () {return selectItem; } Public Zero SetHeckedTime (string selected item) {this.selectedItem = selectedItem; } Public listing & lt; String & gt; GetTableItems () {return table item; } Public Zero Settables (List & lt; String & gt; Table Items) {this.tableItems = tableItems; }}  

add a id to block component Block = in attribute


Identifying the highest number in a row with Python -


I have data in three columns, so I'm trying to identify the biggest value in each row ( 1, 2,3) And also ignore the rows where the highest value is more than once, the script below will recognize the highest value in each row but I am unable to fix the other two issues. Any advice would be greatly appreciated! <3> 3 3 3 3 3 3 3 3 3 3 3 Data = open ('file.csv', 'r') rows = [] For data in line: line = [Int (each) line split ()] .append (line) data.close () for column = zip (* rows) for index, enumerate (rows) in column: print max (column)

Since all of your rows are in a list, so you loop on that list and you To find information that you want Use some built-in:

  gvalues ​​= [] for lines in rows: highest = maximum (line) match = row.count (highest) position = row.index (highest) If matching == 1: gvalues.append ((highest, position)) and: gvalues.append ((none, none))  

Once it's finished, your There will be a list gvalues ​​ containing the highest value, position toplevel for each line in it, none, any Will not Tion where more than one highest .

For example you will provide it

(none, none),

How to create a simple Lync 2013 Presence 'Kiosk'? -


Actually, we are tired of a long stretch of continuous deployment and are rundown and want to have some fun while The owner is away

On the down side, we are all SA and Net engines and there are no developers between us

> Complete links are establishing the 2013 full complex (no replacement, no infrastructure), and a lot of "cool" bonuses -With the Screen Kiosk, we want to change our very dated / out slider board which shows the departments Lync status. We can add functionality later, but firstly - just one display of the current situation is fine

We can install clients, any browser, plugins, whatever we want - these are only concepts Is a proof of and fun side project

Most Dummy Guides are for 2010, which does not seem to work

In my head, make a 'concierge' user Will be the easiest to contact Add a list to the list, and then display the contact list on the webpage, or a modified version of the customer.

Any idea where to start mixing this bad boy together? All connections will be external, no need for external use.

As a follow-up action, what we discovered was UCWA

Firstly, REST Phrases such as APIs are frightening, it was really easy to use ridiculously.

It was removed on a test IIS box, something was sorted with Oh and the next thing, we knew what we were really looking for, and now I only 34 for a seller "Concept-proof touchscreen to play with.):

Thanks for the help.


java - Skip mvn test -B in travis ci -


I am using Travis CI for the project. I want to leave the test. I have added it to .travis.yml:

  Install: MVN Clean Package Eclipse: eclipse-eclipse.pde install -DskipTests = true -Darguments = - DskipTests  

but it always runs mvn test-B . How can I avoid it?

build configuration -

to create "install" as empty command For example -


database - getting data from rows after executing query -


I am very new to DB application development, although I have VB.NET and C ++ (self-taught, somewhat intermediate). I have a query in a table adapter with two parameters (user input), which always gives a line from a table based on those two parameters. Suppose line X filters with A, B and C columns are set to A and B in my query, but it selects all the fields. Now, I want to show the value of C in one of my main form objects (the label says in this example), but I can not be able to remove it. I know that maybe this is very easy, but I've lost some of the DB codes in the forest.

[edit]

My apologies, code bit (example).

query:

SELECT Column1, Column2, Column3
Table1
WHERE (column1 = parameter1) AND (Column2 = @ Parameter2)

VB project in me:

Slow Temporary
Temporary = Me.Table1TableAdapter.queryName (Me.MyProjectDBDataSet.Table1, userinput1, userinput2)

Everything until this point Works perfectly, but this is also where I get stuck. How do I, let's say that the value of column 3 is specified, for example, the label.Text (the result will always be just one line from Table1 after running the query)?

I hope this clears it a little bit ..

  dim database database = DatabaseFactory.CreateDatabase in as dim cmd DbCommand = db.GetSqlStringCommand (query) dim SqlDataReader as IDataReader = db.ExecuteReader (cmd) through the rows of new MyObject then SqlDataReader 'DataReader as dim myObj the loop then isnot nothing ( 'query is a string containing your SQL command while sqlDataReader.Read)' column with the value 3 here 'myObj.myIntegerProp erty = CInt (IIf (Aisdianblul (Atom ( "Column 3")), 0, Atom ( "Column 3")) loop and if  

bytearray - calculating euclidean distance of 2 byte arrays java -


I have 2 main images and I want to compare them to the set of other images. I am calculating the byte array of those two images and then the image being compared with the image being compared to the 2 is being processed. It has 2 main images:

  file is upper = New file ("sweater.jpg"); Byte [] upper page = files Readelbates (upper.pet ()); File less = new file ("pants.jpg"); Byte [] Bottom Page = Files Readablebytes (low. Path ());  

Then in the loop where I treat all the images from a directory, I do the following:

  byte [] currentImage = Files.readAllBytes ( F. ToPath ()); Float interval = 0; Float difference lower = 0; For (Int i = 0; I & lt; current image. Lamp; i ++) {focus on + = (upper part [i] - current image [i]) ^ 2; Difference lower = = (bottom [i] - current image [i]) ^ 2; } Float Eclidian Distances = (Float) Math SQL (difference above); Float euclideanstance lower = (float) monastery. SCTR (interloor); If (Euclidean Dastensupter & lt; euclideanDistanceLower) {filename = filename + "Upper"; } Else {filename = filename + "lower"; }  

However, calculation of Euclidean distance with upper image works perfectly, does not work in comparison to low events. The following error appears:

  Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 55881 at org.apache.commons.io.ShapeRecognition.main (ShapeRecognition.java:54)  

Image sizes are all the same, so I really can not understand why it works for upper and lower signs? Thanks!

Update so basically the problem is that generated byte arrays are not the same size, even if the images are the same size.

Images may have the same size, about resolution (as they Both can be 800x600 pixels). But you are not comparing pictures , but files and ... do not understand images like this, whatever. Two JPG files of 800x600-size images can be 10 KB or 50 KB. It depends on image content and compression level.

What you want to do (most likely ...) is to compare pixels of images, therefore, to get the actual pixel data, you get the ImageIO , and decoded JPG files

you

  BufferedImage upper = ImageIO.read (new file ("upper" .JPG ");); Buffer image less = ImageIO.read (new file ("lower.jpg"));  

Then, to compare images, you have to calculate the differences in pixels. It is not trivial that there is no general, globally applicable "distance measure" for pixels. The approach can be done to iterate over pixels of both images, and can calculate something like

  int argb0 = image0.getRGB (x, y); Int argb1 = image1.getRGB (x, y); Int a0 = (argb0> & gt; 24) & amp; 0xFF; Int R = 0 (RGB 0>> 16) & amp; 0xFF; Int g0 = (argb0> 8) & amp; 0xFF; Int b0 = (argb0) & amp; 0xFF; Int a1 = (argb1> 24) & amp; 0xFF; Int R1 = (RGB 1>> 16) & amp; 0xFF; Int g1 = (argb1> 8) & amp; 0xFF; Int b1 = (argb1) & amp; 0xFF; Int aDiff = Math. Box (a1 - a0); Int Rdf = Math. Abs (R1 - R); Int gDiff = Math.base (G1 - G0); Int bDiff = Math.abs (b1 - b0);  

To get the differences in the red, green, blue and alpha channels, and to get these values ​​together, to get value which you later calculate the square root.


On one side: you calculated

  on the difference + = (upper part [i] - the current image [i]) ^ 2;  

But note that ^ 2 does no calculate the power, as you can expect, you can either < Code> Math.pow (difference, 2) , but something like preference

  differenceSum + = difference * difference;  

conditional - skipping whitespace in ANTLR v4 depending on context -


In my ANTLR 4 grammar, I would normally like to leave the empty space so that it can keep grammar as simple as possible. For this purpose, I use the laser rule WS: [\ t \ r \ n] + - - Skip; .

However, there may be some sections in the input, where there are whitespace cases. There are an example tables that are either tab-delimited or for which to count the number of spaces it needs to be written in which column is written.

If I can stop leaving the white space between some start and ending symbols ( table {...} ), that would be correct. Is this possible?

If not, what are the other solutions to switch between different lexer rules depending on the context?

Take a look at context-oriented tokens with lexical mode. This is more deeply covered in the book "Definitive ANTLR 4" - Chapter 12. I think you should be able to pull it out.

Announce a rule that "Space spacing mode", and return to the default one.

Open: '& lt;' - & gt; Mode (SKIP_SPACES); Mode: SKIP_SPACES; Close: '& gt;' - & gt; Mode (DEFAULT_MODE); WS: [\ t \ r \ n] + - & gt; Skip;

c++ - Boost intersection -


I have a problem with the promotion algorithm. I'm not sure whether I got an error or it's a bug.

  #include & lt; Boost / geometry / algorithm / intersection. HP & gt; # Include & lt; Boost / version.hpp & gt; #include & lt; Boost / geometry.hpp & gt; #include & lt; Boost / geometry / geometries / point_xy.hpp & gt; #include & lt; Boost / geometry / geometries / ring.hpp & gt; #include & lt; Boost / geometry / geometries / polygon.hpp & gt; Int main () {typedef boost :: geometry :: model :: d2 :: point_xy & lt; Double & gt; BoostPointXY; Typedef Promotion :: Geometry :: Model :: Polygon & lt; BoostPointXY & gt; BoostPolygon; BoostPolygon polyOne, PolyTu; Promotion :: Geometry :: read_wkt ("Polygon (45, 4), (45, 17), (44, 19), (44, 22), (50, 20), (51.5, 17), (58, 4), (60, 0), (53, 0), (45, 0), (45, 4)), "polyon"; Promotion :: Geometry :: read_wkt ("Polygon ((-10, -5), (0, 25), (43, 25), (45, 20), (50, 20), (60, 0), ( 5, 0), (5, -5), (-10, -5)), "Polyteuo"; Std :: vector & lt; BoostPolygon & gt; MultiPoly; Promote: Geometry :: Correct (PolyOne); Promote: Geometry :: Correct (polyTwo); Promote: Geometry :: intersection (PolyOne, polyTwo, multiPoly); Std :: cout & lt; & Lt; "Multi-size" & lt; & Lt; Multipol Size () & lt; & Lt; Std :: endl; Std :: cout & lt; & Lt; "Boost use" & lt; & Lt; BOOST_VERSION / 100000 & lt; & Lt; "." // major version & lt; & Lt; BOOST_VERSION / 100% 1000 & lt; & Lt; "." // short version & lt; & Lt; BOOST_VERSION% 100 // patch level & lt; & Lt; Std :: endl; }  

Output:

  Size of multi-boost boost 1.55.0  

But multiplex size should be 1 Or? When this is a bug, can anyone test with an existing 1.57 boost? I can not currently change my promotion version

thanks

Your WKT data Is invalid:

  Boost :: Geometry :: read_wkt ("Polygon (45 45, 45, 17, 44, 19, 44, 22, 50, 20, 51.5, 17, 58 4, 60 0, 53 0, 45 0, 45 4)) ", polyon); Promotion :: Geometry :: read_wkt ("Polygon (" -10 - 5, 25, 43, 25, 45, 20, 50, 20, 60 0, 5, 5 - 5, -10 - 5)) ", Polyteuo);  

Your sample has used many invalid (?) Internal rings.

You now get:

  Size of multi 1  

  #include & lt; Boost / geometry.hpp & gt; # Include & lt; Boost / geometry / algorithms / intersection HP & gt; #include & lt; Boost / geometry / geometries / point_xy.hpp & gt; #include & lt; Boost / geometry / geometries / polygon.hpp & gt; #include & lt; Boost / geometry / geometries / ring.hpp & gt; #include & lt; Boost / geometry / io / io.hpp & gt; # Include & lt; Fstream & gt; # Include & lt; Iostream & gt; Int main () {typedef boost :: geometry :: model :: d2 :: point_xy & lt; Double & gt; BoostPointXY; Typedef Promotion :: Geometry :: Model :: Polygon & lt; BoostPointXY & gt; BoostPolygon; BoostPolygon polyOne, PolyTu; Promotion :: Geometry :: read_wkt ("Polygon (45 45, 45, 17, 44, 19, 44 22, 50 20, 51.5 17, 58 4, 60 0, 53 0, 45 0, 45 4))", polyon ; Promotion :: Geometry :: read_wkt ("Polygon (Polyvuo) (" Polygon (Polygrave (-10 - 5, 25, 43, 25, 45, 20, 50, 20, 60, 5, 5, 5, -10-5)); Promote: Geometry :: Correct (PolyOne); Promote: Geometry :: Correct (polyTwo); {Std :: ofstream svg ("/ tmp / svg.svg"); Promote: Geometry :: svg_mapper & lt; BoostPointXY & gt; Mapper (SVG, 400, 400); Mapper.add (PolyOne); Mapper.add (polyTwo); Mapper.map (polyone, "fill-opacity: 0.5; Fill: RGB (153204,0); stroke: RGB (153204,0; stroke-width: 2"); Mapper.map (polytoobo, "fill-opacity: 0.5; fill: RGB (204153,0) stroke: RGB (204153,0; stroke-width: 2"); } Std :: vector & lt; BoostPolygon & gt; MultiPoly; Promote: Geometry :: intersection (PolyOne, polyTwo, multiPoly); Std :: cout & lt; & Lt; "Multi-size" & lt; & Lt; Multipol Size () & lt; & Lt; Std :: endl; }  

activerecord - Storing json api calls in Rails -


I created an app that uses a Jason API I removed the active record from my app because the data in the API Can theoretically change and I can not erase the database every time.

Right now I have a method called self.all for each class loop through the json making rabbi object that i then call that function in different functions to work with finding data and sums and percentages I do It all works well, but seems a bit slow. I was thinking that somewhere I should have saved myself. For each column that works with the data for each column, I should call new objects instead of calling them.

  ... The response was provided above using HTTParty. Def self.all puppies = [] if response.success? Feedback ['puppies']. Each do Puppy Account & lt; & Lt; Glitch ['name' as puppy. All dff SUM (Pilby) # Exchanges money for money = Money.New (0, 'USD') puppies.each do | Puppy | Zodiac = puppy End of End End DEF self.prices (puppies) Prices = puppies.map {| Puppy | Puppy.price} End Diffself.names (puppies) name = puppies.map {| Puppy At the end of puppy.name} .... There are many ways in which the argument of puppy.l. in the controller ....  

Should I use caching? Should I be brought back to active records? Or am I correcting that how? Should I store the puppy everywhere instead of calling the method every time?

Do I feel that whenever you call any class system, every time you Are you making a request with HTTParty? Can you imagine that for the response a class variable is creating a class variable named expires_at and then you can do some basic caching.

  @@ expires_at = time.zone Now @@ http_response def make_http_call updated_http_response @@ expires_at.past? HTTP repair request for http: // upgrade_http_response # @ http_response = # HTTParty response @@ expires_at = 30.minutes.from_now End # and in your code, @@ response # changes in either response.success response? @@response.success to do?  

All this is in memory and if you restart your server, then you lose everything if you want more robust caching, probably the better thing to do


ssl - Client authentication on JBoss server -


I am trying to configure client authentication for my application running on JBoss. The expected result is that the application applies to the user for the certificate and if the dependable one is provided, he will be able to work with the application.

I have generated the certificate and added me in a trust (JBOS.cheast) and have been configured standalone.xml file:

   & Lt; Virtual-Server Name = "My-Host" /> & Lt; / Connector & gt;  

I think the setting of a secure asset moves true , but the browser does not ask for a user certificate, but the error immediately ERR_BAD_SSL_CLIENT_AUTH_CERT < / Code>.

I have received an answer. This solution was to import the CA certificate that used to sign client certificates in the Truststore, instead of importing the client certificate itself. After importing the CA certificate, each certificate which was signed by CA and imported into the browser should be selected.


php - Jeasyui Datagrid Pagination Issues with second page only -


I am pulling my hair on the JSU Data Grid.

It correctly calculates the number of rows I currently have 22 rows, which gives 3 pages in the grid. The second page does not appear though I do not get it. The third page works

I have a suspicion on my SQL, and offset and limit, but what is wrong? I have set $ offsets and $ rows in this way (e.g. by JCEE)

  $ page = isset ($ _ POST ['page'])? Interval ($ _ POST ['page']): 1; $ Line = release ($ _ POST ['rows'])? Interval ($ _ POST ['rows']): 10; $ Offset = ($ page-1) * $ rows;  

I'm using this selection to get the data $ rs = mysql_query ("Select z.list_name as the name , Z.list_pointsPerHour as PPH, as the acquisition of List_takeoverPoints zone z, tempzones tz where z.list_id = tz.zoneid limit $ offset, $ rows ");

If I put $ rows 20 into the file and run php from the command line, then it does not give anything, if I leave it at 10 then gives 10 and happiness 22 total

SQL uses hacking as defined values ​​in the MySQL console and for offset and boundary tasks.

My site is turned on:

And it is such an example that I

I was unsuccessful, so it was all about me I have Latin 1 in my database and PHP is relatively UTF-8. Ouput and forced UTF-8 problem solved


Adding two non-relation Entities to DbContext that second entity use the first one's Id entity -


In the first code, when I want to save 2 related entities (for example country unit and city unit), first, Make another example of the country I made and another example of the city, and for the city's navigation, the last Save changelog. Make this process a database, first, create the country and then enter the ID of the country id area of ​​the City ID and the city Save the database. So now, I want to do this but with non-related organizations. This means that I want to send 2 units (without relationship) to DB, in that fist, saved first and get your ID, and use it in past saved ...


sql - Oracle regular expression for number range and length -


I need to validate the given list of IP addresses. IP address 1.0.0.0 to 255.255.255.255

Below I've done something:

 with  T (Val) AS (Select '123.1235.231.234.12' from Dual Union 'Dual All '011.' from '011' with '123123' dual union from union ', all choose' 000. 'Select' 123123 'from dual union' Select all from dual union '1920.16. 1.65 'dual union' 255.256.1.65 ' Choose from Double Select) * from where REGEXAPPLILEE (Val, '^ [1- 9] {1,3}. [0- 9] {1,3}. [0- 9] {1,3}. [ 0- 9] {1,3} $ ') and REGEXP_SUBSTR (Val,' [1- 9] {1,3} ', 1,1) between 1 and 255 and regexp_substr (Val,' [0- 9] Between 0 and 255 and REGEXP_SUBSTR (Val, '[0- 9] {1,3}', 1,3) between 0 and 255, and REGEXP_SUBSTR (Val, '[1,3] between {1,3}', 1,2) 0- 9] {1,3} ', 1,4) between 0 and 255  

Please help with the data I tested right away if I have a simple regular expression I can do this together.

Thank you in advance

There is an error in your regex, Code> 10.0.0.0 does not match for example.

Change it to:

  '^ [0-9] {1,3} \. [0-9] {1,3} \. [0-9] {1,3} \. The test followed by [0-9] {1,3} $ ' 

0.0.0.0

Will reject

swift - Login via twitter on iOS and authenticate on my server -


I have a web service that uses Twitter I want the user to sign on IOS via native Twitter accounts Can do Then use the credentials to sign in to the website.

Am I just sent authToken and authTokenSecret to my server? Are there any security risks?

This is a common question, but I ask it again because Twitter seems to have disappeared

  • Send these two values ​​to your server
  • Your server does not have any other solution to pass the information about these pieces on your server
  • One of the following is:
  • Regarding the final security risks, use it for your client-server communication. The Trust.


    eclipse - Cannot Install ECF SDK due to missing bundle? -



    eclipse - Cannot Install ECF SDK due to missing bundle? -

    i wanted utilize docshare eclipse downloaded zip file installing ecf sdk eclipse site , went install new software in eclipse gave path of zip file , deselected "contact sites during....required software" checkbox beacuse took long. result error stating:

    cannot finish install because 1 or more required items not found. software beingness installed: ecf sdk eclipse 3.9.0.v20140818-1747 (org.eclipse.ecf.core.feature.group 3.9.0.v20140818-1747) missing requirement: ecf discovery ui 3.0.0.v20140818-1747 (org.eclipse.ecf.discovery.ui 3.0.0.v20140818-1747) requires 'bundle org.eclipse.emf.edit.ui [2.2.0,3.0.0)' not found cannot satisfy dependency: from: ecf sdk eclipse 3.9.0.v20140818-1747 (org.eclipse.ecf.core.feature.group 3.9.0.v20140818-1747) to: org.eclipse.ecf.discovery.ui [3.0.0.v20140818-1747]

    i have no thought means , couldn't find solutions it. can please help me? thanks

    the site downloaded zip file: http://www.eclipse.org/ecf/downloads.php

    eclipse discovery eclipse-ecf

    phpmyadmin - Sorting SQL bookmarks -



    phpmyadmin - Sorting SQL bookmarks -

    i wondering if theres anyway sort query/queries bookmarks in phpmyadmin sql

    as can see in image unsorted, or sorted in way want alter (if can edit post view image considering dont have plenty reputation post it, appreciated)

    http://i.stack.imgur.com/dg81y.png

    any suggestions improve questions appreciated.

    use 2 digits numbers, i.e. 00, 01, 02, 03, instead of 1, 2, 3, etc.

    phpmyadmin

    javascript - Find location of Meteor Assets -



    javascript - Find location of Meteor Assets -

    i have folder on machine adding files while meteor app running. path of ~/uploads. have been able utilize assets.getbinary() private folder not folder outside of meteor project. how utilize assets.getbinary() location of file ~/uploads/foo?

    there no way send assets.getbinary() path not descendent of private directory. if must maintain assets outside private directory, sharing them between applications, can symlink folder within private directory.

    cd private directory , run:

    ln -s ~/uploads uploads

    then can reference assets in ~/uploads directory through path, example:

    assets.getbinary("uploads/foo");

    javascript meteor

    android - Parse JSON with variable key in retrofit -



    android - Parse JSON with variable key in retrofit -

    i'm working on application retrofit library i'm not in charge of backend.

    this json receive when there error. illustration when parameter 'email' wrong json response:

    {"status":"error","errors":{"email":{"emailnotfound":"email not found"}}}

    now 'email' part parameter wrong. how create object can reuse multiple parameters.

    i have this:

    public class authenticateresponse { @expose private string status; @expose private error errors; @expose private string session; public string getstatus() { homecoming status; } public void setstatus(string status) { this.status = status; } public string getsession() { homecoming session; } public void setsession(string session) { this.session = session; } public error geterrors() { homecoming errors; } public void seterrors(error errors) { this.errors = errors; } }

    but don't know how create error object because key variable. in case it's 'email' it's different.

    i have this

    public class errors { private list<object> list; public list<object> getlist() { homecoming list; } public void setlist(list<object> list) { this.list = list; } }

    but 'list' not key in json doesn't work. solutions ?

    i found solution. can register type adapter in retrofit :

    gson gson = new gsonbuilder() .registertypeadapter(errors.class, new erroradapter()) .create();

    than pass converter restadapter

    restadapter restadapter = new restadapter.builder() .setendpoint(endpoint) .setrequestinterceptor(requestinterceptor) .setconverter(new gsonconverter(gson)) .build();

    and in erroradapter parse json manually

    public static class erroradapter implements jsondeserializer<errors> { @override public errors deserialize(jsonelement json, type typeoft, jsondeserializationcontext context) throws jsonparseexception { errors errors = new errors(); seek { if (json != null) { jsonobject jsonobject = json.getasjsonobject(); (map.entry<string, jsonelement> elementjson : jsonobject.entryset()) { jsonobject error = elementjson.getvalue().getasjsonobject(); string errorvalue = error.entryset().iterator().next().getkey(); errors.adderror(errorvalue); } } } grab (exception e) { errors = null; } homecoming errors; } }

    android json retrofit

    mysql - Maximum size for query collection parameter in JPA 2.1 / EclipseLink 2.5.2 -



    mysql - Maximum size for query collection parameter in JPA 2.1 / EclipseLink 2.5.2 -

    is there maximum size query collection parameter in jpa 2.1 / eclipselink 2.5.2 (connecting mysql 5.6, if matters)?

    e.g., maximum allowable and/or recommend size ids in next code, ensure performance , avoid possible bugs or issues in jpa / eclipselink / mysql?:

    @persistencecontext private entitymanager em; { final collection<long> ids = /*obtain collection of ids*/; em.createquery("select e entity1 e e.id in :ids") .setparameter("ids", ids); }

    there no simple , clear reply question depends on multiple factors jvm's process heap size, persistence provider proprietary features, underlying database tuning options, etc. in real-life these factors should tuned rather individually.

    mysql 5.6 reference manual, chapter 12.3.2 comparing functions , operators defines that:

    the number of values in in list limited max_allowed_packet value.

    as max_allowed_packet equal maximum size of 1 packet or generated/intermediate string (here: 1gb) should theoretically allowed send query string of maximum size of 1gb.

    jpa 2.0 specification (jsr-317), chapter 4.6.9 in experssions not mention limitations, @ to the lowest degree can assume it's matter of "weakest" component in tool-chain (application container, persistence provider, underlying database, jvm heap size).

    as noticed @chris limited in oracle 1000 parameters per statement. similar issue eclipselink has been described james (a former architect of toplink/eclipselink) on blog:

    the first thing noticed in run oracle has limit of 1,000 parameters per statement. since in batch fetching binds big array, , i'm reading 5,000 objects, limit exceeded , run blew database error. the batchfetchpolicy in eclipselink accounts , defines size max number of ids include in. default size limit in eclipselink suppose 500 (...)

    and

    eclipselink defines jpa query hint "eclipselink.batch.size" allows size set. set 500 test. means read in of 5,000 objects, in batch fetch need execute 10 queries per batch fetched relationship.

    i encourage read whole post anyway.

    mysql jpa eclipselink jpa-2.0 jpa-2.1

    android - duplicated image in original gallery folder when having crop function -



    android - duplicated image in original gallery folder when having crop function -

    i working on importing images gallery, , discovered

    with no crop function: intent intent = new intent(); intent.settype("image/*"); intent.setaction(intent.action_get_content); startactivityforresult(intent.createchooser(intent,"select picture"), 10002); with crop function: intent intent = new intent(); intent.settype("image/*"); intent.putextra("crop", "true"); intent.putextra("aspectx", 1024); intent.putextra("aspecty", 800); intent.putextra("outputx", 1024); intent.putextra("outputy", 800); intent.putextra("scale", true); intent.putextra("return-data", false); intent.putextra("outputformat", bitmap.compressformat.jpeg.tostring()); intent.putextra("nofacedetection", true); // no face detection intent.setaction(intent.action_get_content); startactivityforresult(intent.createchooser(intent,"select picture"), 10002); question:

    when there no crop function, final imageview can display selected image.

    when there crop function, final imageview can display selected image, folder image picked, has duplicated original image.

    how duplicated image removed? lot!

    android image android-intent crop

    php - mysql connect error access denied -



    php - mysql connect error access denied -

    i'm having problem connecting database , i've been playing trying different codings different errors. i've searched same problem others had nil solved problem

    i registered hosting business relationship in godaddy , i'm using linux i'm not sure if has problem. when seek using localhost works fine when in website error

    access denied user 'root'@'23.229.234.67' (using password: no)

    here's code:

    <?php session_start(); $db_conx = mysqli_connect("examplesite.com", "root", "", "mydb"); if (mysqli_connect_errno()) { echo mysqli_connect_error(); exit(); } ?>

    i appreciate comment , in advance.

    you show add together entry mysql database saying need access ip 23.229.234.67.

    to log in mysql using localhost.

    use database named mysql.

    add end enrty ip 23.229.234.67 user table follows

    insert user (`host`, `user` , `password`) values("23.229.234.67","root", "enter hash value in localhost enrty related 'mydb'");

    restart mysql service follows

    sudo service mysql restart

    then should work fine , should able log in mysql mysqli_connect("examplesite.com", "root", "", "mydb");

    make sure have mapped ip host in /etc/hosts file follows

    23.229.234.67 examplesite.com

    php linux mysqli godaddy connect

    go - Sequential queries with golang & mongodb -



    go - Sequential queries with golang & mongodb -

    wondering best way create sequential queries golang mongodb. illustration lets have :

    result *bson.m ids:=["543d171c5b2c12420dd016","543d171c5b2dd016"] oids := make([]bson.objectid, len(ids)) := range ids { oids[i] = bson.objectidhex(ids[i]) } query := bson.m{"_id": bson.m{"$in": oids}} error:= c.find(query).all(&result)

    and want take output of _ids , utilize query table. correct?

    query = bson.m{"_id": bson.m{"$in": result}}

    here's how build query using ids of documents returned other query.

    var docs []bson.m if err := c.find(query).all(&docs); err != nil { // handle error } docids := make([]interface{}, len(docs)) := range docs { docids[i] = docs[i]["_id"] } query = bson.m{"_id": bson.m{"$in": docids}}

    mongodb go sequential

    binary search tree - Java: Find the Depth of a Node not Found in a BST -



    binary search tree - Java: Find the Depth of a Node not Found in a BST -

    i have binary search tree stores in strings, , have been able find depths or heights of strings exist in bst, i'm trying find depth string not in bst.

    here algorithm i'm using currently, works find depth of string exists in bst:

    public int getdepth(string data) { homecoming getdepth(root, data, 1); } public int getdepth(node root, string data, int level) { if (root == null) homecoming 0; if (root.getdata().getname().equals(data)) homecoming level; int ret = getdepth(root.leftchild, data, level + 1); if (ret != 0) homecoming ret; ret = getdepth(root.rightchild, data, level + 1); homecoming ret; }

    my bst has elements inserted in order: "cat", "bird", "dog", "tiger", "elephant", "panda".

    so binary tree should this:

    cat / \ bird dog \ tiger / \ elephant panda

    when phone call method on "dog" output is: dog @ depth 2

    when phone call method on "hippo" output is: hippo @ depth 0

    but expected output of "hippo" should be: hippo @ depth 5

    because hippo kid of elephant in depth 4.

    then case, if wanted find depth of "cow" not in bst? have left kid of dog depth should 3, however, still 0.

    so question without using delete and/or restore method case(s) need or case(s) need modify in method above in order determine depth of string not within bst?

    try modified version of sec getdepth() method:

    public int getdepth(node root, string data) { if (root == null || root.getdata().getname().equals(data)) { // nail spot - either below leaf // or matched node // if doing insert/replace, set info on spot homecoming 0; } if (issmallerthan(data, root.getdata().getname())) { homecoming 1 + getdepth(root.leftchild, data); } homecoming 1 + getdepth(root.rightchild, data); }

    where issmallerthan(string a, string b) returns true if a smaller b. method depends on how want strings compared.

    and don't need pass level along...

    java binary-search-tree depth

    swing - Table Renderer not working correctly in Java -



    swing - Table Renderer not working correctly in Java -

    i read lot of articles , got jtable rendering per requirements problem when table scrolled user, of other hidden parts of jtable colored shown in image below

    and when user scrolls table, other parts got colored this

    why happens? read many articles , and of them show same thing this...

    here code

    jtable table = new jtable() { public boolean iscelleditable(int rowindex, int colindex) { homecoming false; } }; (defaulttablecellrenderer)table.gettableheader().getdefaultrenderer()) .sethorizontalalignment(jlabel.center); table.setmodel(new defaulttablemodel(new object [][] {}, columns)); table.setrowheight(25); table.setautoresizemode(jtable.auto_resize_off); table.setselectionmode(listselectionmodel.single_selection); table.getcolumnmodel().removecolumn(table.getcolumnmodel().getcolumn(0)); table.setdefaultrenderer(object.class, new defaulttablecellrenderer() { @override public component gettablecellrenderercomponent(jtable table, object value, boolean isselected, boolean hasfocus, int row, int column) { super.gettablecellrenderercomponent(table, value, isselected, hasfocus, row, column); if(!table.getmodel().getvalueat(row, 10).tostring().equals("true")) { setbackground(new color(246,137,137)); } homecoming this; } }); jscrollpane areascrollpane = new jscrollpane(table); areascrollpane.setpreferredsize(new dimension(width, height)); mypanel.add(areascrollpane);

    all articles show way render custom row on status base. what's wrong in code? support.

    if(!table.getmodel().getvalueat(row, 10).tostring().equals("true")) { setbackground(new color(246,137,137)); }

    the same renderer used cells 1 time set background apply cells. so, think need like:

    if(!table.getmodel().getvalueat(row, 10).tostring().equals("true")) { setbackground(new color(246,137,137)); } else setbackground( table.getbackground() );

    you should add together code create sure cell not selected default selection color can painted.

    instead of using custom renderer can override preparerenderer(...) method of jtable. table row rendering show how can render row based on value in row.

    java swing jtable rendering tablecellrenderer

    c# - Is it possible to execute two async methods in parallel? -



    c# - Is it possible to execute two async methods in parallel? -

    if execute 2 tasks, can execute 2 tasks @ same time , wait until 2 tasks finished. code:

    task<bool> tsk01 = task.run(()=> code; homecoming true); task<bool> tsk02 = task.run(()=> code; homecoming true); task.waitall(tsk01, tsk02); //next code

    in case next code executed when tasks finished. application not blocked.

    however if have code:

    private async void button_click_2(object sender, routedeventargs e) { task<bool> tsk01 = mimetodoasync01(); task<bool> tsk02 = mimetodoasync02(); task.waitall(tsk01, tsk02); } private async task<bool> mimetodoasync02() { homecoming await taskex.run<bool>(() => { int64 resultado = 0; (int64 = 1; < 1000000000; i++) { resultado = resultado + 1; } homecoming true; }).configureawait(false); } private async task<bool> mimetodoasync01() { homecoming await taskex.run<bool>(() => { int64 resultado = 0; (int64 = 1; < 1000000000; i++) { resultado = resultado + 1; } homecoming true; }).configureawait(false); }

    in sec alternative application blocked because waitall seems wait response tasks never happens.

    why in first case application not blocked , in sec 1 is?

    the method task.waitall block ui thread waits tasks homecoming before continuing.

    the code examples gave creating task same (albeit written different ways). both homecoming task<bool>.

    the difference function beingness run within both of lambda expressions. first illustration has "my code" reference , returns. sec illustration created 2 counters.

    if "my code" defined differently the counters created in sec example, or if returning true in lambda expression, appearance of 1 waiting on other.

    simply returning true end threads after created. where-as counter takes time compute (also depending on cpu speed).

    if add together same counter function of first example, find both take same time, , task.waitallblocks ui. can utilize system.diagnositics.stopwatch class time it.

    static void main(string[] args) { string test = console.readline(); system.diagnostics.stopwatch t = new system.diagnostics.stopwatch(); t.start(); task<bool> task1 = task.run<bool>(() => { homecoming true; }); task<bool> task2 = task.run<bool>(() => { homecoming true; }); task.waitall(task1, task2); t.stop(); console.writeline("elapsed time: " + t.elapsed); system.diagnostics.stopwatch t2 = new system.diagnostics.stopwatch(); t2.start(); task<bool> task3 = asyncmethod1(); task<bool> task4 = asyncmethod2(); task.waitall(task3, task4); t2.stop(); console.writeline("elapsed time: " + t2.elapsed); console.read(); }

    c# asynchronous async-await

    android - Tinting Checkbox on pre v21 -



    android - Tinting Checkbox on pre v21 -

    so, want apply tint appcompat checkbox.

    everything works fine on lollipop:

    android:buttontint="@color/purple_ff4081"

    or way:

    android:theme="@style/theme.mytheme.purpleaccent"

    but setting of params not alter on pre-lollipop. works if set coloraccent app theme. don't want widgets alter look, 1 checkbox. there way without setting colored drawables?

    quick fyi has changed after introduction of appcompatactivity , new back upwards libraries, for reference (outlined beautifully here) checkbox can tinted using theme atttribute , setting colorcontrolnormal , colorcontrolactivated:

    styles.xml

    <style name="mycheckbox" parent="theme.appcompat.light"> <item name="colorcontrolnormal">@color/indigo</item> <item name="colorcontrolactivated">@color/pink</item> </style>

    layout xml:

    <checkbox android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="check box" android:theme="@style/mycheckbox"/>

    android checkbox

    javascript - jQuery: Event is attached to button, but fires at image element inside button in Chrome -



    javascript - jQuery: Event is attached to button, but fires at image element inside button in Chrome -

    i have such button in form:

    <button class="delete-file-btn" "><img src="/img/del.png"/></button>

    then attach event via jquery:

    $('#form').on('click', 'button.delete-file-btn', function(e) { // code here });

    when press button in crome, e.target points @ img element, not button. what's wrong event assignment? in ff works fine.

    the e.target refers specific element clicked on, element targeted. event fired because target kid of element attached click on. utilize this refer element attached eventhandler on.

    when seek illustration image e.target, in firefox.

    i hope helps out!

    javascript jquery

    c# - How to bind a control of a row detail to the property of the view model -



    c# - How to bind a control of a row detail to the property of the view model -

    during development works, want create datagrid row detail information. each row compose class info such as, class name , total number of students. when user click 1 row display pupil info of selected class row detail.

    the row detail command create datagrid, each row of grid pupil information.

    the pupil name edit autocompletebox control. itemsource of should bound property studentnames of viewmodel , not property of classinformation. classinforamtion property of viewmodel. result not works. during editing, studentnames not binded currectly.

    <usercontrol ...> <grid x:name="layoutroot" ...> <sdk:datagrid autogeneratecolumns="false" itemssource="{binding classinformation}" rowdetailsvisibilitymode="visiblewhenselected" selecteditem="{binding selectedclass, mode=twoway}" x:name="datagrid"> <sdk:datagrid.columns> <sdk:datagridtextcolumn header="name" binding="{binding name}"/> <sdk:datagridtextcolumn header="total student" binding="{binding totalstudent}" isreadonly="true"/> </sdk:datagrid.columns> <sdk:datagrid.rowdetailstemplate> <datatemplate> <grid> <grid.columndefinitions> <columndefinition/> <columndefinition width="auto"/> </grid.columndefinitions> <sdk:datagrid autogeneratecolumns="false" grid.column="0" itemssource="{binding studentinformation}"> <sdk:datagrid.columns> <sdk:datagridtemplatecolumn header="student name"> <sdk:datagridtemplatecolumn.celltemplate> <datatemplate> <textblock x:name="studentname" text="{binding ssdtestscript.name}"/> </datatemplate> </sdk:datagridtemplatecolumn.celltemplate> <sdk:datagridtemplatecolumn.celleditingtemplate> <datatemplate> <sdk:autocompletebox itemssource="{binding path=datacontext.studentnames, elementname="layoutroot"}" itemfilter="{binding elementname=studentname, path=text}"/> </datatemplate> </sdk:datagridtemplatecolumn.celleditingtemplate> </sdk:datagridtemplatecolumn> </sdk:datagrid.columns> </sdk:datagrid> </grid> </datatemplate> </sdk:datagrid.rowdetailstemplate> </sdk:datagrid> </grid> </usercontrol>

    i have tried or binding expressions too.

    itemssource="{binding path=scriptnames}" datacontext="{binding}" itemssource="{binding path=scriptnames, relativesource={relativesource mode=findancestor, ancestortype=grid}}" itemssource="{binding path=scriptnames, relativesource={relativesource mode=findancestor, ancestortype=usercontrol}}"

    by way, how specify ancestorlevel in silverlight 5? have seek expression, throw exception when navigate page. depend on logic tree of xaml?

    itemssource="{binding path=scriptnames, relativesource={relativesource mode=findancestor, ancestorlevel=2}}"

    any suggestions appreciated! in advance.

    c# wpf xaml silverlight

    windows - Batch file displaying Fragmentation - Formatting output -



    windows - Batch file displaying Fragmentation - Formatting output -

    defrag c: /a /v > %temp%\defrag.txt /f "delims=" %%a in ('findstr /c:"total fragmented space" "%temp%\defrag.txt" ') set "fragmentation=%%a" echo %fragmentation%

    this code works fine echos out spaces in file. here output:

    --------------------------------------------------------------------- total c fragmentation: total fragmented space = 3%

    is there way rid of spaces? have tried beingness more precise on search adding way until = sign no luck.

    i appreciate help , give thanks time!

    you can utilize spaces delimiter , retrieve separated elements

    for /f "tokens=1-8" %%a in ( 'findstr /c:"total fragmented space" "%temp%\defrag.txt" ' ) set "fragmentation=%%a %%b %%c %%d %%e %%f %%g %%h"

    or can straight utilize equal sign delimiter, value , later output need

    for /f "tokens=2 delims==" %%a in ( 'findstr /c:"total fragmented space" "%temp%\defrag.txt" ' ) set "fragmentation=%%a" echo total c fragmentation: total fragmented space =%fragmentation%

    and in of 2 cases, temporary file can avoided for command can run command , retrieve output

    for /f "tokens=2 delims==" %%a in ( 'defrag c: /a /v ^| findstr /c:"total fragmented space" ' ) set "fragmentation=%%a"

    windows batch-file

    java - Null Pointer Exception at EOF -



    java - Null Pointer Exception at EOF -

    so i'm getting null pointer on lastly line of method. i've read on others issue, using while ((linein = myreader.readline()) != null) should stopping file 1 time has nil left, doesn't seem that. instead end catching npe. can't figure out why is. advice appreciated! band-aid issue using catch (nullpointerexception) statement, don't sense that's adequate solution.

    bufferedreader myreader; seek { fileinputstream fileinstream = new fileinputstream( filelocation); inputstreamreader fileinputstreamreader = new inputstreamreader( fileinstream, "utf-16"); myreader = new bufferedreader(fileinputstreamreader); string linein = ""; // read next line until there aren't left while ((linein = myreader.readline()) != null) { //do stuff line } system.out.println("done"); // close file connections read done. filein.close(); myreader.close(); } grab (exception e) { system.out.println("error: " + e.getmessage()); e.printstacktrace();

    }

    null pointer should never caught should fixed. not want them propagate remaining parts of code.

    also ensure closing file. add together block , close files resources. way if exception caught still close file.

    java bufferedreader fileinputstream

    gson - Sort json fields by field name -



    gson - Sort json fields by field name -

    i have json reply

    { "bfield":"some data", "afield":"some data", "cfield":"some data", "dfield":{ "b1field":"some data", "c1field":"some data", "a1field":"some data" } }

    and want json, sorted field name

    { "afield":"some data", "bfield":"some data", "cfield":"some data", "dfield":{ "a1field":"some data", "b1field":"some data", "c1field":"some data" } }

    i utilize gson on server create json, first question: can gson sort fields name? or tell me, pls, sites or javascript libaraies, can convert json json sorted name fields.

    ps sorry bad english

    updated: modify 'sortobject' function @dariogriffo sorting nested object fields:

    function sortobject(o) { var sorted = {}, key, = []; (key in o) { if (o.hasownproperty(key)) { if (o[key]!=null && typeof o[key] === 'object'){ o[key] = sortobject(o[key]); } a.push(key); } } a.sort(); (key = 0; key < a.length; key++) { sorted[a[key]] = o[a[key]]; } homecoming sorted; };

    now work me.

    you can seek on javascript side

    function sortobject(o) { var sorted = {}, key, = []; (key in o) { if (o.hasownproperty(key)) { a.push(key); } } a.sort(); (key = 0; key < a.length; key++) { sorted[a[key]] = o[a[key]]; } homecoming sorted; } var q = { bfield:'some data', afield:'some data', cfield:'some data', dfield:{ b1field:'some data', c1field:'some data', a1field:'some data' } }; var p = sortobject(q); console.log(p);

    json gson

    angularjs - Failed to instantiate module when using ES6 let with firefox and angular -



    angularjs - Failed to instantiate module when using ES6 let with firefox and angular -

    i seek utilize es6's allow keyword in angularjs module. work angularjs 1.3 , ff 34. in chrome ( 39 ) works . in ff "failed instantiate module". when alter statement var keyword it's in ff.

    someone have thought ?

    in order utilize es6 features in firefox need specify version

    <script type="application/javascript;version=1.7"></script>

    https://developer.mozilla.org/en-us/docs/web/javascript/new_in_javascript/1.7

    angularjs firefox ecmascript-6

    blackberry 10 - Worklight 6.1 latest ifix pack gives popup in BB10 while accessing geolocation services -



    blackberry 10 - Worklight 6.1 latest ifix pack gives popup in BB10 while accessing geolocation services -

    i working on developing application bb10 using geolocation services. application on worklight 6.0 , had next permission set in config.xml:

    read_geolocation

    after upgrading worklight 6.1, while accessing geolocation services, getting next popup:

    local:// wants access location. allow?

    this popup not coming in before version.

    also, after migrating latest ifix pack, added folloing permission well:

    access_location_services

    still issue persist.

    aav,

    this found defect in cordova. if you'd receive fix, please open pmr prepare worklight 6.1 using, supplied you. provide link question.

    worklight blackberry-10

    How can i parse this json using php? -



    How can i parse this json using php? -

    here json string:

    { "id": "100007460521803_1498098053782198" }

    i want display id.. im using code unsuccessfully:

    $json = file_get_contents('id.txt'); $decode = json_decode($json); echo $decode->id;

    error:

    fatal error: cannot utilize object of type stdclass array in /home/xtremepi/public_html/who-viewed/test.php on line 6

    any ideas?

    i have checked , got code working. have create sure id.txt file in same directory. or seek replace

    echo $decode->id;

    by one

    echo $decode['id'];

    php json

    c# - FTP Connection in app.config -



    c# - FTP Connection in app.config -

    i want connect ftp server within c# code, , want store ftp server, user , password within app.config. not want store in different file , neither hardcode ftp within c#.

    how do that?

    i know connectionstrings far have used sql, not ftp, , not know how create work ftp. far haven't found reply on how set ftp info within app.config

    add web.config

    <appsettings> <add key="ftp_url" value="" /> <add key="user" value="" /> <add key="pass" value="" /> </appsettings>

    and in c# code this

    configurationmanager.appsettings["ftp_url"];

    c# ftp connection app-config

    multithreading - Is there a way to make multithreaded debugging in visual studio work the same way as eclipse? -



    multithreading - Is there a way to make multithreaded debugging in visual studio work the same way as eclipse? -

    in eclipse, stop on breakpoint , other threads maintain running. if happen stop on breakpoint, stop, context remains thread working @ time. if nail f8 (run) might switch context thread stopped @ breakpoint, if f5 (step in) or f6 (step over) remain in same thread.

    in visual studio (i'm newbie visual studio) i'm finding if step on (f10) or step in (f11) may (and will) have context switched thread , lose train of execution unless manually go original thread.

    i realize can freeze other threads, becomes onerous if want switch threads. has alternative somewhere, visual studio filled options , haven't found yet.

    http://screencast.com/t/itxo6job

    that alternative can think of might help, according msdn blog (http://ppe.blogs.msdn.com/b/zainnab/archive/2010/10/22/break-all-processes-when-one-process-breaks-vstipdebug0029.aspx), won't want.

    this related question may help well: "step over" when debugging multithreaded programs in visual studio

    multithreading visual-studio debugging

    More about $this on php -



    More about $this on php -

    *update example

    have read articles , php.net . still having problem understand $this on 'this' example. understand basic used .

    let's assume , have function @ end homecoming $this; //nothing come after $this

    what $this (at end of method to) refer ? how check/echo-ing $this is

    public function check($source, $items = array()){ foreach ($items $item => $rules) { foreach($rules $rule => $rule_value){ $value = trim($source[$item]); $item = escape($item); if($rule === 'required' && empty($value)) { $this->adderror("{$item} required"); } else if(!empty($value)) { switch($rule) { case 'min': if(strlen($value) < $rule_value ) { $this->adderror("{$item} must minimum of {$rule_value} characters"); } break; case 'max': if(strlen($value) > $rule_value ) { $this->adderror("{$item} must maximum of {$rule_value} characters"); } break; } } } } if(empty($this->_errors)) { $this->_passed= true; } homecoming $this; }

    *this code part of register , validation class. point still $this @ end refering . thanks

    in example, $this refers main class , object.

    class mainclass { public function dosomething($x, $y) { $this->content = "rssult is: " . $x+$y; homecoming $this; } public function printme() { echo $this->content; }

    }

    it returns object , class.

    now usage? 1 of fundamental usages method-chaining. well, mean?

    have ever seen this?

    $myclass = new mainclass(); $myclass->dosomething()->print();

    the above code implemented approach called method-chaining, since there chain of methods (functions) called repeatedly without stop.

    basically, without method-chaining, above code have been:

    $myclass = new mainclass(); $s = $myclass->dosomething(5, 8); $myclass->print();

    but method chaining, since each method returns whole class if have had new mainclass() , allows immediate phone call method.

    though not new mainclass() since "new" operator creates instance of class, while $this returns current instanced.

    in nutshell, $this says php please homecoming current instanced re-create of class (whose properties might have been changed methods called prior returning $this).

    php

    c++ - Unable to compile amqpcpp, Make error -



    c++ - Unable to compile amqpcpp, Make error -

    i have issue compiling amqpcpp on centos virtual machine, works fine on imac.

    when running create error:

    g++ -wall -i/usr/local/include -l/usr/local/lib -iinclude/ -c -o src/amqpexchange.o src/amqpexchange.cpp src/amqpexchange.cpp: in fellow member function ‘void amqpexchange::senddeclarecommand()’: src/amqpexchange.cpp:73: error: cannot convert ‘amqp_table_t’ ‘amqp_boolean_t’ argument ‘7’ ‘amqp_exchange_declare_ok_t* amqp_exchange_declare(amqp_connection_state_t_*, amqp_channel_t, amqp_bytes_t, amqp_bytes_t, amqp_boolean_t, amqp_boolean_t, amqp_boolean_t, amqp_boolean_t, amqp_table_t)’ make: *** [src/amqpexchange.o] error 1

    github issue url

    g++ version

    g++ --version g++ (gcc) 4.4.7 20120313 (red hat 4.4.7-11)

    unfortunately, not know plenty of c++ or create yet understand issue. seems compiler complaining type cast style conversion in code, confusing works fine on mac.

    any ideas?

    thanks

    edit: have downloaded latest version of amqpcpp on both machines , re-compiled them, same results.

    edit 2: realised installed librabbitmq-c on mac couple of months ago, i've updated latest version , compains of similar error centos machine, appears amqpcpp not compatible latest changes librabbitmq codebase. seems particular commit causes issue:

    commit 2340b039f029f3b8101a164d3bcd547be1106906

    i going seek , update amqpcpp codebase apply fix, post link pull request if works. otherwise, using before commit when checking out code should allow work.

    thanks

    i found cause , 2 (temporary) resolutions.

    option one.. pull librabbitmq code before breaking changes:

    $ git clone https://github.com/alanxz/rabbitmq-c $ cd rabbitmq-c/ $ git checkout e1746f92585d59364fc48b6305ce25d7fc86c2a4

    and compile normal. have tested method , works fine me. maintain eye out future update on amqpcpp github page know when safe update latest version.

    option 2 .. update amqpcpp code:

    amqpexchange.cpp:

    un-comment line 69 reads:

    amqp_boolean_t autodelete = (parms & amqp_autodelete) ? 1:0;

    change line 73 reads:

    amqp_exchange_declare(*cnn, (amqp_channel_t) 1, exchange, exchangetype, passive, durable, autodelete, 0, args );

    then should able compile without error. beware: there more changes in librabbitmq code function, why stated temporary fix. amqpcpp project need updated reflect recent changes. prepare works need to, may find other functionality broken.

    i decided utilize alternative 1 , it's working expected.

    thanks

    c++ make amqp

    NullPointerException for liferay-faces-bridge-api-4 -



    NullPointerException for liferay-faces-bridge-api-4 -

    the error got when trying utilize liferay bridge 4:

    21:18:00,794 error [portletcontainerliferayimpl:171] null 2java.lang.nullpointerexception 3 @ com.liferay.faces.bridge.container.liferay.portletcontainerliferayimpl.getrequesturl(portletcontainerliferayimpl.java:392) 4 @ com.liferay.faces.bridge.container.liferay.portletcontainerliferayimpl.<init>(portletcontainerliferayimpl.java:168) 5 @ com.liferay.faces.bridge.container.portletcontainerfactoryimpl.getportletcontainer(portletcontainerfactoryimpl.java:43) 6 @ com.liferay.faces.bridge.bridgephasebaseimpl.init(bridgephasebaseimpl.java:172) 7 @ com.liferay.faces.bridge.bridgephaserenderimpl.execute(bridgephaserenderimpl.java:118) 8 @ com.liferay.faces.bridge.bridgephaserenderimpl.execute(bridgephaserenderimpl.java:84) 9 @ com.liferay.faces.bridge.bridgeimpl.dofacesrequest(bridgeimpl.java:117) 10 @ javax.portlet.faces.genericfacesportlet.doview(genericfacesportlet.java:255) 11 @ javax.portlet.genericportlet.dodispatch(genericportlet.java:328) 12 @ javax.portlet.faces.genericfacesportlet.dodispatch(genericfacesportlet.java:204)

    i recommend start clean project next steps in generating liferay faces portlet using mvn archetype generate wiki article. note in pom.xml, need alter com.sun.faces 2.1.21 2.2.6 , com.liferay.faces 3.2.4-ga5 4.2.0-m2. need add together liferay previews repository:

    <repository> <id>liferay-previews</id> <url> https://repository.liferay.com/nexus/content/repositories/liferay-previews </url> </repository>

    for more information, see blog titled announcement: liferay faces 4.2.0-m2 released.

    liferay liferay-6 portal

    c++ - Performance degradation if loop count is not known at compile time on Xeon Phi -



    c++ - Performance degradation if loop count is not known at compile time on Xeon Phi -

    i creating simple matrix multiplication procedure, operating on intel xeon phi architecture.

    after many attempts autovectorization, trying improve performances, had utilize intel intrinsics.

    until now, matrix size given #define in source code, when seek give @ run time, have huge performance degradation.

    the source code following:

    #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #include <stddef.h> #include <chrono> #include <ctime> #include <mmintrin.h> #include <xmmintrin.h> // sse #include <pmmintrin.h> // sse2 #include <emmintrin.h> // sse3 #include <immintrin.h> #include <zmmintrin.h> #define alignment 64 #ifndef size #define size 960 #endif #define vzero(c) {(c) = _mm512_setzero_pd();} #define start_time() \ auto start = std::chrono::high_resolution_clock::now(); /** shows elapsed time. see start_time usage*/ #define elapsed_time(string) \ auto elapsed = std::chrono::high_resolution_clock::now() - start; \ long long microseconds = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count(); \ printf(#string":%lld\n", microseconds); void rectranspose(double *__restrict__ a, double *__restrict__ at, const int n, const int k, const int lda, const int ldat){ if (n*k <= 128) { for(int = 0; < n; i++) { for(int j = 0; j < k; j++) { at[j*ldat+i] = a[i*lda+j]; } } //printf("reached _|_"); return; } if(k > n) { rectranspose(a, at, n, (k+1)/2, lda, ldat); rectranspose(&a[(k+1)/2], &at[(k+1)/2*ldat], n, k-((k+1)/2), lda, ldat); } else { rectranspose(a, at, (n+1)/2, k, lda, ldat); rectranspose(&a[(n+1)/2*lda], &at[(n+1)/2], n- (n+1)/2, k, lda, ldat); } } /** calculates 8 cols , 30 rows of c.*/ inline void eightbythirty(double *__restrict__ a, double *__restrict__ b, double * __restrict__ c, const int size) { __m512d c0, c1, c2, c3, c4, c5, c6, c7, c8, c9; __m512d c10, c11, c12, c13, c14, c15, c16, c17, c18, c19; __m512d c20, c21, c22, c23, c24, c25, c26, c27, c28, c29; vzero(c0); vzero(c1); vzero(c2); vzero(c3); vzero(c4); vzero(c5); vzero(c6); vzero(c7); vzero(c8); vzero(c9); vzero(c10); vzero(c11); vzero(c12); vzero(c13); vzero(c14); vzero(c15); vzero(c16); vzero(c17); vzero(c18); vzero(c19); vzero(c20); vzero(c21); vzero(c22); vzero(c23); vzero(c24); vzero(c25); vzero(c26); vzero(c27); vzero(c28); vzero(c29); __assume_aligned(a, alignment); __assume_aligned(b, alignment); __assume_aligned(c, alignment); __assume(size%16==0); for(int = 0; < size; i++) { const __m512d bv = _mm512_load_pd(b+i*size); c0 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+0, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c0); c1 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+1, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c1); c2 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+2, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c2); c3 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+3, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c3); c4 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+4, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c4); c5 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+5, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c5); c6 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+6, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c6); c7 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+7, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c7); c8 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+8, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c8); c9 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+9, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c9); c10 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+10, _mm_upconv_pd_none, _mm_broadcast_1x8, 0),bv, c10); c11 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+11, _mm_upconv_pd_none, _mm_broadcast_1x8, 0),bv, c11); c12 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+12, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c12); c13 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+13, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c13); c14 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+14, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c14); c15 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+15, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c15); c16 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+16, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c16); c17 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+17, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c17); c18 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+18, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c18); c19 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+19, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c19); c20 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+20, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c20); c21 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+21, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c21); c22 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+22, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c22); c23 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+23, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c23); c24 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+24, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c24); c25 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+25, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c25); c26 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+26, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c26); c27 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+27, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c27); c28 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+28, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c28); c29 = _mm512_fmadd_pd(_mm512_extload_pd(a+i*size+29, _mm_upconv_pd_none, _mm_broadcast_1x8, 0), bv, c29); } _mm512_storenr_pd(c+0*size, c0); _mm512_storenr_pd(c+1*size, c1); _mm512_storenr_pd(c+2*size, c2); _mm512_storenr_pd(c+3*size, c3); _mm512_storenr_pd(c+4*size, c4); _mm512_storenr_pd(c+5*size, c5); _mm512_storenr_pd(c+6*size, c6); _mm512_storenr_pd(c+7*size, c7); _mm512_storenr_pd(c+8*size, c8); _mm512_storenr_pd(c+9*size, c9); _mm512_storenr_pd(c+10*size, c10); _mm512_storenr_pd(c+11*size, c11); _mm512_storenr_pd(c+12*size, c12); _mm512_storenr_pd(c+13*size, c13); _mm512_storenr_pd(c+14*size, c14); _mm512_storenr_pd(c+15*size, c15); _mm512_storenr_pd(c+16*size, c16); _mm512_storenr_pd(c+17*size, c17); _mm512_storenr_pd(c+18*size, c18); _mm512_storenr_pd(c+19*size, c19); _mm512_storenr_pd(c+20*size, c20); _mm512_storenr_pd(c+21*size, c21); _mm512_storenr_pd(c+22*size, c22); _mm512_storenr_pd(c+23*size, c23); _mm512_storenr_pd(c+24*size, c24); _mm512_storenr_pd(c+25*size, c25); _mm512_storenr_pd(c+26*size, c26); _mm512_storenr_pd(c+27*size, c27); _mm512_storenr_pd(c+28*size, c28); _mm512_storenr_pd(c+29*size, c29); } int main(int argc, const char ** argv) { #ifdef sizes const int size = size; #else const int size = atoi(argv[1]); #endif void* p = malloc((sizeof(double)*5*size*size) + alignment-1); double *__restrict__ = (double*)(((size_t)p + alignment-1) / alignment * alignment); double *__restrict__ @ = (double*) a+size*size; double *__restrict__ b = at+size*size; double *__restrict__ c = b+size*size; double *__restrict__ d = c+size*size; srand(time(null)); for(int = 0; < size; i++) { for(int j = 0; j < size; j++) { a[i*size+j] = (double) (rand()%20); } for(int j2=0; j2<size; j2++){ c[i*size+j2] = 0.0; } } for(int = 0; < size; i++) { for(int j = 0; j < size; j++) { b[i*size+j] = (double) (rand()%20); } } start_time(); rectranspose(a, at, size, size, size, size); for(int = 0; < size; i+=30) { for(int j = 0; j < size; j+=8) { eightbythirty(&at[i], &b[j], &c[i*size+j], size); } } elapsed_time(); double gflops = 2.0*size*size*size*1.0e-03/(microseconds); printf("gflops: %f\n", gflops); for(int = 0; < size; i++) { for(int j = 0; j < size; j++) { double s = 0; for(int u = 0; u < size; u++) { s += a[i*size+u] * b[u*size+j]; } d[i*size+j] = s; } } int error = 0; for(int = 0; < size; i++) { for(int j = 0; j < size; j++) { if(abs(c[i*size+j] - d[i*size+j]) > 1) { printf("error @ %d %d , %f instead of %f\n", i, j, c[i*size+j], d[i*size+j]); error++; if(error > 16) homecoming 0; } } } printf("ok\n"); }

    so example, having size 960 (for works sizes multiples of 30*8):

    if compile compile time given size: icc -mmic -o3 -restrict -std=c++11 -dsizes -dsize=960 mmul.cpp -o mmul.o

    elapsed time: 0.460745s gflops: 3.840458

    if compile runtime given size: icc -mmic -o3 -restrict -std=c++11 mmul.cpp -o mmul.o

    elapsed time: 2.204564s gflops: 0.802640

    i'm thinking prefetching issue icc can't recognize memory access pattern. looking @ generated asm source, number of vprefetch instructions much more higher in "compile time" version.

    funny fact: check right result of multiplication (the 2 loops @ end of code, rows 178-197) much more slower in compile time version!

    any thoughts? tried #pragma loop_count seems it's useless, doing manual intrinsic prefetching doesn't seem effective.

    thanks in advance answer.

    regards, luca

    the fundamental theorem of computer science states problem can solved layer of indirection.

    the thought leave leave code fixed size loops, , write code dispatch right fixed size loop.

    first alter eightbythirty read this:

    template<int size> inline void eightbythirty(double *__restrict__ a, double *__restrict__ b, double * __restrict__ c) {

    with identical implementation inside. set in namespace details isn't meant user-facing usually.

    next, wrap it:

    inline void eightbythirty(double *__restrict__ a, double *__restrict__ b, double * __restrict__ c, const int size_divided_by_240) { int size=size_divided_by_240; switch( size&7 ) { case 0: break; case 01: eightbythirty<01>(a,b,c); break; case 02: eightbythirty<02>(a,b,c); break; case 03: eightbythirty<03>(a,b,c); break; case 04: eightbythirty<04>(a,b,c); break; case 05: eightbythirty<05>(a,b,c); break; case 06: eightbythirty<06>(a,b,c); break; case 07: eightbythirty<07>(a,b,c); break; } a+=(size&7)*8*30; b+=(size&7)*8*30; c+=(size&7)*8*30; switch( (size>>3)&7 ) { case 0: break; case 01: eightbythirty<1*8>(a,b,c); break; case 02: eightbythirty<2*8>(a,b,c); break; case 03: eightbythirty<3*8>(a,b,c); break; case 04: eightbythirty<4*8>(a,b,c); break; case 05: eightbythirty<5*8>(a,b,c); break; case 06: eightbythirty<6*8>(a,b,c); break; case 07: eightbythirty<7*8>(a,b,c); break; } += (size&(7<<3))*8*30; b += (size&(7<<3))*8*30; c += (size&(7<<3))*8*30; switch( (size>>6)&7 ) { case 0: break; case 01: eightbythirty<1*8*8>(a,b,c); break; case 02: eightbythirty<2*8*8>(a,b,c); break; case 03: eightbythirty<3*8*8>(a,b,c); break; case 04: eightbythirty<4*8*8>(a,b,c); break; case 05: eightbythirty<5*8*8>(a,b,c); break; case 06: eightbythirty<6*8*8>(a,b,c); break; case 07: eightbythirty<7*8*8>(a,b,c); break; default: } += (size&(7<<6))*8*30; b += (size&(7<<6))*8*30; c += (size&(7<<6))*8*30; int steps = size/8/8/8; for( int = 0; < steps; ++i ) { eightbythirty<512>(a+512*i, b+512*i, c+512*i); } }

    this breaks input size 3 bit chunks. invokes fixed-size implementations. 4 branches occur in above code, much of simple jump tables, values less 512*8*30. values greater that, things done in chunks of 512*8*30.

    7*3+1 = 22 implementations of original function implemented, each constant size, compiler can optimize them.

    this can done generically metaprogramming, isn't worth one-off use.

    i may missing *(8*30) in above code when phone call <int size> version of eightbythirty.

    c++ c++11 intrinsics xeon-phi