text:
Q: How get role inside another role oracle I am trying to make a script that allows me to get the roles that are inside another role of all users

A: Granted roles are all in dba_granted_roles, so you can do a simple recursive query to get them.
I prefer connect by when I can get away with the simplicity:
select granted_role
      ,ltrim(sys_connect_by_path(granted_role,'>'),'>') how
from   dba_role_privs rp
connect by prior rp.granted_role = rp.grantee
start with rp.grantee = '<USER>'

I'm using sys_connect_by_path so each returned row tells me the route, e.g. for SYS
GRANTED_ROLE                   HOW
______________________________ __________________________________________________________________________________________________________
ACCHK_READ                     ACCHK_READ
ADM_PARALLEL_EXECUTE_TASK      ADM_PARALLEL_EXECUTE_TASK
APPLICATION_TRACE_VIEWER       APPLICATION_TRACE_VIEWER
AQ_ADMINISTRATOR_ROLE          AQ_ADMINISTRATOR_ROLE
AQ_USER_ROLE                   AQ_USER_ROLE
AUDIT_ADMIN                    AUDIT_ADMIN
AUDIT_VIEWER                   AUDIT_VIEWER
AUTHENTICATEDUSER              AUTHENTICATEDUSER
BDSQL_ADMIN                    BDSQL_ADMIN
BDSQL_USER                     BDSQL_USER
CAPTURE_ADMIN                  CAPTURE_ADMIN
CDB_DBA                        CDB_DBA
CONNECT                        CONNECT
DATAPATCH_ROLE                 DATAPATCH_ROLE
DATAPUMP_EXP_FULL_DATABASE     DATAPUMP_EXP_FULL_DATABASE
EXP_FULL_DATABASE              DATAPUMP_EXP_FULL_DATABASE>EXP_FULL_DATABASE
EXECUTE_CATALOG_ROLE           DATAPUMP_EXP_FULL_DATABASE>EXP_FULL_DATABASE>EXECUTE_CATALOG_ROLE
HS_ADMIN_EXECUTE_ROLE          DATAPUMP_EXP_FULL_DATABASE>EXP_FULL_DATABASE>EXECUTE_CATALOG_ROLE>HS_ADMIN_EXECUTE_ROLE
HS_ADMIN_ROLE                  DATAPUMP_EXP_FULL_DATABASE>EXP_FULL_DATABASE>EXECUTE_CATALOG_ROLE>HS_ADMIN_ROLE
HS_ADMIN_EXECUTE_ROLE          DATAPUMP_EXP_FULL_DATABASE>EXP_FULL_DATABASE>EXECUTE_CATALOG_ROLE>HS_ADMIN_ROLE>HS_ADMIN_EXECUTE_ROLE
...

You'll notice that some roles are granted via multiple other roles, you could do a simple distinct to remove duplicates here (of course you have to give up the route as this is what's making them distinct)
select distinct granted_role
from   dba_role_privs rp
connect by prior rp.granted_role = rp.grantee
start with rp.grantee = '<USER>'


text:
Q: how to connect to SQL Server with SQuirreL SQL from non domain registered Linux box? I need to connect to a SQL 2008 R2 Server from my Linux box that's not registered in my company's domain. I'm trying to use SQuirreL SQL version 3.2.1.
I downloaded Microsoft SQL Server JDBC Driver 3.0 and assigned it to SQuirreL on the Drivers tab.
Now, when I try to create an Alias on SQuirreL, I select the SQL Server driver and adjust the URL. For credentials I use my domain registered username and password.
When I try to test the connection, I always get the same error:
<"database-name">: Logon failure for user '<"domain">\<"domain-user">'.
How can I get this working? Thanks in advance!

A: Another solution that worked for me. On a Windows desktop connecting to SQL Server 2008 R2, I had to follow these steps:

*

*copy the jtds-1.3.1.jar into the SQuirrel SQL \lib directory

*restart SQuirrel SQL and check that you see jTDS Microsoft SQL in the drivers list

*make sure that in the driver configuration the Class Name specifies net.sourceforge.jtds.jdbc.Driver

*use a connection string like this

jdbc:jtds:sqlserver://<hostnameOrIp>:<port>/<databaseName>;instance=<instanceName>

A: I managed to connect to an SQL Server from SQuirrel on a linux box.  Rough* steps ...

*

*You only need one of the jdbc jars from the MS download (copied to 'lib')

*Must use SQL Server auth (not windows network auth)

*SQL Server auth was already enabled on our db

*Added a login 'jdoe'

*Set jdoe default database to 'XxxDb'

*Added a 'User Mapping' from jdoe to the desired database

*Set up permission on the SQL Server for jdoe: 'Connect' and 'View any database'

*Connection string: jdbc:sqlserver://SERVERNAME:1433;databaseName=XxxDb

* May not need all as I poking around

A: I got rid of Microsoft SQL Server JDBC Driver and downloaded jTDS driver. I tweaked a bit with it until I finally got a successful connection. The correct connection string was:
jdbc:jtds:sqlserver://<server_ip>:1433;databaseName=<instance_name>;domain=<domain_name>

A: The answer may be obsolete as I had the similar problem with SQuirrel SQL on MacOS 10.9.3 not on Linux box. The way Peter solved the problem inspired me. As the solution was not most straightforward I decided to put it here. Hope it helps someone.

*

*Download latest Microsoft JDBC Driver 4.0 for SQL Server (tar.gz package)

*Extract only sqljdbc4.jar from the package

*Copy the jar file into Squirrel SQL (Contents->Resources->Java->Lib)

*Now Microsoft MSSQL Server JDBC Driver is available to create Alias

*Connection URL: jdbc:sqlserver://SERVERNAME;databaseName=DATABASENAME

A: For you to connect to MS SQL Server you need to obtain the JDBC drivers:

*

*Download latest Microsoft JDBC Driver

*Choose to download the .tar.gz package

*Extract the package

*In Squirrel-SQL click on Drivers tab on the left side of the window

*Right click on Microsoft MSSQL Server JDBC Driver and choose Modify Driver...

*Click on Extra Class Path

*Click on Add

*Browse to where sqljdbc41.jar is located (it should be under sqljdbc_4.1/enu/jre7/sqljdbc41.jar or similar) and click on Open

*Click on OK

*Now to the left of Microsoft MSSQL Server JDBC Driver in the Drivers list there should be a check mark which means that you installed the driver correctly

To connect to MS SQL Server:

*

*Click on the Aliases tab on the left side of the window

*Click on the + sign to Create a new Alias

*Type a name for your new connection

*In the URL text box paste the JDBC connection string (Azure gives this to you under connection strings for example)

*enter username and password

*click on test to see if the connection can be established

*if test was successful then click on OK to finish creating your connection

If you are having any issues with connecting to Azure SQL database you might need to give access to your specific IP to connect to it or some similar access privileges.

A: Make sure the Microsoft jdbc driver is compatible with your java runtime version you're using,
I was trying to use Driver 6.0 with java-9 and i got this error:
ClassNotFoundException:javax.xml.bind.DatatypeConverter
when i downgraded to version Java SE Runtime Environment 8u101
it connected without problems.

redpajama_set_name: RedPajamaStackExchange


text:
Q: int logctl_get(): open '/dev/hwlog_switch' fail -1, 13. Permission denied In my Huawei phone, I operate:
step1:dial ##2846579##
step2: click Background setting
step3: click LOG setting
step4: trun on Log setting,for example , AP Log
but whenever I reboot, the LOG Settings are back to nothing enabled
has someone can help me?
when I not reboot, in android studio logcat ,log is normal.
But I use
logcatLogfile = open(filePath, 'w+')
logcatSubProcess = subprocess.Popen('adb shell logcat', stdout=logcatLogfile,tderr=logcatLogfile)

logcatLogfile is not whole log,some logs has lost


text:
Q: How can I save row numbers to a table in SQLite? I have added row numbers to a table (merged) thus:
SELECT ROW_NUMBER() OVER (ORDER BY Pclass) RowNum, *
FROM merged;

Which returns:
1|1|0|58|0|0|146.5208|0|20|0|1|1|0.53043592
2|1|0|31|1|0|113.275|0|23|0|1|1|0.671198682
3|1|0|38|0|0|227.525|0|29|0|1|1|0.888825796
4|1|0|36|0|2|71|0|23|1|0|1|0.49853335

However, when I then check merged, the row numbers are no longer present (note that this produces unordered results, but nevertheless shows the point I am making):
SELECT * FROM merged;

2|0|24|0|0|13|0|38|1|0|0|0.505845678
3|1|61|0|0|6.2375|0|25|1|0|0|0.128146005
2|0|17|0|0|12|0|21|0|1|1|0.465261004
2|1|18|0|0|11.5|0|26|1|0|0|0.458356337

I suspect that the way to achieve this is to update merged by adding a new column and then adding the row numbers to said column, but I don't know how to go about it.
As such, my question is this: how can I save row numbers to merged?

A: SELECT statement won't change the merged table. Updating the existing table will be a bit complicated, and I guess there is no trivial way to do that. So the easier way is to create a new table, drop the previous one and renaming the new one to be the old one.
This code should work:
CREATE TABLE new_merged
  AS (SELECT ROW_NUMBER() OVER (ORDER BY Pclass) RowNum, * FROM merged);

DROP TABLE merged;

ALTER TABLE new_merged RENAME TO merged;


text:
Q: How to store an select option values with multidimensional array type name fields in php mysql I have an array like below.
 $permis =array(
 'employee' => array(
      'myprofile' => array(
        'default' => '0', 'personal' => '0', 'job' => '0', 'leave' => '0', 'permission' => '0', 'bonus & commision' => '0', 'document' => '0', 'emergency contact' => '0', 'benifits' => '0'
        ),
        'viewallemployee' => array(
        'default' => '0', 'personal' => '0', 'job' => '0', 'leave' => '0', 'permission' => '0', 'bonus & commision' => '0', 'document' => '0', 'emergency contact' => '0', 'benifits' => '0', 'notes' => '0', 'onboard' => '0', 'offboard' => '0', 'charts' => '0'
        )
    )
);

i am using for each in to this array and get the output like below :
    <?php

 foreach($permis as $key => $myprofile){

    $module = $key;
    foreach($myprofile as $key => $profile){
    $submodule = $key;

        foreach($profile as $key => $data){

        ?>

<?php echo $module; ?>
<?php echo $submodule; ?>
<?php echo $key; ?>

<?php echo $submodule.$key; ?>
<select name="<?php $submodule.$key; ?>">
<option value='<?php $data ?>'><?php echo $data; ?></option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>

<?php
}
    }

}

?>

My question is i want to store my select option values into my mysql database tabel with arrayname and keyname example
myprofile default 0
myprofile personal 0 etc.
How to do this. please anyone help me

A: you can use json_encode to convert array into string and then you can store in database. OR you can use serialize() to convert array into storable format in Mysql.
Try this:
json_encode($permis); // Can be stored in Database

OR this:
serialize($permis); // Can be stored in Database


text:
Q: OrderBy does not order correctly I have the following query

var predicate = PredicateBuilder.True<SearchModel>();
            predicate = predicate.And(x => (templateIDs.Contains(x.TemplateId))); // To match certain templates only

var products = searchContext.GetQueryable()
                                           .Where(predicate)
                                           .OrderBy(i => i.Title) //will order the items by display
                                           .Take(pageSize); //pageSize is passed through and is an integer
                                           .GetResults();

I never get the results ordered alphabetically.
If I do the following however, the results are ordered correctly.
var fullResults = searchResults.ToList().OrderBy(x=>x.Title).Take(pageSize); //pageSize is passed through and is an integer

Does anyone know why?
And If I do it the second way (.ToList().OrderBy().Take().), would it have any performance implications, as I believe the results will be ordered and paged after the results are fetched from Solr?

A: Sorting in Solr can be a bit confusing. Historically, there has also been some issues around sorting in the ContentSearch provider for Solr, where orderby clauses has been inversed etc. Assuming you're on a fairly recent Sitecore version, these issues has been fixed as far as I know. In order to pinpoint where your problem is, you should look in the search.log and verify that the predicate builder/content search actually performs the query you expect.
Given that the above is ok, you're probably facing a common misunderstanding on how Solr works. I'd guess your Title field is indexed as a "text" field, such as title_t_en, and not a string field. Text fields are tokenized and stemmed before being stored in Solr. Sorting will therefore be performed on the tokenized terms instead of the whole string. This means a text, such as "The quick brown fox jumps over the lazy dog", will be stemmed to something like ["quick", "brown", "fox", "jump", "over", "lazy", "dog"] and an order by statement will sort it on "brown". This may cause the sorting to look very wrong, as the result may not be sorted on the first word in the string.
One way of solving this is to save a copy of your Title field into a title_s field. You can either do this with a copy statement in the solr schema or if you want to keep the schema untouched, you can make a computed field mapped as a string. Thereby you can perform a lingual text query on the stemmed text field and order the result on the string field.


text:
Q: iOS Swift - Epson POS Printer - ePOS SDK - addTextSize - How to change text size back to original size? I'm building a POS on iPad using swift to print to Epson printers over ethernet connection.
I'm using Epson docs and sample projects to have the printers up and running no problem.
Now heres the problem:
I need to change text size (bigger) then revert back to original text size - I can initially change textSize no problem -> but when I revert back to the original size it does get smaller but it is not as small as the original. See below:

According to Epson docs - addTextSize() - is the method I am looking for and it accepts an Int value between 1-8 to scale both height and width (it states that 1 is the default value)
https://reference.epson-biz.com/modules/ref_epos_sdk_ios_en/index.php?vid=ref_epos_sdk_ios_en_epos2printerclass_addtextsize#BHIHFBFB
So here is my code:
func sendPrint(printer: Epos2Printer) -> Bool {
    var result = EPOS2_SUCCESS.rawValue
    let textData: NSMutableString = NSMutableString()

    result = printer.addFeedLine(2)
    if result != EPOS2_SUCCESS.rawValue {
        printer.clearCommandBuffer()
        MessageView.showErrorEpos(result, method:"addFeedLine")
        return false
    }

    textData.append("Food item       $12.00\n")
    textData.append("Food item       $12.00\n")
    textData.append("Food item       $12.00\n")
    textData.append("Food item       $12.00\n")

    // SEND AT ORIGINAL TEXT SIZE (Should be 1,1)
    result = printer.addText(textData as String)
    if result != EPOS2_SUCCESS.rawValue {
        printer.clearCommandBuffer()
        MessageView.showErrorEpos(result, method:"addText")
        return false
    }
    textData.setString("")

    // CHANGE TEXT SIZE BIGGER WIDTH (2,1)
    result = printer.addTextSize(2, height:1)
    if result != EPOS2_SUCCESS.rawValue {
        printer.clearCommandBuffer()
        MessageView.showErrorEpos(result, method:"addTextSize")
        return false
    }

    textData.append("ADDRESS               \n")
    textData.append("CITY                  \n")
    textData.append("STATE                 \n")
    textData.append("ZIPCODE               \n")

    result = printer.addText(textData as String)
    if result != EPOS2_SUCCESS.rawValue {
        printer.clearCommandBuffer()
        MessageView.showErrorEpos(result, method:"addText")
        return false
    }
    textData.setString("")

    // CHANGE TEXT SIZE BACK TO DEFAULT (1,1)
    result = printer.addTextSize(1, height: 1)
    if result != EPOS2_SUCCESS.rawValue {
        printer.clearCommandBuffer()
        MessageView.showErrorEpos(result, method:"addTextSize")
        return false
    }

    textData.append("Food item       $12.00\n")
    textData.append("Food item       $12.00\n")
    textData.append("Food item       $12.00\n")
    textData.append("Food item       $12.00\n")

    result = printer.addText(textData as String)
    if result != EPOS2_SUCCESS.rawValue {
        printer.clearCommandBuffer()
        MessageView.showErrorEpos(result, method:"addText")
        return false
    }
    textData.setString("")

    result = printer.addFeedLine(2)
    if result != EPOS2_SUCCESS.rawValue {
        printer.clearCommandBuffer()
        MessageView.showErrorEpos(result, method:"addFeedLine")
        return false
    }

    result = printer.addCut(EPOS2_CUT_FEED.rawValue)
    if result != EPOS2_SUCCESS.rawValue {
        printer.clearCommandBuffer()
        MessageView.showErrorEpos(result, method:"addCut")
        return false
    }

    printer.beginTransaction()
    result = printer.sendData(Int(EPOS2_PARAM_DEFAULT))
    if result != EPOS2_SUCCESS.rawValue {
        printer.clearCommandBuffer()
        MessageView.showErrorEpos(result, method:"sendData")
        printer.disconnect()
        return false
    }
    printer.endTransaction()
    return true
}

Now I know a workable option is to set the textSize from the beginning - but I would prefer to keep the top and bottom the smallest size possible.
I have also tried specifying EPOS2_PARAM_DEFAULT as a parameter which produces the same results - I've tried 0 as the input which causes the textSize change to fail - I tried using a double like 1.5 or .5 but that doesn't compile
Any ideas?
Thanks for your help!

A: After tons of attempts i figured it out - I'll keep the post up since it might help someone in the future as iPads seem to be becoming more popular for POS solutions
So it appears the font also gets changed when you change the text size - I think it might be a bug in the Epos SDK because they state that the default font is EPOS2_FONT_A but it appears that the initial font starts as EPOS2_FONT_B -> then when you change text size it reverts font back to EPOS2_FONT_A (default)
If you want to keep it on the smaller font simply set addTextFont(EPOS2_FONT_B) in the beginning of preparing your print data


text:
Q: How to get the right MAC address from ARP command? Disclaimer: new to Linux, using Raspbian Light on a Pi 3. SSH access only.
I'm trying to look for the mac address using ping / arp:
ping 192.168.1.7
arp 192.168.1.7

It returns:
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.1.7              ether   02:0f:b5:ed:9e:5c   C                     eth0

The HWaddress is different from the mac address I see in Windows:
ping 192.168.1.7
arp -a 192.168.1.7

This results in:
Internet Address      Physical Address      Type
192.168.1.7           c0-ee-fb-ed-9e-5c     dynamic

Network topology

Pi on cable (.27) → switch on cable → router (.1)
  Phone on wifi (.7) → router (.1)
  Windows on wifi (.30) → router (.1)

How can I get my Pi to return the same Mac?
Note: looks like the 'vendor' part is different. So it's 'almost' right?

A: Best guess: Your RaspPi is connected to the router via LAN, while the "target" phone and the Windows PC are connected via WLAN. That means while the phone and the Windows PC are in the same segment and ARP works as intended, normally the LAN and the WLAN wouldn't be in the same segment.
Since they seem to be in the same segment (same /24 prefix), I'd assume the router does some fancy things to make that work, like MAC NAT via ebtables. The fact that the "spoofed" MAC address only differs in vendor prefix, and the vendor prefix doesn't seem to be valid, also points to this.
You can test this by connecting your Windows PC to the router via LAN (cable), and see which MAC address it reports in that case.
Another way to test it is to get root access to your router, and have a look at what's happening inside.
Edit
If this guess is correct, it's purely a router issue, not an issue of Linux vs. Windows. Windows will also find the "wrong" MAC address if the Windows PC is connected via LAN, while the target phone is connected via WLAN. Every device that is connected via WLAN will see the "wrong" MAC address of every device that is connected via LAN, and vice versa.
And you can't "work around" it, unless you can configure your router to disable it. In that case you'll have probably different subnets for LAN and WLAN, and the RaspPi in the LAN won't see the MAC of any device in the WLAN at all (and vice versa), though they can communicate with each other.
That's just how networking works.
The question is: Why do you need the "correct" MAC address in the first place? You shouldn't need to.

A: The arp command will give you the right mac adress of the rpi network interface and you can verify it as follow:
ssh pi@192.168.1.7
sudo cat /sys/class/net/eth0/address

The c0-ee-fb-ed-9e-5c is the mac adress of your One Plus phone.


text:
Q: React Native: Show Icon on BottomTab I am new in react-native and i am working on an app.
The below code is a simple react-native app which accepts input1 and input2 as numeric and produces the result of sum of input1 and input2 dynamically.
But the problem is i am not able to load icons on Bottomsheet.
Please find the code and screenshot below.
App.js
import React, { useState } from 'react';
import { View, TextInput, Text } from 'react-native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer } from '@react-navigation/native';
import Icon from 'react-native-ionicons'

const Tab = createBottomTabNavigator();

const SimpleCalc = () => {
    const [ input1, setInput1 ] = useState(0);
    const [ input2, setInput2 ] = useState(0);

    const HomeScreen = () => {
        return (
            <View style={{ padding: 20 }}>
                <View>
                    <Text style={{ fontSize: 20, color: '#000' }}>{ parseFloat(input1) + parseFloat(input2) }</Text>
                </View>
                <View>
                    <TextInput
                        placeholder="Enter Input 1"
                        onChangeText = {(text) => { setInput1(text); }}
                        value = {input1 + ''}
                        style={{ color: '#000' }}
                        keyboardType='numeric'
                    />
                    <TextInput
                        placeholder="Enter Input 2"
                        onChangeText = {(text) => { setInput2(text); }}
                        value = {input2 + ''}
                        style={{ color: '#000' }}
                        keyboardType='numeric'
                    />
                </View>
            </View>
        )
    }

    const SettingScreen = () => {
        return (
            <Text>Setting Screen</Text>
        );
    }
    return (
        <NavigationContainer>
            <Tab.Navigator>
                 <Tab.Screen name="Home" component={HomeScreen}
                   options={{
                     tabBarLabel: 'Salary',
                     headerShown: false,
                     tabBarIcon: ({ color, size }) => <Icon name="add" size={size} color="#000" />
                   }} />
                 <Tab.Screen name="Settings" component={SettingScreen} options={{ tabBarLabel: 'Settings', activeTintColor: '#6F2DA8', headerShown: false }} />
            </Tab.Navigator>
        </NavigationContainer>
    );
}

export default SimpleCalc;

Package.json
{
  "name": "SimpleCalc",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-navigation/bottom-tabs": "^6.0.9",
    "@react-navigation/native": "^6.0.6",
    "install": "^0.13.0",
    "npm": "^8.3.1",
    "react": "17.0.2",
    "react-native": "0.66.4",
    "react-native-ionicons": "^4.6.5",
    "react-native-material-textinput": "^1.3.0",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.10.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

Screenshot

Please help me on this issue

A:
tabBarIcon is a function that is given the focused state, color, and size params.

<Tab.Screen
  name="Home"
  component={HomeScreen}
  options={{ tabBarIcon: ({ focused, color, size }) => <IconComponent /> }}
/>

Also, you can centralize the tabBarIcon and move it to the <Tab.Navigator> component:
<Tab.Navigator
  screenOptions={({ route }) => ({
    tabBarIcon: ({ focused, color, size }) => {
      let iconName;

      if (route.name === "Home") {
        iconName = focused
          ? "ios-information-circle"
          : "ios-information-circle-outline";
      } else if (route.name === "Settings") {
        iconName = focused ? "ios-list-box" : "ios-list";
      }

      // You can return any component that you like here!
      return <Ionicons name={iconName} size={size} color={color} />;
    },
    tabBarActiveTintColor: "tomato",
    tabBarInactiveTintColor: "gray",
  })}
>
  <Tab.Screen name="Home" component={HomeScreen} />
  <Tab.Screen name="Settings" component={SettingsScreen} />
</Tab.Navigator>

Read more about customizing the appearance of the BottomTabs navigation in the official documentation.

A: Icon font is not synced with other UI elements at application run time.To solve  the issue, edit android/app/build.gradle ( NOT android/build.gradle ) and add the following:
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"


text:
Q: RaphaelJs Drag constraints I have a slider in which I want to be able to drag in the x-co ordinate only and and set constraints beyond which the shape cant be dragged (the shape shouldn't go beyond the line in both the directions). How can it be achieved?
JS Fiddle Link
window.onload = function(){

    var paper = Raphael(0,0,700,150);

    var sliderline = paper.rect(68,100,606,1).attr({fill:'red',stroke:'none'});
    var slider = paper.rect(100,98,18,7,4).attr({fill:'#7cc576','stroke-width':'2','stroke':'white'}).glow({width:1,opacity:10,color:'green'});
}

A: Start by assigning the handlers to the drag event. Inside the handler you can move the slider any way you wish.


text:
Q: Cell from nib for UITableView preload At first I had this code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    DropDownTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DropDownTableViewCell"];
    if (!cell) {
        NSArray *topLevelObjects =
        [[NSBundle mainBundle] loadNibNamed:@"DropDownView"
                                      owner:self
                                    options:nil];

        for (DropDownTableViewCell *object in topLevelObjects) {
            if ([object class] == [DropDownTableViewCell class]) {
                cell = object;
                break;
            }
        }
        NSAssert(cell, @"Cell must not be nil");
    }

    cell.nameLabel.text = [self.dataSource buttonDownPicker:self stringForRowAtIndexPath:indexPath];

    return cell;
}

At first moment when I show tableView and tableView cell's starts loading from nib I have UI freezing for a few seconds (caused by loading from nib for EVERY displayed cell). This can be solved by loading cell from nib earlier:
- (void)awakeFromNib {
   DropDownTableViewCell *cell = [[[NSBundle mainBundle] loadNibNamed:@"DropDownView" owner:self options:nil] objectAtIndex:0];
}

But this way looks "hacky". Is there more appropriate solution?
Edit according to given answers:
I've tried to use registerNib forCellIdentifier but it didn't LOAD nib, it just BINDING nib with identifier and at first time when tableView appears all cells causing load nib to memory

A: This is not "hacky" at all. For loading cells from a nib what you usually do is load the nib and then register the cell for reusable identifier of your choosing. For instance in one of my projects I have a view controller with a table view. In the view did load I call:
[[NSBundle mainBundle] loadNibNamed:@"ChannelListCell" owner:self options:nil];
[self.channelListTableView registerNib:[UINib nibWithNibName:@"ChannelListCell" bundle:nil] forCellReuseIdentifier:@"channelListCell"];

Then in the cell for row at index path:
cell = [tableView dequeueReusableCellWithIdentifier:@"channelListCell" forIndexPath:indexPath];

In your case the dequeued cell is always nil since you did not register it.

A: Try like this.....
- (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.

        UINib *nib = [UINib nibWithNibName:@"" bundle:nil];
        [self.tblview registerNib:nib forCellReuseIdentifier:@"DropDownTableViewCell"];
    }

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

        DropDownTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DropDownTableViewCell"];

        return cell;
    }

A: You can register your class first like bellow in your viewDidLoad. It make faster and better
[self.tableViewObject registerClass: [DropDownTableViewCell class]forCellReuseIdentifier:@"DropDownTableViewCellIdentifier"];

And please add following method in your DropDownTableViewCell.m file
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"DropDownTableViewCell" owner:self options:nil];
        // Grab a pointer to the first object (presumably the custom cell, as that's all the XIB should contain).
        self = [topLevelObjects objectAtIndex:0];
    return self;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier=@"DropDownTableViewCellIdentifier";
    DropDownTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];

//Access all cell properties here.

return cell.
}

Please refer https://stackoverflow.com/a/30954273/914111 for better knowledge.


text:
Q: Swift: Hidden navigation bar appears when tap occurs in view Introduction
I'm creating a simple app in with the RootViewController is embedded in a UINavigationController. I have a UIView subclass "landscapeView" with a UICollectionView in it that fills the view. "landscapeView" is hidden in portrait and displayed in landscape device orientation.
Issue
When the device is rotated to a landscape orientation I hide the navigationBar and the portrait table view "rootTableView", while showing the "landscapeView". However, the navigationBar appears when I tap the screen in landscape orientation. I can't figure out how to disable this tap to show thing. (I have `navigationController?.hidesBarsOnTap = false, its setup to default in storyboard).
Clarification: hiding the navigation bar works perfectly depending on device orientation.
Question
How can I prevent the navigationBar from appearing when the screen is tapped in landscape orientation?
Code

*

*viewWillTransition() in the "RootViewController"
private let landscapeView = LandscapeView(frame: .zero)
private let rootTableView = UITableView(frame: .zero, style: .grouped)

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransition(to: size, with: coordinator)

    var isLandscape = true
    switch UIDevice.current.orientation {
    case .landscapeLeft:
        navigationController?.navigationItem.searchController?.accessibilityElementsHidden = true

        isLandscape = true
    case .landscapeRight:

        navigationController?.navigationItem.searchController?.accessibilityElementsHidden = true

        isLandscape = true
    case .portrait, .portraitUpsideDown, .faceUp, .faceDown, .unknown:

        isLandscape = false
      navigationController?.navigationItem.searchController?.accessibilityElementsHidden = false

    default:
        break
    }

    if isLandscape {
        navigationController?.setNavigationBarHidden(true, animated: false)
        self.landscapeView.isHidden = false

        // This simply tells the "landscapeView" to layoutSubviews() and reloadData() for the collectionView within.
        landscapeViewDelegate?.landscapeViewWillAppear(inDarkMode: inDarkMode)
    }
    UIView.animate(withDuration: 0.6, delay: 0, options: .layoutSubviews, animations: {
        // This is a tableView displayed in portrait mode.
        self.rootTableView.alpha = isLandscape ? 0 : 1
        self.landscapeView.alpha = isLandscape ? 1 : 0
    }) { (success) in
        if isLandscape == false {
            self.landscapeView.isHidden = true
             self.navigationController?.setNavigationBarHidden(false, animated: true)
        }
        return
    }
}

Thanks for reading.

A: The issue is that you checked Hide Bars When Vertically Compact for your navigation controller in the storyboard. This property brings that tap behaviour with it:

When the value of this property is true, the navigation controller
  hides its navigation bar and toolbar when it transitions to a
  vertically compact environment. Upon returning to a vertically regular
  environment, the navigation controller automatically shows both bars
  again. In addition, unhandled taps in the content area cause the
  navigation controller to show both bars again. The default value of
  this property is false.

You can uncheck that property since you take care of showing and hiding the navigation bar in the viewWillTransition method yourself.


text:
Q: Elements of prime order in symmetric groups I have been assigned the following task:
"Explain briefly why there can be no odd elements of prime order except for order $2$ in any symmetric group $S_n$."
Unless I am largely mistaken in my understanding of the notions of order and the sign of a permutation, I have come up with the following:
$[3,3,3,1]$ is an element of $S_{10}$ with order $3$, and is even.
$[7, 1, 1]$ is an element of $S_9$ with order $7$, and is odd.
Am I mistaken in thinking that this shows that not only do there exist odd elements of prime order $p≠2$, but also that there exist even elements of order $2$ (the former contradicting the statement in the question)?

A: A $7$-cycle is even because we can break it into transpositions $$(a_1,a_7)(a_1,a_6)(a_1,a_5)(a_1,a_4)(a_1,a_3)(a_1,a_2)$$
And as you can see there are six transpositions, so this permutation is even.


text:
Q: Property resets when changing Usercontrols DependencyProperty I've constructed a "Manager" of "Widgets" where i have a ListView/GridView with widgets.
The ListView binds the SelectedItem to a SelectedWidget property on the (Manager) ViewModel.
The SelectedWidget binds to a Usercontrol called WidgetConfig via a DependencyProperty called "Widget" where you can modify the properties of the selected Widget.
In the WidgetConfig , there are 2 RadioButtons:
<RadioButton GroupName="Lead" IsChecked="{Binding Widget.prop1, Mode=TwoWay, ElementName=root}" />
<RadioButton GroupName="Lead" IsChecked="{Binding Widget.prop2, Mode=TwoWay, ElementName=root}" />

When i select the 'prop2', the INPC signal is correctly sent and the model is updated accordingly. If then i click on the 'prop1', the INPC signal is sent + i get an additional signal from the prop2 radiobutton.
Here's the problem:
if i select prop2 and then select another Widget in the ListView. I get a INPC signal and prop2 has changed back to false!
what's going on ?
Some info:

*

*The WidgetConfiguration is implemented using PostSharp NotifyPropertyChanged aspect.

*The WidgetConfig UserControl is implemented by hand with DependencyProperty and INotifyPropertyChanged interface

EDIT:
I've created a reproducible example here : https://github.com/Montago/INCP-DP-BindingExample

A: What you have is a chain of two-way bindings, which are changing values on your Model:
Two-way binding between ListControl.SelectedItem(DP) and the ViewModel.SelectedModel(INPC).
Two-way binding between ViewModel.SelectedModel(INPC) and ModelControl.ActiveModel(DP).
Two-way binding between ModelControl.ActiveModel(DP) and Model.Prop1/Model.Prop2/Model.Name(INPC).
When you select First, Second and then again First, Second's prop2 is overwritten to false by WPF data binding.
A way to fix this is to remove the two-way binding that makes the overwrite of prop2, i.e. specify Mode=OneWay on RadioButton bindings.
My guess of what is happening: RadioButton's logic and two-way binding. When Second is selected in the list box and you change the selection to First, WPF's data binding sets Prop1 radio button as selected (because First.prop1 == true). At that point, the second radio button is still selected, so to respect the group principle, it needs to get unselected. However, there is still the two-way binding active on the Prop2 radio and thus Second.prop2 gets set to false.


text:
Q: collect multiple inputs file to append to FormData Suppose I have the following form.
<form id="testForm">
  <input type="file" name="uploads[]">

  <input type="file" name="uploads[]">

  <input type="file" name="uploads[]">

  <input type="submit">
</form>

And this is part of the submit code which tries to collect files to append to FormData, but I don't know how to do it properly.
var formData = new FormData();

var fileList = $("input[name='uploads[]']");
for(var x = 0; x < fileList.length; x++) {
  formData.append('file'+x, ???);
  console.log('appended a file');
}

var request = new XMLHttpRequest();
request.open('POST', '/upload');
request.send(formData);

request.onload = function(e) {
  console.log('Request Status', request.status);
};

This is the server code.
app.post('/upload', function(req, res) {
  var form = new formidable.IncomingForm();
  form.parse(req, function(err, fields, files) {
    console.log('handling form upload - fields', fields);
    console.log('handling form upload - files', files);
  });
  res.send('Thank you');
});

If it works, I expect to see output and files saved in /tmp.

A: You don't have to collect fields since you can put the form itself into FormData object:
var form = document.getElementById('testForm');

form.addEventListener('submit', function(e) {

  e.preventDefault();

  var request = new XMLHttpRequest();
  request.open('POST', '/upload');

  request.onload = function(e) {
    console.log('Request Status', request.status);
  };

  var formData = new FormData(form);
  request.send(formData);
});

UPDATE
If you need to upload several files, you might use multiple attribute on the input instead of several inputs:
<form id="testForm">
  <input type="file" name="upload" multiple>
  <input type="submit">
</form>


text:
Q: is there a way to fix this error regarding list indexes? I am trying to swap two indexes of a list accessed by entering a command followed by two numbers corresponding to the indexes that i would like to swap with each other, however it returns an error (at bottom of the page)
Is this because of the fact that the list does not contain strings /  integers ?
Does this require me to transform the string part of the command output (the commands themselves) to integers?
Following my code:
todo_list = []

#command that manages all of the user inputs, jurisdicting the specific key words being allocated with the specific functions associated with it
#whilst blocking out the rest of the data thats entered that does not begin with a tag. (e.g. random stuff.)

def parse_command(cmd):
    arg = cmd.split()
    if arg[0] == 'add':
        add_item(arg[1])
    elif arg[0] == 'remove':
        remove_item(arg[1])
    elif arg[0] == 'mv':
        move_item(arg[1], arg[2], todo_list)
    elif arg[0] == 'ls':
        list_items()
    else:
        print("not a valid command")

def add_item(item):
    for i in range(0, 1):
        tasks = item
        todo_list.append(tasks)
    print("Your to-do list so far: ", todo_list)

def remove_item(idx):
    #removal message
    print("successfully removed todo-list entry position #{}".format(idx))
    #remove by index
    todo_list.pop(int(idx))

def move_item(idx1, idx2, todo_list):
    #swap message
    print("successfully swapped list position #{} with #{}".format(idx1,idx2))
    #swapping list indexes
    todo_list[int(idx1)], todo_list[int(idx2)] = todo_list[int(idx2)], todo_list[int(idx1)]
    return (int(todo_list))

def list_items():
    for x in range(len(todo_list)):
        return todo_list[x]

while(True):

    cmd = input("Please input command: ")
    parse_command(cmd)

When I input mv 0,3 to Please input command: , I get the following error:
IndexError                                Traceback (most recent call last)
<ipython-input-105-751618dd832b> in <module>
     51
     52     cmd = input("Please input command: ")
---> 53     parse_command(cmd)
     54
     55

<ipython-input-105-751618dd832b> in parse_command(cmd)
     13         remove_item(arg[1])
     14     elif arg[0] == 'mv':
---> 15         move_item(arg[1], arg[2], todo_list)
     16     elif arg[0] == 'ls':
     17         list_items()

IndexError: list index out of range

A: There are several problems with your code:
Firstly, by entering 'mv 0,3' you are entering two arguments, not three. If you want to access these arguments, you will need to split the second argument (by a comma).
The below will fix that issue, HOWEVER this is not the only issue:
def parse_command(cmd):
    arg = cmd.split()
    #try:
    if arg[0] == 'add':
        add_item(arg[1])
    elif arg[0] == 'remove':
        remove_item(arg[1])
    elif arg[0] == 'mv':
        args = arg[1].split(',')
        print(args)
        move_item(int(args[0]), int(args[1]), todo_list)
    elif arg[0] == 'ls':
        list_items()
    else:
        print("not a valid command")
    #except IndexError:
        #print("Usage: <Command> <arguments>")

I have deliberately left the error handling commented, and the inner block unindented, so you can see the remaining issues with your code.
Changing the move_item function to the following:
def move_item(idx1, idx2, todo_list):
    #swapping list indexes
    todo_list[idx1], todo_list[idx2] = todo_list[idx2], todo_list[idx1]
    print("successfully swapped list position #{} with #{}".format(idx1,idx2))

    return (todo_list)

This will throw another IndexError when you input the command mv 0,3, as the list todo_list is empty. You either need to make sure that the indexes provided to move_item are in range, or handle the IndexException that is thrown when they aren't.
I would suggest passing the list to alter into the parse_command function, to make it clear which list you are trying to alter. I would then either check that the indexes in args are in the range of the list passed to move_item, or handle any IndexError thrown by move_item.


text:
Q: Swift: Add cells containing a custom label from an array to an UITableView How do I programmatically add cells to a UITableview and fill the cells with data from myArray[cellNumber]. The data in the array is of type String. The tableview is just an UITableView connected with an outlet.
All the examples I've found is either +30 lines or doesn't work... I'm using swift 4 and UIKit.

A:     let array = ["Monday", "Friday", "Saturday", "Sunday"]

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
    cell.textLabel?.text = array[indexPath.row]

    return cell
}

If this doesn't work for you, I need more info from your code to check another possible error.
In case you create the tableview from code, you need to define

tableview.datasource = self
tableview.delegate = self

and make class extend from UITableViewDelegate and UITableViewDataSource

A: This is the way you Handle cell selection.
    // Data model: These strings will be the data for the table view cells
    let myArray: [String] = ["Horse", "Cow", "Camel", "Sheep", "Goat"]

    // create a cell for each table view row
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
                  // create a new cell if needed or reuse an old one
                  var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell
                // set the text from the data model
                cell.textLabel?.text = self.myArray[indexPath.row]
           return cell
     }

Things you should consider for :

*

*Conform to the TableView Delegate and DataSource protocols.
UITableViewDelegate and UITableViewDataSource

*Connect the Interface Builder Outlets
Connect the referencing, dataSource and delegate outlets.

*Register the cell class
In the viewDidLoad method call the registerClass(_:forCellReuseIdentifier:).

*Create the cell with correct ReuseIdentifier name var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCel
By now your ViewController class should look like this:
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
    @IBOutlet
    var tableView: UITableView
    var myArray: [String] = ["We", "Heart", "Swift"]

    override func viewDidLoad() {
        super.viewDidLoad()

        self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
    }

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return self.myArray.count;
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell

        cell.textLabel?.text = self.myArray[indexPath.row]

        return cell
    }

    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        println("You selected cell #\(indexPath.row)!")
    }
}

The example below is an adaptation and simplification of a longer post from We ❤ Swift.
Apple Developers Doc Create a Table View

A: the below example should work for you. Enjoy :)
class TableviewDemoViewController: UIViewController, UITableViewDelegate , UITableViewDataSource {

//MARK: - IBOutlet
@IBOutlet weak var tableView: UITableView!

//MARK: - Variables
let arrayToPopulate = ["Monday", "Tuesday", "Wednesday","Thursday", "Friday", "Saturday", "Sunday"]
let tableviewCellHeight = 50.0

//MARK: - View initializer
override func viewDidLoad() {

    super.viewDidLoad()
    self.setupTableview()
}

func setupTableview() {

    tableView.datasource = self
    tableView.delegate = self
}

//MARK: -UITableViewDelegate
func numberOfSections(in tableView: UITableView) -> Int {
    return 1
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return arrayToPopulate.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
    cell.textLabel?.text = arrayToPopulate[indexPath.row]
    return cell
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    return tableviewCellHeight
} }


text:
Q: Add delete item button - ToDo App - Dart I'm very new to dart, so don't judge me. :))
I just started to write a simple ToDo App in Dart. I want to add a button to the item, so i can delete it from the list. I add the button successfully, but don't get the click event working.
I know why the code isn't working, but don't know, what the best solution would be to solve this.
Some improvements would be awesome.
Thanks in advance
Ron
my little sexy dartpad

A: You need to register the onClick listen to remove the current item on every button. Here's a working version of your code.
import 'dart:html';

InputElement toDoInput;
UListElement toDoList;

void main() {
  toDoInput = querySelector('#to-do-input');
  toDoList = querySelector('#to-do-list');

  toDoInput.onChange.listen(addToDoItem);
}

// Add item to list
void addToDoItem(Event e) {
  final toDoItem = new LIElement();
  toDoItem.text = toDoInput.value;

  final deleteItemButton = new ButtonElement()
    ..text = 'Delete'
    ..onClick.listen((_) => toDoItem.remove());

  toDoItem.children.add(deleteItemButton);
  toDoList.children.add(toDoItem);

  toDoInput.value = '';
}


text:
Q: How can I solve the "Type '{ body: string; text: string; }' is not assignable to type 'DefaultTheme" on React with typescript I am new in programming and now I am working on my first project using React with Typescript and styled components. I am trying to add a dark mode component for my website but for 2 days I encountered a problem that I cannot overcome.
This is my App.tsx:
const App = () => {
  const [theme, setTheme] = useState('light');
  const themeToggler = () => {
    theme === 'light' ? setTheme('dark') : setTheme('light')
}

  return (
      <ThemeProvider theme = {theme === 'light' ? lightTheme : darkTheme}>
        <>
      <Navbar />
      <button onClick={themeToggler}>Switch Theme </button>
      <GlobalStyle text={""} body={""} background={""} toggleBorder={""} />
      {<Routes location={location} key={location.pathname}>
        <Route path='/' element={<MainPage />} />
        <Route path='/about' element={<About />} />
        <Route path='/portfolio' element={<Portfolio />} />
        <Route path='/contact' element={<Contact />} />
      </Routes> }
        </>
      </ThemeProvider>
  )
  }

My styled.d.tsx
declare module 'styled-components' {
  export interface DefaultTheme {
    background: string
    toggleBorder: string
    text: string
    body: string
  }
  export interface ColorsInterface {
    primary: string
    secondary: string
  }
}

This is the error that I can not solve.
Type '{ body: string; text: string; }' is not assignable to type 'DefaultTheme | ((theme: DefaultTheme) => DefaultTheme)'.
  Type '{ body: string; text: string; }' is missing the following properties from type 'DefaultTheme': background, toggleBorderts(2322)
index.d.ts(350, 5): The expected type comes from property 'theme' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<ThemeProviderProps

I am trying to make a dark mode theme changer with dark theme and light theme

A: I believe you got this error because you interface DefaultTheme defines the propreties background: string, toggleBorder: string, text: string, body: string and this object Type '{ body: string; text: string; }' hasn't all pripreties.


text:
Q: In a loop, how do I get the text from an h3 element? So I want to get the text on the h3 element, but I don't know how to get the text. I keep getting empty results. This was my last attempt:
    $('#budgetOverviewResult .budget-inner-table').each(function() {
        var insideText = $(this).children('h3:first').text();
        console.log(insideText);
    })

And here is the HTML

supercalifragilisticexpialidocious

    ...some code

A: Something like this might help
$('.budget-inner-table').each(function() {
    var insideText = $(this).find('h3').eq(0).text();
    console.log(insideText);
    //rest of code
});

EDIT: Explained
OPs HTML code had no id tag which would cause problems because the JQuery selector wouldn't be able to find the element. Secondly, I've personally found using .eq() better than using a pseudo selector as :first.


text:
Q: Conditions for a matrix to be diagonalizable Let $M$ be a matrix with the entries $a_{1}, \dots , a_{n}$ on the secondary diagonal (the one that ranges from $m_{n1}$ to $m_{1n}$) with all other entries being $0$. Find under which conditions the matrix is similar to a diagonal matrix.

If the matrix is similar to a diagonal matrix, it follows that $M = PAP^{-1}$ where $A$ is a diagonal matrix (namely the one with the eigenvectors of $M$) and for a matrix $P$. In other words, this means that it will be a diagonalizable matrix.
I tried to first compute the characteristic polynomial of the matrix $M$, but I don't find that helpful as we would have the determinant of a matrix with terms in its main and second diagonal, making the determinant having a complicated form (I'm sure it can be done though).
What would be the way to determine under which conditions this matrix is diagonalizable or not? I'm currently lost at this step.

A: $\begin{pmatrix}0&0&0&0&a_1\\0&0&0&a_2&0\\0&0&a_3&0&0\\0&a_4&0&0&0\\a_5&0&0&0&0\end{pmatrix}$ has characteristic polynomial $\det \begin{pmatrix}-\lambda&0&0&0&a_1\\0&-\lambda&0&a_2&0\\0&0&a_3-\lambda&0&0\\0&a_4&0&-\lambda&0\\a_5&0&0&0&-\lambda\end{pmatrix}=(\lambda-a_3)(\lambda^2-a_2a_4)(\lambda^2-a_1a_5)$. This pattern persists. So the signs of $a_na_1$, $a_{n-1}a_2$ etc determine whether you have a complete factorization over ${\Bbb R}$. Then of course distinct eigenvalues will ensure independent eigenvectors to make your matrix $P$.

A: Let $p(x)$ be the characteristic polynomial of $M$. Then $discrim(p)$ is  a product of terms of the form $a_i$ or $a_ia_j-a_ka_l$ (where $i,j,k,l$ are distinct) or $a_ia_j-a_k^2$ (where $i,j,k$ are distinct). Assume that the $(a_i)_i$ are generic, that is, the $(a_i)_i$ are complex numbers that are mutually transcendental over $\mathbb{Q}$. Then $discrim(p)\not=0$ and $M$ has $n$ distinct eigenvalues; therefore $M$ is diagonalizable over $\mathbb{C}$. As a consequence, if we randomly choose the $(a_i)_i$ in $\mathbb{Q}$, then $M$ is "almost always" diagonalizable over $\mathbb{C}$.
EDIT. Answer to Guy. The discriminant of a polynomial $p$ is $0$ iff $p$ admits at last one multiple root.
The eigenvalues of $M$ are: for $n=2r+1$,  $a_{r+1},(\pm\sqrt{a_ia_{n-i+1}})_{i\leq r}$ and for $n=2r$, $(\pm\sqrt{a_ia_{n-i+1}})_{i\leq r}$. Then you can deduce easily the factors of $discrim(p)$.


text:
Q: Create an array with evenly-spaced values What is an easy way to generate an array that has values with a fixed distance between them?
For example:
1, 4, 7, 10,... etc

I need to be able to set start, end, and step distance.

A: In Ruby 1.9:
1.step(12).to_a   #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
1.step(12,3).to_a #=> [1, 4, 7, 10]

Or you can splat instead of to_a:
a = *1.step(12,3)  #=> [1, 4, 7, 10]

A: Try using Range.step:
> (1..19).step(3).to_a
=> [1, 4, 7, 10, 13, 16, 19]


text:
Q: Cloud Functions - Updating Timestamps Based on Warning I have the following setup for Firebase Cloud Functions:
index.js
const functions = require('firebase-functions');
const trackVote = require('./trackVote')
const admin = require('firebase-admin');
admin.initializeApp();

exports.trackVote = trackVote.handler;

trackvote.js
const functions = require('firebase-functions');
const admin = require('firebase-admin');

exports.handler = functions.firestore.document('/Polls/{pollId}/responses/{userId}').onCreate((data, context) => {
                  const answerSelected = data.data().answer;

                  const answerRef = admin.firestore().doc(`Polls/${context.params.pollId}/answers/${answerSelected}`);
                  const voteCountRef = admin.firestore().doc(`Polls/${context.params.pollId}`);

                   return admin.firestore().runTransaction(t => {
                               return t.get(answerRef)
                                   .then(doc => {
                                       if (doc.data()) {
                                           t.update(answerRef, { vote_count: doc.data().vote_count + 1 });
                                       }
                                   })
                           }).then(result => {
                               return admin.firestore().runTransaction(t => {
                                           return t.get(voteCountRef)
                                               .then(doc => {
                                                   if (doc.data()) {
                                                       t.update(voteCountRef, {vote_count:doc.data().vote_count+1});
                                                   }
                                               });
                                        });
                           });
           });

I received the below warning and was curious what changes I need to make within my code on both the cloud functions side and the client side:
TypeError: db.settings is not a function
at Object.<anonymous> (/Users/troychuinard/Code/FanPolls/functions/index.js:13:4)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at /usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js:21:11
at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js:61:3)

Note: I may need to update my Cloud Functions, which I can do, however I am curious how that would impact the code in both my index.js and trackVote.js

A: const admin = require('firebase-admin');
const functions = require('firebase-functions');
let firebaseApp;
if (admin.apps.length > 0) {
  firebaseApp = admin.app()
} else {
  firebaseApp = admin.initializeApp(functions.config().firebase)
}

let db = firebaseApp.firestore()
db.settings({ timestampsInSnapshots: true })


text:
Q: Python Selenium Geckodriver Detected as Bot I am trying to scrape the site skyscanner.com and they seem to very easily detect my code as a bot. I tried with fresh rotating proxies and 99% of the times they show a captcha at the very first search I make. I use this code for other sites and that doesn't happen, so I've no idea what else to change to avoid being detected so quickly. Another red flag I saw is that the same proxies if I try them on my personal computer, I don't see the captcha. So it must be some setup on selenium.
Here is the way I create a new driver:
def getDriver(proxy,proxy_port)
        proxy_profile = webdriver.FirefoxProfile()
        # Proxy setup
        proxy_profile.set_preference("network.proxy.type", 1)
        proxy_profile.set_preference("network.proxy.http",proxy)
        proxy_profile.set_preference("network.proxy.http_port",int(proxy_port))
        proxy_profile.set_preference("network.proxy.https",proxy)
        proxy_profile.set_preference("network.proxy.https_port",int(proxy_port))
        proxy_profile.set_preference("network.proxy.ssl",proxy)
        proxy_profile.set_preference("network.proxy.ssl_port",int(proxy_port))
        proxy_profile.set_preference("network.proxy.ftp",proxy)
        proxy_profile.set_preference("network.proxy.ftp_port",int(proxy_port))
        proxy_profile.set_preference("network.proxy.socks",proxy)
        proxy_profile.set_preference("network.proxy.socks_port",int(proxy_port))
        # Remote DNS test
        proxy_profile.set_preference("network.proxy.socks_remote_dns", True)
        # Disable CSS (breaks the done loading condition)
        #proxy_profile.set_preference('permissions.default.stylesheet', 2)
        # Disable images
        proxy_profile.set_preference('permissions.default.image', 2)
        # Disable flash
        proxy_profile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so','false')
        # User agent
        self.info(self.userAgent)
        proxy_profile.set_preference("general.useragent.override", self.userAgent)
        # Avoid detection variables
        proxy_profile.set_preference("dom.webdriver.enabled", False)
        proxy_profile.set_preference('useAutomationExtension', False)
        options = Options()
        options.add_argument("--headless")
        return webdriver.Firefox(firefox_profile=proxy_profile, firefox_options=options)

Any thoughts on something else to try and make it more difficult to detect? Thanks!

A: i've had the same situation like you've described. This is how i have solved it:

*

*Make your request via selenium

*Solve the captcha yourself

*Save the cookies

*Use these cookies on your future searches to avoid the captcha

here are the function to safe and load cookies:
def safe_cookies(driver):
    pickle_filename = "cookies.pkl"
    pickle.dump(driver.get_cookies(), open(pickle_filename, "wb"))

def load_cookies(driver):
    cookies = pickle.load(open("cookies.pkl", "rb"))

    if len(cookies) > 0:
        for cookie in cookies:
            driver.add_cookie(cookie)

        driver.refresh()

load the cookies back in every time you are loading the page for the first time:
...
driver.get("https://www.skyscanner.com/")
load_cookies(driver)
...


text:
Q: PHPReport and Stored Procedure I'm trying to run my PHPReport script with my Stored Procedure Results, everything seems okay but i'm getting not getting results in my view the code is below
<?php
include '@ConnectDB.php' ;
include './includes/PHPReport.php';

        $inCucode   = "GLLL01";
        $inProdCode =  "71MRT18818W";
        $inBuyNum    = "NONS01";

        // Prepare Stored Procedure call //
        $proc = 'CALL WLKLIB.DSH3518SQ(?,?,?)';
        $stmt = db2_prepare($conn, $proc) or die("db2_prepare failed " . db2_stmt_error(). " and " .db2_stmt_errormsg());
        db2_bind_param($stmt, 1, 'inCucode', DB2_PARAM_IN,DB2_CHAR);
        db2_bind_param($stmt, 2, 'inProdCode', DB2_PARAM_IN,DB2_CHAR);
        db2_bind_param($stmt, 3, 'inBuyNum', DB2_PARAM_IN,DB2_CHAR);
        db2_execute($stmt);
        while (db2_fetch_row($stmt)) {
            $Fld2 =  db2_result($stmt, 1);
            $Fld1  = db2_result($stmt, 0);
            $Fld3 =  db2_result($stmt, 2);
            $Fld4 =  db2_result($stmt, 3);
            $Fld5 =  db2_result($stmt, 4);
            $Fld6 =  db2_result($stmt, 5);
            $Fld7 =  db2_result($stmt, 6);
            $Fld8 =  db2_result($stmt, 7);
            $Fld9 =  db2_result($stmt, 8);
            $Fld10 =  db2_result($stmt, 9);
            $Fld11 =  db2_result($stmt, 10);
            $Fld12 =  db2_result($stmt, 11);
            $Fld13 =  db2_result($stmt, 12);

            //Create new PHPReport object
            $R=new PHPReport();

            $R->load(array(
                'id'=>'product',
                'header'=>array(
                    'SKU','Customer Code','Discontinued', 'Available Quantity','Lead Time','Last Order Quanity','Daily Demand','Days on Hand','PO Last Issued Date','PO Quantity','Price','Product Description','Company Code'
              ),

               'config'=>array(
                   0=>array('width'=>120,'align'=>'right'),
                   1=>array('width'=>100,'align'=>'left'),
                   2=>array('width'=>120,'align'=>'left'),
                   3=>array('width'=>120,'align'=>'left'),
                   4=>array('width'=>120,'align'=>'left'),
                   5=>array('width'=>120,'align'=>'left'),
                   6=>array('width'=>120,'align'=>'left'),
                   7=>array('width'=>120,'align'=>'left'),
                   8=>array('width'=>120,'align'=>'left'),
                   9=>array('width'=>120,'align'=>'left'),
                   10=>array('width'=>120,'align'=>'left'),
                   11=>array('width'=>200,'align'=>'left'),
                   12=>array('width'=>120,'align'=>'left'),
                   ),
                'data'=>array(
                    array($Fld2),
                    array($Fld1),
                    array($Fld3),
                    array($Fld4),
                    array($Fld5),
                    array($Fld6),
                    array($Fld7),
                    array($Fld8),
                    array($Fld9),
                    array($Fld10),
                    array($Fld11),
                    array($Fld12),
                    array($Fld13)
                ),
            )

          );
            echo $R->render();
            exit();
        }
  ?>

I'm i missing anything, why i'm i not getting any results in my view, the page is just blank no errors nothing. I troubleshooted and it came down to the 'db2_execute($stmt);' doesn't run it fails. How can i solve this problem?


text:
Q: Audio Player with foreground services that works for both iOS+ Android in flutter I want to implement Audio player with foreground services in flutter that works on both  ios + android. I've searched lots of sites, documentation, and pluggins but couldn't find anything perfect. Some of them are only specific to one platform. So I ended up creating Audio player with Native bridge. if anyone knows how I can implement this without native bridge, then please help me. I would be greatfull.
Thanks in advance.

A: I think package:audio_service will do what you're looking to achieve.


text:
Q: How to enable CentOS 7 to connect to an external SMTP? I have a web application deployed in a webserver, running on a CentOS 7.
This web application sends e-mails through an external SMTP (in-v3.mailjet.com, port 587).
How can I enable CentOS to connect to that external SMTP?
This server is hosted at Digital Ocean.

A: The shodanshok's comment is right:

If you can't telnet the SMTP server, the connection is blocked at the
  gateway or server level.

So I opened a ticket for Digital Ocean's support and got the following response:

To curb a recent increase in abuse and SPAM, we have an initial SMTP
  block on new accounts created in certain contexts.
To remove that block we'd like to do some manual account verification.
Please let us know the following:

*

*Your Name

*Location

*Phone Number

*The reason you are requesting the removal of the SMTP block

  Also, please provide as many of the following as you can to help us
  verify your identity:

*

*Your public Twitter handle

*Your blog

*Your company or personal website

*Your public Facebook profile

  We take SPAM very seriously as we comply fully with the CAN-SPAM Act.
  If you're not familiar, this says that you may not send bulk email
  unless you maintain a double-authorized list of subscribed members
  including IP addresses and relevant contact information. Also, you
  must follow guidelines for including removal links with all sent
  emails according to the CAN-SPAM Act.

I provided all the information and Digital Ocean has unblocked the SMTP connection.

A: What is blocking your connections is SELINUX, probably. To diagnose, follow these steps:

*

*issue setenforce 0 and re-try connections to the SMTP server

*if it works, re-enable SELINUX by issuing setenforce 1 and enable the specific permission you need through setsebool -P httpd_can_network_connect on


text:
Q: jQuery not recognizing appended HTML Quite new to jQuery so exercise patience with me :)
I think this should be a quick one: On clicking .color, I've appended some basic HTML to a page with the class .selected. When I hover on any div.color with the html (.selected) appended inside of it, I want to add some CSS to .selected to give it a hover on state, by using
$('.color').toggle(
    function(){
        $('.color').empty('span'),
        $(this).append("")
    },
    function() {
        $('.color').empty('span');
    })

$('.color').click( function(){
    $('.color').toggle;
})

$('.color').has('.selected').hover(
        function(){
            $(".color span").css('background-position', '0px -24px');
        },
        function() {
            $(".color span").css('background-position', '0px 0px');
        })

The problem is that jQuery isn't recognizing that the appended html exists. I've manually inserted the HTML and it works perfectly, but through .append it doesn't cooperate.
Thanks
EDIT: Demo here: http://judsoncollier.com/DEMO/

A: since you have appended the class="selected", you can manipulate the class behavior by adding this class in your css file for hover.
.selected:hover{
//your css
}

you won't need jquery to do this and it would save you a lot of time.

A: Try adding event handlers using live() method.
http://api.jquery.com/live/

A: I have had trouble with using jQuery .on() in the past (plus only for jQuery version 1.7 I think).  Try using jQuery's .live() method on your ".selected" selector like this:
    $('.selected').live("mouseenter",function(){

//do stuff
});
    $('.selected').live("mouseleave",function(){

//do stuff
});

A: When you call the .click() or .hover() methods (or .keyup(), etc.), jQuery assigns a handler to any elements that match the selector ('.color' in your case) at that moment. It doesn't apply to any elements added in the future or to existing elements that don't currently match but which are later modified. Neither does it automatically remove the click handler from elements changed to no longer match that selector.
Fortunately there are three ways to assign a handler such that it will work for elements added in the future: .on(), .delegate(), and .live() - if you are using jQuery 1.7+ you should use .on(), otherwise use .delegate() because .live() is deprecated (and I mention it only for completeness). In general terms the way all three work is they assign a handler to a container element and then when the event occurs they check to see if the target element matches the selector you originally specified. This means that all three will let you define your handler once and have it automatically apply to elements added in the future. (Again for completeness I should mention that .on() does more than this depending on the parameters you pass it - for full info read the doco page.)
So anyway, to fix your code try this:
// if your elements have an appropriate container, then specify it
// like so:
$('#yourcontainer').on('hover', '.color .selected', function(){
      $(".color span").css('background-position', '0px -24px');
},
function() {
      $(".color span").css('background-position', '0px 0px');
});

// OR, if you don't have a container and don't want to add one
// just specify document:
$(document).on('hover', '.color .selected', function(){
   // etc

Though having said that I'm not sure if you can assign "hover" with .on(), .delegate() or .live(): you might have to assign "mouseenter" and "mouseleave" instead.
EDIT: Regarding what you're doing appending an empty span: you seem to be trying to use this like a flag on your element. A much better way to do that is to simply add and remove another class to your element using .addClass() and .removeClass().

A: You can use jquery live event inorder to attach events to the modified html content(that were injected into dom after the jquery ready function was fired).I have modified taken ur code and made it work.Please check this link http://jsfiddle.net/zySNn/ Hope it helps.


text:
Q: How to create popup window(modal dialog box) in HTML On my web site a have a page where  where user can ask questions.
Now I want to add Add Image button that must invoke kinda modal dialog box where user
needs to upload the picture from computer. Then window is closed and  link to image is placed back to post.
I wanna do something similar like in SO https://stackoverflow.com/questions/ask - try pressing Image button and u'll see nice popup window coming up.
Please suggest what is best way to implement that stuff. I am asking for code snippet rather about technology

A: Perhaps this could be of some help once you have started http://jqueryui.com/demos/dialog/#modal-form. Other wise you can use the DOM structure and create each and every element using appendChild and CreateElement and use css to give a good look.

A: That popup window you can do by using any jQuery Library like colorbox. For image upload thing you will have to alternately look for some Flash Based or Java based uploads.
http://colorpowered.com/colorbox/core/example1/index.html
http://swfupload.org/

A: easy as drink water ;)
with jquery create pop up ... like this ( http://fancybox.net/ ) and then add form to pop up for upload image ... then when file uploaded only return absolute address to parent editor ... now you can show your image ;)

A: You will need client side scripting.  I reccomend learning Javascript, then Jquery, then Jquery UI.  If you know php it should not be too dificult to pickup the basics.


text:
Q: long table problems with horizontal line Hi all I want to produce long table so I wrote this code:
\documentclass[a4paper,11pt,english]{report}

\usepackage{longtable}
 \usepackage{multirow}
 \usepackage{graphicx}
 \usepackage[table,xcdraw]{xcolor}
\usepackage{lipsum} % just for dummy text- not needed for a longtable

\begin{document}
\lipsum[1]
\lipsum[1]
\lipsum[1]

\definecolor{lightgray}{HTML}{EFEFEF}
\setlength\arrayrulewidth{.5pt}
\begin{longtable}{|
>{\columncolor{lightgray}}p{0.2\linewidth} | p{0.175\linewidth} |}
\hline
foo & bar \\[.5pt]\noalign{\nobreak\vskip-.5pt} \hline\noalign{\nobreak\vskip.5pt}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\[.5pt]\noalign{\nobreak\vskip-.5pt} \hline\noalign{\nobreak\vskip.5pt}
\caption{Your caption here} % needs to go inside longtable environment
\label{tab:myfirstlongtable}
\end{longtable}

Table \ref{tab:myfirstlongtable} shows my first longtable.
\end{document}

The code works fine but there is a small problem: when the table is separated to multiple pages there is no horizontal line drawn in between, here is the output at which I highlighted the problem:

I want a horizontal line to be drawn at the end of the table at page 1 and at the beginning of the table at page 2
How to achieve that ?
Your help is appreciated

A: This code, respecting the longtable syntax  (caption & label in the firsthead section) and using \hhline does what you want, I think:
\definecolor{lightgray}{HTML}{EFEFEF}
\setlength\arrayrulewidth{.5pt}
\begin{longtable}{|>{\columncolor{lightgray}}p{0.2\linewidth} | p{0.175\linewidth} |}
\caption{Your caption here} % needs to go inside longtable environment
\label{tab:myfirstlongtable} \\
\endfirsthead
\caption{Your caption here (continued)}\\
\hline
\endhead
\hline
foo & bar \\[.5pt]\noalign{\nobreak\vskip-.5pt} \hline%\noalign{\nobreak\vskip.5pt}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \hhline{|--|}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\ \cline{2-2}
foo & bar \\[.5pt]\noalign{\nobreak\vskip-.5pt} \hline\noalign{\nobreak\vskip.5pt}
\end{longtable}


text:
Q: Using laravel mix to include js dependencies i can't really get my js libraries  to work , some time ago i decided to have a separate js file for every library i use (so i have a jquery.js file and a bootstrap.js file included in my layout) ,everything was working just fine until i had to add jquery-ui to  this chaos , and got this error
Uncaught TypeError: $(...).slider is not a function

until i loaded ,jquery and jquery-ui in the same file .The problem is i dont want to include jquery ui everywhere i include jquery , beacuse i only use it in 2 pages. Below i will put my code :
jquery-ui.slider.js:
require('jquery-ui/ui/widgets/slider');
require('./components/carFilter.js');

app.js:
window.$ = window.jQuery = require('jquery');
require('./bootstrap');

webpack.mix.js:
mix.js('resources/assets/js/app.js', 'public/js')
mix.js('resources/assets/js/jquery-ui.slider.js', 'public/js');

I am using the following npm modules :

*

*bootstrap-sass

*jquery

*jquery-ui

A: I ended up by just creating a file where i require jquery,bootstrap.js and then i require this file in a specific file for the two pages...
Below its the code:
app.js
window.$ = window.jQuery = require('jquery');
require('./bootstrap');

page.js
require('./app.js')
require('jquery-ui/ui/widgets/slider');

It seams that now it is working ,even if now i have to include a js file in all the views...Question its still open , i hope somone have a beter idea .

A: I think laravel-mix only serves the purpose when you have small sites with pages that all include the same app.js & app.css files.
When you have complex portal with multiple pages that have different set of frontend "plugins" you have to split your entries & generate a table of dependencies automatically.
After a lot of time searching I've come to the conclusion that the best approach would be switch to webpack-encore from Symfony.
You can read more about it's capabilities here Webpack Encore Official Documentation.
Now the question is how to embed it to Laravel? It's quite easy, I've just reverse engineered the Symfony's PHP bundle for that and here is the result:
https://github.com/ntpages/laravel-encore
Now you just have to include you're dependency in the page entry and it's all handled automatically.

A: I think you should load jquery-ui when a condition is met, like:
if (window.loadJQueryUI) {
    require('jquery-ui');
}

And you need to initialize loadJQueryUI for the two pages, like this:
<script type="text/javascript">
    window.loadJQueryUI = true;
</script>


text:
Q: Determining when database zip is unpacked I am fetching a db zip on initial startup of an AIR app (after 1st install), which I then unpack via FZip.
After this operation I immediately need to load data from the generated sqlite db, which fails since I seem not able to determine when the zip is completely unpacked and/or the sqlite has been created.
Any suggestions? Thx!

*

*For clarity: I am dispatching an event within Cairngorm after my result operation's been done of course, but this doesn't seem sufficient.

A: Well you kind of have the answer in the question.
I had a quick look at the FZip docs and noticed there's an event dispatched when the
zip file is loaded.
Just scanning through the code, in FZipLibrary.as there's the processNext() method
which contains a while loop to traverse the files in the archive. You could add a FILE_PARSED constant to FZipEvent and dispatch such an event from there, after the while loop is finished.
I can't try test this at the moment, but here's what I mean:
/*
 * Copyright (C) 2006 Claus Wahlers and Max Herkender
 *
 * This software is provided 'as-is', without any express or implied
 * warranty.  In no event will the authors be held liable for any damages
 * arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must not
 *    claim that you wrote the original software. If you use this software
 *    in a product, an acknowledgment in the product documentation would be
 *    appreciated but is not required.
 * 2. Altered source versions must be plainly marked as such, and must not be
 *    misrepresented as being the original software.
 * 3. This notice may not be removed or altered from any source distribution.
 */

package deng.fzip
{
    import deng.fzip.FZipFile;
    import flash.events.Event;

    /**
     * FZip dispatches FZipEvent objects when a file contained in the
     * ZIP archive has finished loading and can be accessed. There is
     * only one type of FZipEvent: FZipErrorEvent.FILE_LOADED.
     */
    public class FZipEvent extends Event
    {
        /**
        * The file that has finished loading.
        */
        public var file:FZipFile;

        /**
        * Defines the value of the type property of a FZipEvent object.
        */
        public static const FILE_LOADED:String = "fileLoaded";

        /**
        * Zip contents were parsed
        */
        public static const FILE_PARSED:String = "fileParsed";

        /**
         * Constructor
         *
         * @param type The type of the event. Event listeners can
         * access this information through the inherited type property.
         * There is only one type of FZipEvent:
         * FZipEvent.PARSE_ERROR.
         *
         * @param file The file that has finished loading.
         *
         * @param bubbles Determines whether the Event object participates
         * in the bubbling stage of the event flow. Event listeners can
         * access this information through the inherited bubbles property.
         *
         * @param cancelable Determines whether the Event object can be
         * canceled. Event listeners can access this information through
         * the inherited cancelable property.
         */
        public function FZipEvent(type:String, file:FZipFile = null, bubbles:Boolean = false, cancelable:Boolean = false) {
            this.file = file;
            super(type, bubbles, cancelable);
        }

        /**
         * Creates a copy of the FZipEvent object and sets the value
         * of each property to match that of the original.
         *
         * @return A new FZipEvent object with property values that
         * match those of the original.
         */
        override public function clone():Event {
            return new FZipEvent(type, file, bubbles, cancelable);
        }
    }
}

That would be just adding the constant for the event.
/*
 * Copyright (C) 2006 Claus Wahlers and Max Herkender
 *
 * This software is provided 'as-is', without any express or implied
 * warranty.  In no event will the authors be held liable for any damages
 * arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must not
 *    claim that you wrote the original software. If you use this software
 *    in a product, an acknowledgment in the product documentation would be
 *    appreciated but is not required.
 * 2. Altered source versions must be plainly marked as such, and must not be
 *    misrepresented as being the original software.
 * 3. This notice may not be removed or altered from any source distribution.
 */

package deng.fzip {
    import flash.events.*;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.DisplayObject;
    import flash.display.Loader;
    import flash.utils.ByteArray;

    /**
     * Dispatched when all pending files have been processed.
     *
     * @eventType flash.events.Event.COMPLETE
     */
    [Event(name="complete", type="flash.events.Event")]

    /**
     *
FZipLibrary works with a FZip instance to load files as
     * usable instances, like a DisplayObject or BitmapData. Each file
     * from a loaded zip is processed based on their file extentions.
     * More than one FZip instance can be supplied, and if it is
     * currently loading files, then FZipLibrary will wait for incoming
     * files before it completes.

     *
     *
Flash's built-in Loader class is used to convert formats, so the
     * only formats currently supported are ones that Loader supports.
     * As of this writing they are SWF, JPEG, GIF, and PNG.

     *
     *
The following example loads an external zip file, outputs the
     * width and height of an image and then loads a sound from a SWF file.

     *
     *

     * package {
     *  import flash.events.*;
     *  import flash.display.BitmapData;
     *  import deng.fzip.FZip;
     *  import deng.fzip.FZipLibrary;
     *
     *  public class Example {
     *      private var lib:FZipLibrary;
     *
     *      public function Example(url:String) {
     *          lib = new FZipLibrary();
     *          lib.formatAsBitmapData(".gif");
     *          lib.formatAsBitmapData(".jpg");
     *          lib.formatAsBitmapData(".png");
     *          lib.formatAsDisplayObject(".swf");
     *          lib.addEventListener(Event.COMPLETE,onLoad);
     *
     *          var zip:FZip = new FZip();
     *          zip.load(url);
     *          lib.addZip(zip);
     *      }
     *      private function onLoad(evt:Event) {
     *          var image:BitmapData = lib.getBitmapData("test.png");
     *          trace("Size: " + image.width + "x" + image.height);
     *
     *          var importedSound:Class = lib.getDefinition("data.swf", "SoundClass") as Class;
     *          var snd:Sound = new importedSound() as Sound;
     *      }
     *  }
     * }

     *
     * @see http://livedocs.macromedia.com/flex/201/langref/flash/display/Loader.html
     */
    public class FZipLibrary extends EventDispatcher {
        static private const FORMAT_BITMAPDATA:uint = (1 << 0);
        static private const FORMAT_DISPLAYOBJECT:uint = (1 << 1);

        private var pendingFiles:Array = [];
        private var pendingZips:Array = [];
        private var currentState:uint = 0;
        private var currentFilename:String;
        private var currentZip:FZip;
        private var currentLoader:Loader;

        private var bitmapDataFormat:RegExp = /[]/;
        private var displayObjectFormat:RegExp = /[]/;
        private var bitmapDataList:Object = {};
        private var displayObjectList:Object = {};

        /**
         * Constructor
         */
        public function FZipLibrary() {
        }
        /**
         * Use this method to add an FZip instance to the processing queue.
         * If the FZip instance specified is not active (currently receiving files)
         * when it is processed than only the files already loaded will be processed.
         *
         * @param zip An FZip instance to process
         */
        public function addZip(zip:FZip):void {
            pendingZips.unshift(zip);
            processNext();
        }
        /**
         * Used to indicate a file extension that triggers formatting to BitmapData.
         *
         * @param ext A file extension (".jpg", ".png", etc)
         */
        public function formatAsBitmapData(ext:String):void {
            bitmapDataFormat = addExtension(bitmapDataFormat,ext);
        }
        /**
         * Used to indicate a file extension that triggers formatting to DisplayObject.
         *
         * @param ext A file extension (".swf", ".png", etc)
         */
        public function formatAsDisplayObject(ext:String):void {
            displayObjectFormat = addExtension(displayObjectFormat,ext);
        }
        /**
         * @private
         */
        private function addExtension(original:RegExp,ext:String):RegExp {
            return new RegExp(ext.replace(/[^A-Za-z0-9]/,"\\$&")+"$|"+original.source);
        }

        /**
         * Request a file that has been formatted as BitmapData.
         * A ReferenceError is thrown if the file does not exist as a
         * BitmapData.
         *
         * @param filename The filename of the BitmapData instance.
         */
        public function getBitmapData(filename:String):BitmapData {
            if (!bitmapDataList[filename] is BitmapData) {
                throw new Error("File \""+filename+"\" was not found as a BitmapData");
            }
            return bitmapDataList[filename] as BitmapData;
        }
        /**
         * Request a file that has been formatted as a DisplayObject.
         * A ReferenceError is thrown if the file does not exist as a
         * DisplayObject.
         *
         * @param filename The filename of the DisplayObject instance.
         */
        public function getDisplayObject(filename:String):DisplayObject {
            if (!displayObjectList.hasOwnProperty(filename)) {
                throw new ReferenceError("File \""+filename+"\" was not found as a DisplayObject");
            }
            return displayObjectList[filename] as DisplayObject;
        }
        /**
         * Retrieve a definition (like a class) from a SWF file that has
         * been formatted as a DisplayObject.
         * A ReferenceError is thrown if the file does not exist as a
         * DisplayObject, or the definition does not exist.
         *
         * @param filename The filename of the DisplayObject instance.
         */
        public function getDefinition(filename:String,definition:String):Object {
            if (!displayObjectList.hasOwnProperty(filename)) {
                throw new ReferenceError("File \""+filename+"\" was not found as a DisplayObject, ");
            }
            var disp:DisplayObject = displayObjectList[filename] as DisplayObject;
            try {
                return disp.loaderInfo.applicationDomain.getDefinition(definition);
            } catch (e:ReferenceError) {
                throw new ReferenceError("Definition \""+definition+"\" in file \""+filename+"\" could not be retrieved: "+e.message);
            }
            return null;
        }

        /**
         * @private
         */
        private function processNext(evt:Event = null):void {
            while (currentState === 0) {
                if (pendingFiles.length > 0) {
                    var nextFile:FZipFile = pendingFiles.pop();
                    if (bitmapDataFormat.test(nextFile.filename)) {
                        currentState |= FORMAT_BITMAPDATA;
                    }
                    if (displayObjectFormat.test(nextFile.filename)) {
                        currentState |= FORMAT_DISPLAYOBJECT;
                    }
                    if ((currentState & (FORMAT_BITMAPDATA | FORMAT_DISPLAYOBJECT)) !== 0) {
                        currentFilename = nextFile.filename;
                        currentLoader = new Loader();
                        currentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler);
                        currentLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderCompleteHandler);
                        var content:ByteArray = nextFile.content;
                        content.position = 0;
                        currentLoader.loadBytes(content);
                        break;
                    }
                } else if (currentZip == null) {
                    if (pendingZips.length > 0) {
                        currentZip = pendingZips.pop();
                        var i:uint = currentZip.getFileCount();
                        while (i > 0) {
                            pendingFiles.push(currentZip.getFileAt(--i));
                        }
                        if (currentZip.active) {
                            currentZip.addEventListener(Event.COMPLETE, zipCompleteHandler);
                            currentZip.addEventListener(FZipEvent.FILE_LOADED, fileCompleteHandler);
                            currentZip.addEventListener(FZipErrorEvent.PARSE_ERROR, zipCompleteHandler);
                            break;
                        } else {
                            currentZip = null;
                        }
                    } else {
                        dispatchEvent(new Event(Event.COMPLETE));
                        break;
                    }
                } else {
                    break;
                }
            }
            dispatchEvent(new FZipEvent(FZipEvent.FILE_PARSED));
        }

        /**
         * @private
         */
        private function loaderCompleteHandler(evt:Event):void {
            if ((currentState & FORMAT_BITMAPDATA) === FORMAT_BITMAPDATA) {
                if (currentLoader.content is Bitmap && (currentLoader.content as Bitmap).bitmapData is BitmapData) {
                    var bitmapData:BitmapData = (currentLoader.content as Bitmap).bitmapData
                    bitmapDataList[currentFilename] = bitmapData.clone();
                    //trace(currentFilename+" -> BitmapData ("+bitmapData.width+"x"+bitmapData.height+")");
                } else if (currentLoader.content is DisplayObject) {
                    var width:uint = uint(currentLoader.content.width);
                    var height:uint = uint(currentLoader.content.height);
                    if (width && height) {
                        var bitmapData2:BitmapData = new BitmapData(width,height,true,0x00000000);
                        bitmapData2.draw(currentLoader);
                        bitmapDataList[currentFilename] = bitmapData2;
                        //trace(currentFilename+" -> BitmapData ("+bitmapData2.width+"x"+bitmapData2.height+")");
                    } else {
                        trace("File \""+currentFilename+"\" could not be converted to BitmapData");
                    }
                } else {
                    trace("File \""+currentFilename+"\" could not be converted to BitmapData");
                }
            }
            if ((currentState & FORMAT_DISPLAYOBJECT) === FORMAT_DISPLAYOBJECT) {
                if (currentLoader.content is DisplayObject) {
                    //trace(currentFilename+" -> DisplayObject");
                    displayObjectList[currentFilename] = currentLoader.content;
                } else {
                    currentLoader.unload();
                    trace("File \""+currentFilename+"\" could not be loaded as a DisplayObject");
                }
            } else {
                currentLoader.unload();
            }
            currentLoader = null;
            currentFilename = "";
            currentState &= ~(FORMAT_BITMAPDATA | FORMAT_DISPLAYOBJECT);
            processNext();
        }
        /**
         * @private
         */
        private function fileCompleteHandler(evt:FZipEvent):void {
            pendingFiles.unshift(evt.file);
            processNext();
        }
        /**
         * @private
         */
        private function zipCompleteHandler(evt:Event):void {
            currentZip.removeEventListener(Event.COMPLETE, zipCompleteHandler);
            currentZip.removeEventListener(FZipEvent.FILE_LOADED, fileCompleteHandler);
            currentZip.removeEventListener(FZipErrorEvent.PARSE_ERROR, zipCompleteHandler);
            currentZip = null;
            processNext();
        }
    }
}

And this would be another line of code added to dispatch the FILE_PARSED event.
The dirty version would be to have a try/catch block and try to access the file repeatedly(in a timer or enter_frame). When the file is finally ready, stop this check loop and carry on.
HTH


text:
Q: Display view input field based on condition angularjs [{id: "1", name: "first_name"},
{id: "2", name: "last_name"},
{id: "3", name: "city"}]

 <input type="text" name="first_name" ng-model="user.first_name">

<input type="text" name="last_name" ng-model="user.last_name">

<input type="text" name="city" ng-model="user.city">

$scope.flag = false;
angular.forEach(response, function(value, key){
              $scope.valueName = value.name;
        if($scope.valueName == 'first_name') {
            $scope.flag = true;
        }else if($scope.valueName == 'last_name'){
            $scope.flag = true;
        }else if($scope.valueName == 'city'){
            $scope.flag = true;
        }else{
            $scope.flag = false;
        }
          });

How to display view input field based on condition angularjs,
This should not be right solution because have to write too much code on it we should have to use something else that can help to read the view format and display based on condition, any assistance on it would be very greatful thanks in advance

A: One of the solutions you can loop on your JSONobject include your condition in the ng-if directly as :

 <input type="text" name="first_name" ng-model="user.first_name">

<input type="text" name="last_name" ng-model="user.last_name">

<input type="text" name="city" ng-model="user.city" >

or
without ng-repeat-start

 <input type="text" name="first_name" ng-model="user.first_name">

<input type="text" name="last_name" ng-model="user.last_name">

<input type="text" name="city" ng-model="user.city" >

So you dont need the flag anymore. The records object is your JSON object holding your field info